From 3d6d1e78b5a7767be034abd24fd78f63fa8327ae Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Mon, 7 Jun 2021 15:00:24 -0700 Subject: [PATCH] Allow blocklisting cfgs. Test: Use it for a crate. Change-Id: I72e383ce58f64c7e545db3049376feea8ac006d1 --- scripts/cargo2android.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py index c567b68b8..64af8455c 100755 --- a/scripts/cargo2android.py +++ b/scripts/cargo2android.py @@ -676,7 +676,8 @@ class Crate(object): if self.edition: self.write(' edition: "' + self.edition + '",') self.dump_android_property_list('features', '"%s"', self.features) - self.dump_android_property_list('cfgs', '"%s"', self.cfgs) + cfgs = [cfg for cfg in self.cfgs if not cfg in self.runner.args.cfg_blocklist] + self.dump_android_property_list('cfgs', '"%s"', cfgs) self.dump_android_flags() if self.externs: self.dump_android_externs() @@ -1616,6 +1617,11 @@ def get_parser(): default=[], help=('Do not emit the given tests. ' + 'Pass the path to the test file to exclude.')) + parser.add_argument( + '--cfg-blocklist', + nargs='*', + default=[], + help='Do not emit the given cfg.') parser.add_argument( '--no-test-mapping', action='store_true',