From cf4ebb00a6c5284ae3d2e01f8f84a065b212a28c Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Wed, 7 Apr 2021 08:39:51 -0700 Subject: [PATCH] Add a cargo2android flag to disable generating TEST_MAPPING. Generating a TEST_MAPPING file uses Bazel, which can be quite slow (multiple minutes). Add a flag to allow skipping it. This is off by default as it ideally will only be used for debugging. Test: Run all four configurations of --tests and this flag. Change-Id: I08bde29ea298fcf677addd86f6d953b6695e147f --- scripts/cargo2android.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py index 786cf8509..b5ddfe397 100755 --- a/scripts/cargo2android.py +++ b/scripts/cargo2android.py @@ -1172,6 +1172,8 @@ class Runner(object): """Dump all TEST_MAPPING files.""" if self.dry_run: print('Dry-run skip dump of TEST_MAPPING') + elif self.args.no_test_mapping: + print('Skipping generation of TEST_MAPPING') else: test_mapping = TestMapping(None) for bp_file_name in self.bp_files: @@ -1576,6 +1578,11 @@ def parse_args(): default=False, help=('run cargo build with existing Cargo.lock ' + '(used when some latest dependent crates failed)')) + parser.add_argument( + '--no-test-mapping', + action='store_true', + default=False, + help='Do not generate a TEST_MAPPING file. Use only to speed up debugging.') parser.add_argument( '--verbose', action='store_true',