gn2bp: Remove empty srcs cc_object from blueprint
* This was failing the pre-submits are cc_objects are compilable modules but they failed to compile due to empty srcs. However, this didn't affect the compilation of Cronet as the empty cc_objects are never in the path of compilation of Cronet because their attributes are propagated up the tree.
Test: m
Change-Id: I7cc87d53d4f460ef4958d5ecfb23ac28662fdbdc
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 8a3c38b..c750c2a 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -531,7 +531,12 @@
def to_string(self, output):
for m in sorted(self.modules.values(), key=lambda m: m.name):
- m.to_string(output)
+ if m.type != "cc_object" or m.has_input_files():
+ # Don't print cc_object with empty srcs. These attributes are already
+ # propagated up the tree. Printing them messes the presubmits because
+ # every module is compiled while those targets are not reachable in
+ # a normal compilation path.
+ m.to_string(output)
def label_to_module_name(label):