gn2bp: propagate static libs up the tree

Soong explicitly requires to list all static libraries, including static
libraries that are linked by a dependency.

What is interesting is that this change seemed to have introduced new
targets?! Will have to check if that's correct, but at first glance it
seems to make sense.

Test: //components/cronet/android:cronet
Change-Id: I0e6e9a760dd0a4ebc5ce50f5dabc02458ff488a8
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index e90b500..1399fcf 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -135,6 +135,7 @@
       self.source_set_deps = set()  # Transitive set of source_set deps.
       self.proto_deps = set()
       self.transitive_proto_deps = set()
+      self.transitive_static_libs_deps = set()
 
       # Deps on //gn:xxx have this flag set to True. These dependencies
       # are special because they pull third_party code from buildtools/.
@@ -300,6 +301,13 @@
         # java_library.
         pass
 
+      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)
+
       # 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
       # the sources if they are destined for the target (i.e. they are a