Allow blocklisting dependencies.
A few crates have patches that manually remove a dependency that
cargo2android.py adds. This option can allow us to remove those
patches.
Test: Use when running on a few crates.
Change-Id: Ie8337789ab232fb726ccfe361df489acfdd31b20
diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py
index 2ab58e1..c6a35cd 100755
--- a/scripts/cargo2android.py
+++ b/scripts/cargo2android.py
@@ -822,6 +822,8 @@
lib_name = groups.group(1)
else:
lib_name = re.sub(' .*$', '', lib)
+ if lib_name in self.runner.args.dependency_blocklist:
+ continue
if lib.endswith('.rlib') or lib.endswith('.rmeta'):
# On MacOS .rmeta is used when Linux uses .rlib or .rmeta.
rust_libs += ' "' + altered_name('lib' + lib_name) + '",\n'
@@ -1602,6 +1604,11 @@
nargs='*',
help='Mark the main library as apex_available with the given apexes.')
parser.add_argument(
+ '--dependency-blocklist',
+ nargs='*',
+ default=[],
+ help='Do not emit the given dependencies.')
+ parser.add_argument(
'--no-test-mapping',
action='store_true',
default=False,