gn2bp: fix host and device support properties
With proper arch support, we now have all the information to do this
properly.
Test: //components/cronet/android:cronet
Change-Id: Iab86261a6a4d775ba5f3b12b2487b7c27096580d
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 32ac640..ce6d1ac 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -1073,11 +1073,10 @@
name_without_toolchain = gn_utils.label_without_toolchain(target.name)
if target.type == 'executable':
- if target.toolchain == gn_utils.HOST_TOOLCHAIN:
- module_type = 'cc_binary_host'
- elif target.testonly:
+ if target.testonly:
module_type = 'cc_test'
else:
+ # Can be used for both host and device targets.
module_type = 'cc_binary'
module = Module(module_type, bp_module_name, gn_target_name)
elif target.type == 'static_library':
@@ -1119,7 +1118,6 @@
raise Error('Unknown target %s (%s)' % (target.name, target.type))
blueprint.add_module(module)
- module.host_supported = (name_without_toolchain in target_host_supported)
module.init_rc = target_initrc.get(target.name, [])
module.srcs.update(
gn_utils.label_to_path(src)
@@ -1163,6 +1161,9 @@
module_is_compiled = module.type not in ('genrule', 'filegroup')
if module_is_compiled:
+ module.host_supported = target.host_supported()
+ module.device_supported = target.device_supported()
+
# Don't try to inject library/source dependencies into genrules or
# filegroups because they are not compiled in the traditional sense.
module.defaults = [defaults_module]