Merge changes I08043bfc,I765a85da,Icdc8e5ed
* changes:
gn2bp: support building against Android's modp_b64
gn2bp: support building against Android's libbrotli
gn2bp: properly support builtin modules
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 884a48c..cf8f1dd 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -97,6 +97,7 @@
]
android_include_dirs_denylist = [
+ 'third_party/brotli/include/',
'third_party/zlib/',
]
@@ -144,6 +145,24 @@
],
}
+def enable_brotli(module, arch):
+ # Requires crrev/c/4111690
+ if arch is None:
+ module.static_libs.add('libbrotli')
+ else:
+ module.arch[arch].static_libs.add('libbrotli')
+
+def enable_modp_b64(module, arch):
+ # Requires crrev/c/4112845
+ # Requires aosp/2359455
+ # Requires aosp/2359456
+ if not module.is_compiled():
+ return
+ if arch is None:
+ module.static_libs.add('libmodpb64')
+ else:
+ module.arch[arch].static_libs.add('libmodpb64')
+
def enable_zlib(module, arch):
# Requires crrev/c/4109079
if arch is None:
@@ -161,6 +180,12 @@
}
android_deps = {
+ '//third_party/brotli:common':
+ enable_brotli,
+ '//third_party/brotli:dec':
+ enable_brotli,
+ '//third_party/modp_b64:modp_b64':
+ enable_modp_b64,
'//third_party/zlib:zlib':
enable_zlib,
}
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 349723e..919b3e3 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -325,9 +325,8 @@
return target # Target already processed.
if target.name in self.builtin_deps:
- # return early, no need to dive into the modules deps as the module is a
- # builtin.
- return None
+ # return early, no need to parse any further as the module is a builtin.
+ return target
target.testonly = desc.get('testonly', False)
@@ -393,9 +392,7 @@
# Recurse in dependencies.
for gn_dep_name in desc.get('deps', []):
dep = self.parse_gn_desc(gn_desc, gn_dep_name, is_java_target)
- if dep is None:
- continue
- elif dep.type == 'proto_library':
+ if dep.type == 'proto_library':
target.proto_deps.add(dep.name)
target.transitive_proto_deps.add(dep.name)
target.proto_paths.update(dep.proto_paths)