gn2bp: handle target-specific dependencies
This currently only supports cc_library_static as its the only target
that is currently used in this way.
Test: //components/cronet/android:cronet
Change-Id: Ia3f0338f486890835691c1435ee1a297d9e62f81
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 10abd9b..ae36ffd 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -1160,6 +1160,17 @@
raise Error('Unknown dep %s (%s) for target %s' %
(dep_module.name, dep_module.type, module.name))
+ for arch_name, arch in target.arch.items():
+ for dep_name in arch.deps:
+ dep_module = create_modules_from_target(blueprint, gn, dep_name)
+ # Arch-specific dependencies currently only include cc_library_static.
+ # Revisit this approach once we need to support more target types.
+ if dep_module.type == 'cc_library_static':
+ module.target[arch_name].static_libs.add(dep_module.name)
+ else:
+ raise Error('Unsupported arch-specific dependency %s of target %s with type %s' %
+ (dep_module.name, target.name, dep_module.type))
+
return module
def create_java_module(blueprint, gn):