diff --git a/base/test/BUILD.gn b/base/test/BUILD.gn index e7f8b523e899a..5c286d8d8f664 100644 --- a/base/test/BUILD.gn +++ b/base/test/BUILD.gn @@ -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") { diff --git a/base/tracing/protos/BUILD.gn b/base/tracing/protos/BUILD.gn index abee3b65f4456..1d16de6cbe573 100644 --- a/base/tracing/protos/BUILD.gn +++ b/base/tracing/protos/BUILD.gn @@ -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" ] } diff --git a/chrome/browser/ash/policy/tools/BUILD.gn b/chrome/browser/ash/policy/tools/BUILD.gn index 8c3fbf8680277..620d4719e20a6 100644 --- a/chrome/browser/ash/policy/tools/BUILD.gn +++ b/chrome/browser/ash/policy/tools/BUILD.gn @@ -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" ] } diff --git a/components/optimization_guide/proto/BUILD.gn b/components/optimization_guide/proto/BUILD.gn index 3779ebcd63833..b94f651d402b7 100644 --- a/components/optimization_guide/proto/BUILD.gn +++ b/components/optimization_guide/proto/BUILD.gn @@ -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/" ] } diff --git a/components/policy/proto/BUILD.gn b/components/policy/proto/BUILD.gn index 2c5d40fa0507a..493fe115452b9 100644 --- a/components/policy/proto/BUILD.gn +++ b/components/policy/proto/BUILD.gn @@ -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 diff --git a/components/reporting/proto/BUILD.gn b/components/reporting/proto/BUILD.gn index aa9eab6f615ee..c8325d638248b 100644 --- a/components/reporting/proto/BUILD.gn +++ b/components/reporting/proto/BUILD.gn @@ -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") { diff --git a/content/browser/resources/traces_internals/BUILD.gn b/content/browser/resources/traces_internals/BUILD.gn index ab40178812361..6e21692818e7a 100644 --- a/content/browser/resources/traces_internals/BUILD.gn +++ b/content/browser/resources/traces_internals/BUILD.gn @@ -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/" diff --git a/third_party/dom_distiller_js/BUILD.gn b/third_party/dom_distiller_js/BUILD.gn index 0132a30c17acc..715dba4980a72 100644 --- a/third_party/dom_distiller_js/BUILD.gn +++ b/third_party/dom_distiller_js/BUILD.gn @@ -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" diff --git a/third_party/libprotobuf-mutator/fuzzable_proto_library.gni b/third_party/libprotobuf-mutator/fuzzable_proto_library.gni index 8d420d11c48b4..3508b9661b22b 100644 --- a/third_party/libprotobuf-mutator/fuzzable_proto_library.gni +++ b/third_party/libprotobuf-mutator/fuzzable_proto_library.gni @@ -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", ] } diff --git a/third_party/protobuf/proto_library.gni b/third_party/protobuf/proto_library.gni index 1df227fe0cd97..f81d4580f1f1c 100644 --- a/third_party/protobuf/proto_library.gni +++ b/third_party/protobuf/proto_library.gni @@ -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