Stop cargo2android.py from printing the --cargo_bin argument.
cargo2android.py prints out all of its arguments to the top of the
Android.bp file (and into a config file if that option was set) as a
way of persisting them. However, we do not want to persist the
--cargo_bin directory, as this is a proprety of the local setup and
not the crate itself. Thus ensure we don't print this.
Test: Run with argument.
Change-Id: If5292d1d740b08755ba6d31654239e93232fdc49
diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py
index 7b7a9a5..f363b1e 100755
--- a/scripts/cargo2android.py
+++ b/scripts/cargo2android.py
@@ -1278,7 +1278,11 @@
self.bp_files.add(name)
license_section = self.read_license(name)
with open(name, 'w') as outf:
- outf.write(ANDROID_BP_HEADER.format(args=' '.join(sys.argv[1:])))
+ print_args = sys.argv[1:].copy()
+ if '--cargo_bin' in print_args:
+ index = print_args.index('--cargo_bin')
+ del print_args[index:index+2]
+ outf.write(ANDROID_BP_HEADER.format(args=' '.join(print_args)))
outf.write('\n')
outf.write(license_section)
outf.write('\n')
@@ -1842,7 +1846,7 @@
non_default_args = {}
for arg in args_dict:
if (args_dict[arg] != parser.get_default(arg) and arg != 'dump_config_and_exit'
- and arg != 'config'):
+ and arg != 'config' and arg != 'cargo_bin'):
non_default_args[arg.replace('_', '-')] = args_dict[arg]
# Write to the specified file.
with open(args.dump_config_and_exit, 'w') as f: