gn2bp: Add defines to arch
Test: ./update_results.sh
Change-Id: Ia167511becaa4c1ddb3ed40e2b78732fc291cb8e
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 86e1216..fe73834 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -6697,8 +6697,6 @@
"cronet_aml_defaults",
],
cflags: [
- "-DANDROID",
- "-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
"-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
"-DCR_SYSROOT_KEY=20220331T153654Z-0",
@@ -6708,7 +6706,6 @@
"-DGOOGLE_PROTOBUF_NO_RTTI",
"-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
"-DHAVE_PTHREAD",
- "-DHAVE_SYS_UIO_H",
"-DLIBCXXABI_SILENT_TERMINATE",
"-DLIBCXX_BUILDING_LIBCXXABI",
"-DUSE_AURA=1",
@@ -6726,8 +6723,7 @@
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
- "-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS",
- "-D_LIBUNWIND_IS_NATIVE_ONLY",
+ "-UANDROID",
],
local_include_dirs: [
"./",
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index a03989c..65c1293 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -98,6 +98,7 @@
def __init__(self):
self.sources = set()
self.cflags = set()
+ self.defines = set()
def __init__(self, name, type):
@@ -181,7 +182,7 @@
'libs', 'proto_paths'):
self.__dict__[key].update(other.__dict__.get(key, []))
- for key_in_arch in ('cflags',):
+ for key_in_arch in ('cflags', 'defines'):
self.arch[arch].__dict__[key_in_arch].update(
other.arch[arch].__dict__.get(key_in_arch, []))
@@ -205,6 +206,10 @@
for arch_value in self.arch.values():
self.cflags = self.cflags.union(arch_value.cflags)
+ # TODO: Keep defines per arch
+ for arch_value in self.arch.values():
+ self.defines = self.defines.union(arch_value.defines)
+
def __init__(self):
self.all_targets = {}
@@ -329,7 +334,7 @@
target.arch[arch].cflags.update(desc.get('cflags', []) + desc.get('cflags_cc', []))
target.libs.update(desc.get('libs', []))
target.ldflags.update(desc.get('ldflags', []))
- target.defines.update(desc.get('defines', []))
+ target.arch[arch].defines.update(desc.get('defines', []))
target.include_dirs.update(desc.get('include_dirs', []))
# Recurse in dependencies.