gn2bp: fix collecting static libs dependencies
There were some flaws in the previous logic. Dependencies need to be
bubbled up for all targets, but only static_libs should be added to
them.
Test: update_results.sh
Change-Id: I98025a8a0720d34bc47a820bf45118c06acd64a0
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 1399fcf..118208c 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -304,9 +304,12 @@
if dep.type == 'static_library':
# Bubble up static_libs. Necessary, since soong does not propagate
# static_libs up the build tree.
- target.transitive_static_libs_deps.add(dep_name)
- target.transitive_static_libs_deps.update(dep.transitive_static_libs_deps)
- target.deps.update(target.transitive_static_libs_deps)
+ # Protobuf dependencies are handled separately.
+ if '//third_party/protobuf' not in dep_name:
+ target.transitive_static_libs_deps.add(dep_name)
+
+ target.transitive_static_libs_deps.update(dep.transitive_static_libs_deps)
+ target.deps.update(target.transitive_static_libs_deps)
# Collect java sources. Java sources are kept inside the __compile_java target.
# This target can be used for both host and target compilation; only add