Make proto_library() actions depend directly on their dep's actions
Instead of on their source_set() targets, which blocks the actions on compile steps that it doesn't need. This necessitates removing visibility from the generation action, and thus removing the need for "generator_visibility", which IMO provided negative value. Change-Id: I75abd295ee5a2943fcdd9c4a15d569c43056b872 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6505727 Commit-Queue: Andrew Grieve <agrieve@chromium.org> Owners-Override: Andrew Grieve <agrieve@chromium.org> Reviewed-by: Takuto Ikuta <tikuta@chromium.org> Cr-Commit-Position: refs/heads/main@{#1456968}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
bb99b54722
commit
01bb32f8ce
base
chrome/browser/ash/policy/tools
components
content/browser/resources/traces_internals
third_party
@ -391,7 +391,6 @@ proto_library("test_proto_descriptor") {
|
||||
generate_cc = false
|
||||
generate_python = false
|
||||
generate_descriptor = "test_proto.descriptor"
|
||||
generator_visibility = [ "//base:base_test_proto_bundle_data" ]
|
||||
}
|
||||
|
||||
config("base_test_implementation") {
|
||||
|
@ -15,10 +15,6 @@ proto_library("chrome_track_event") {
|
||||
generate_cc = false
|
||||
generate_python = false
|
||||
generate_descriptor = "chrome_track_event.descriptor"
|
||||
generator_visibility = [
|
||||
":chrome_track_event_resources_grit",
|
||||
"//base/test:gen_cc_chrome_track_event_descriptor",
|
||||
]
|
||||
deps =
|
||||
[ "//third_party/perfetto/protos/perfetto/trace/track_event:source_set" ]
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ action("device_policy_remover_generate") {
|
||||
rebase_path(chrome_device_policy_pb2_dir, root_build_dir),
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
deps = [
|
||||
"//components/policy/proto:proto_internal_gen",
|
||||
"//third_party/protobuf:py_proto",
|
||||
]
|
||||
@ -48,6 +48,6 @@ action("device_policy_remover_generate") {
|
||||
|
||||
static_library("device_policy_remover_generated") {
|
||||
sources = [ device_policy_remover_path ]
|
||||
|
||||
public_deps = [ ":device_policy_remover_generate" ]
|
||||
deps = [ ":device_policy_remover_generate" ]
|
||||
public_deps = [ "//components/policy/proto:proto_internal" ]
|
||||
}
|
||||
|
@ -107,6 +107,5 @@ proto_library("optimization_guide_proto_descriptors") {
|
||||
generate_cc = false
|
||||
generate_python = false
|
||||
generate_descriptor = "optimization_guide_proto.descriptor"
|
||||
generator_visibility = [ "//components/optimization_guide/core:on_device_model_execution_proto_generator" ]
|
||||
import_dirs = [ "//third_party/metrics_proto/" ]
|
||||
}
|
||||
|
@ -36,7 +36,10 @@ proto_library("policy_common_definitions_compile_proto") {
|
||||
}
|
||||
|
||||
proto_library("proto_internal") {
|
||||
visibility = [ ":proto" ]
|
||||
visibility = [
|
||||
":proto",
|
||||
"//chrome/browser/ash/policy/tools:*",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"device_management_backend.proto",
|
||||
@ -68,10 +71,6 @@ proto_library("proto_internal") {
|
||||
":policy_common_definitions_compile_proto",
|
||||
"//third_party/private_membership:private_membership_proto",
|
||||
]
|
||||
|
||||
generator_visibility =
|
||||
[ "//chrome/browser/ash/policy/tools:device_policy_remover_generate" ]
|
||||
|
||||
cc_generator_options = "dllexport_decl=POLICY_PROTO_EXPORT:"
|
||||
cc_include = "components/policy/proto/policy_proto_export.h"
|
||||
component_build_force_source_set = true
|
||||
|
@ -13,8 +13,6 @@ fuzzable_proto_library("record_constants") {
|
||||
generate_javascript = true
|
||||
|
||||
sources = [ "synced/record_constants.proto" ]
|
||||
|
||||
generator_visibility = [ "//chrome/browser/resources/chromeos/contact_center_insights:reporting_protos" ]
|
||||
}
|
||||
|
||||
# Record definitions for reporting.
|
||||
@ -26,8 +24,6 @@ fuzzable_proto_library("record_proto") {
|
||||
|
||||
sources = [ "synced/record.proto" ]
|
||||
|
||||
generator_visibility = [ "//chrome/browser/resources/chromeos/contact_center_insights:reporting_protos" ]
|
||||
|
||||
deps = [
|
||||
":health_proto",
|
||||
":record_constants",
|
||||
@ -57,8 +53,6 @@ fuzzable_proto_library("health_proto") {
|
||||
|
||||
sources = [ "synced/health.proto" ]
|
||||
|
||||
generator_visibility = [ "//chrome/browser/resources/chromeos/contact_center_insights:reporting_protos" ]
|
||||
|
||||
deps = [
|
||||
":record_constants",
|
||||
":status_proto",
|
||||
@ -72,8 +66,6 @@ proto_library("session_affiliated_user_proto") {
|
||||
generate_javascript = true
|
||||
|
||||
sources = [ "synced/session_affiliated_user.proto" ]
|
||||
|
||||
generator_visibility = [ "//chrome/browser/resources/chromeos/contact_center_insights:reporting_protos" ]
|
||||
}
|
||||
|
||||
proto_library("test_proto") {
|
||||
@ -90,8 +82,6 @@ proto_library("metric_data_proto") {
|
||||
|
||||
sources = [ "synced/metric_data.proto" ]
|
||||
|
||||
generator_visibility = [ "//chrome/browser/resources/chromeos/contact_center_insights:reporting_protos" ]
|
||||
|
||||
deps = [
|
||||
":session_affiliated_user_proto",
|
||||
"//components/services/app_service/public/protos",
|
||||
@ -105,8 +95,6 @@ fuzzable_proto_library("status_proto") {
|
||||
generate_javascript = true
|
||||
|
||||
sources = [ "synced/status.proto" ]
|
||||
|
||||
generator_visibility = [ "//chrome/browser/resources/chromeos/contact_center_insights:reporting_protos" ]
|
||||
}
|
||||
|
||||
fuzzable_proto_library("upload_tracker_proto") {
|
||||
|
@ -39,7 +39,6 @@ generate_grd("bufbuild_grdp") {
|
||||
}
|
||||
|
||||
proto_library("config_proto") {
|
||||
generator_visibility = [ ":copy_mojo" ]
|
||||
sources =
|
||||
[ "//third_party/perfetto/protos/perfetto/config/perfetto_config.proto" ]
|
||||
proto_in_dir = "//third_party/perfetto/"
|
||||
|
1
third_party/dom_distiller_js/BUILD.gn
vendored
1
third_party/dom_distiller_js/BUILD.gn
vendored
@ -78,7 +78,6 @@ proto_library("dom_distiller_proto") {
|
||||
# protoc_plugins by generating the json_converter.h file.
|
||||
proto_library("json_values_converter_test_proto") {
|
||||
visibility = [ ":*" ]
|
||||
generator_visibility = [ ":json_values_converter_tests" ]
|
||||
sources = [ "test_sample.proto" ]
|
||||
link_deps = [ "//base" ]
|
||||
proto_out_dir = "third_party/dom_distiller_js"
|
||||
|
@ -20,7 +20,8 @@ template("fuzzable_proto_library") {
|
||||
# use LPM on (i.e. libFuzzer not on Chrome OS).
|
||||
if (use_fuzzing_engine_with_lpm &&
|
||||
current_toolchain != "//build/toolchain/cros:target") {
|
||||
proto_library("proto_library_" + target_name) {
|
||||
_proto_target_name = "${target_name}__proto"
|
||||
proto_library(_proto_target_name) {
|
||||
forward_variables_from(invoker,
|
||||
"*",
|
||||
[
|
||||
@ -33,7 +34,7 @@ template("fuzzable_proto_library") {
|
||||
foreach(dep, invoker.deps) {
|
||||
dep_dir = get_label_info(dep, "dir")
|
||||
dep_name = get_label_info(dep, "name")
|
||||
deps += [ "${dep_dir}:proto_library_${dep_name}" ]
|
||||
deps += [ "${dep_dir}:${dep_name}__proto" ]
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,9 +47,12 @@ template("fuzzable_proto_library") {
|
||||
extra_configs = [ "//third_party/protobuf:protobuf_config" ]
|
||||
}
|
||||
|
||||
# This is to work with proto_library template in proto_library.gni.
|
||||
# These groups are required by proto_library template in proto_library.gni.
|
||||
group("${target_name}_input_group") {
|
||||
public_deps = [ ":proto_library_${target_name}" ]
|
||||
public_deps = [ ":${_proto_target_name}_input_group" ]
|
||||
}
|
||||
group("${target_name}_gen") {
|
||||
public_deps = [ ":${_proto_target_name}_gen" ]
|
||||
}
|
||||
|
||||
# Inspired by proto_library.gni's handling of
|
||||
@ -68,7 +72,7 @@ template("fuzzable_proto_library") {
|
||||
}
|
||||
sources = [ "//third_party/libprotobuf-mutator/dummy.cc" ]
|
||||
public_deps = [
|
||||
":proto_library_" + target_name,
|
||||
":$_proto_target_name",
|
||||
"//third_party/libprotobuf-mutator:protobuf_full",
|
||||
]
|
||||
}
|
||||
|
33
third_party/protobuf/proto_library.gni
vendored
33
third_party/protobuf/proto_library.gni
vendored
@ -91,10 +91,6 @@
|
||||
# absolute paths, such as for third_party or generated .proto files.
|
||||
# http://crbug.com/691451 tracks fixing this.
|
||||
#
|
||||
# generator_visiblility (optional)
|
||||
# This is added to visibility of code generation target so that other
|
||||
# targets can depend on them to have generated codes as their inputs.
|
||||
#
|
||||
# Parameters for compiling the generated code:
|
||||
#
|
||||
# force_source_set (Default=false)
|
||||
@ -446,24 +442,26 @@ template("proto_library") {
|
||||
# This is to propagate input deps for imported proto to ancestor targets.
|
||||
foreach(_dep, invoker.deps) {
|
||||
_dep = get_label_info(_dep, "label_no_toolchain")
|
||||
public_deps += [ "${_dep}_input_group" ]
|
||||
|
||||
# TODO(agrieve): Update perfetto to follow naming scheme.
|
||||
if (filter_exclude([ _dep ], [ "//third_party/perfetto/*" ]) == []) {
|
||||
# Protozero does not follow the naming scheme.
|
||||
public_deps += [
|
||||
"${_dep}_input_group",
|
||||
_dep,
|
||||
]
|
||||
} else {
|
||||
# Depend directly on the _gen targets so as to not unnecessarily block
|
||||
# on compile (by depending on source_set targets).
|
||||
public_deps += [ "${_dep}_gen" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Generate protobuf stubs.
|
||||
_action_name = "${target_name}_gen"
|
||||
_template_name = target_name
|
||||
action(_action_name) {
|
||||
visibility = [
|
||||
":$_template_name",
|
||||
":${_template_name}_js",
|
||||
":${_template_name}_py_runtime",
|
||||
":${_template_name}_ts",
|
||||
]
|
||||
if (defined(invoker.generator_visibility)) {
|
||||
visibility += invoker.generator_visibility
|
||||
}
|
||||
script = "//tools/protoc_wrapper/protoc_wrapper.py"
|
||||
sources = _sources
|
||||
inputs = [
|
||||
@ -498,11 +496,6 @@ template("proto_library") {
|
||||
|
||||
public_deps = [ ":$_input_group_name" ]
|
||||
|
||||
# |deps| must be other proto_library() targets.
|
||||
if (defined(invoker.deps)) {
|
||||
public_deps += invoker.deps
|
||||
}
|
||||
|
||||
args = _relative_sources + [
|
||||
# Wrapper should never pick a system protoc.
|
||||
# Path should be rebased because |root_build_dir| for current toolchain
|
||||
|
Reference in New Issue
Block a user