perfetto: improve bazel BUILD file generation with protos
This CL removes our legacy behaviour of automatically creating
source_set targets for proto libraries without the associated source_set
targets being present in GN. Instead, we now require that the target
exist.
There are also a few other improvements:
* fix naming of a few scattered classes to match the general pattern
* don't generate lite targets when not necessary; this removes a bunch
of private lite targets which aren't used by anyone
* the same source_set target is not generated multiple times anymore
meaning that we can get rid of the deduplication hack which preserved
public visibility for proto targets
Change-Id: I0b39dbacc3a422479ad1a2d7e5f62089f8f54578
diff --git a/tools/gn_utils.py b/tools/gn_utils.py
index 2a0f8c6..3af0776 100644
--- a/tools/gn_utils.py
+++ b/tools/gn_utils.py
@@ -395,7 +395,7 @@
target.is_third_party_dep_ = True
return target
- proto_target_type, proto_desc = self.get_proto_target_type_(target)
+ proto_target_type, proto_desc = self.get_proto_target_type(target)
if proto_target_type is not None:
self.proto_libs[target.name] = target
target.type = 'proto_library'
@@ -444,7 +444,7 @@
target.proto_paths.update(dep.proto_paths)
# Don't bubble deps for action targets
- if target.type != 'action':
+ if target.type != 'action' and proto_target_type != 'descriptor':
target.proto_deps.update(dep.proto_deps) # Bubble up deps.
elif dep.type == 'source_set':
target.source_set_deps.add(dep_name)
@@ -476,7 +476,7 @@
proto_paths.append(re.sub('^../../', '//', args[i + 1]))
return proto_paths
- def get_proto_target_type_(self, target):
+ def get_proto_target_type(self, target):
""" Checks if the target is a proto library and return the plugin.
Returns: