gn2bp: remove local protobuf include dir
Test: //net:net
Change-Id: I514e72cc406f3a0c635df09068c47010ba193b1d
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 539817b..1e56d32 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -113,7 +113,15 @@
module.whole_static_libs.add('perfetto_gtest_logcat_printer')
+def remove_local_protobuf_include(module):
+ # remove all third_party/protobuf includes as they conflict with libprotobuf
+ # in Android.
+ module.local_include_dirs = [it for it in module.local_include_dirs
+ if not it.startswith('third_party/protobuf')]
+
+
def enable_protobuf_full(module):
+ remove_local_protobuf_include(module)
if module.type == 'cc_binary_host':
module.static_libs.add('libprotobuf-cpp-full')
elif module.host_supported:
@@ -124,11 +132,13 @@
def enable_protobuf_lite(module):
+ remove_local_protobuf_include(module)
if module.type not in ['genrule', 'filegroup']:
module.shared_libs.add('libprotobuf-cpp-lite')
def enable_protoc_lib(module):
+ remove_local_protobuf_include(module)
if module.type == 'cc_binary_host':
module.static_libs.add('libprotoc')
else: