gn2bp: Add flags and include_dirs to target
Test: ./update_results.sh
Change-Id: Iac05e49a7f195afec72e229f667a402bae8a1742
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index fc0508f..10abd9b 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -957,8 +957,9 @@
# -DANDROID is added by default but target.defines contain -DANDROID if it's required.
# So adding -UANDROID to cancel default -DANDROID if it's not specified.
# This is needed for some targets(e.g. symbolize)
- if "ANDROID" not in defines:
- cflags.add("-UANDROID")
+ # TODO: Set -UANDROID considering common define
+ # if "ANDROID" not in defines:
+ # cflags.add("-UANDROID")
return cflags
def set_module_flags(module, cflags, defines):
@@ -1077,6 +1078,10 @@
if target.type in gn_utils.LINKER_UNIT_TYPES:
set_module_flags(module, target.cflags, target.defines)
set_module_include_dirs(module, target.cflags, target.include_dirs)
+ # TODO: set_module_xxx is confusing, apply similar function to module and target in better way.
+ for arch_name, arch in target.arch.items():
+ set_module_flags(module.target[arch_name], arch.cflags, arch.defines)
+ set_module_include_dirs(module.target[arch_name], arch.cflags, arch.include_dirs)
if module.is_compiled():
module.host_supported = target.host_supported()