Locked down visibility of rules used from aspects. This is possible to do now because Bazel 6.5+ support proper aspect visibility. PiperOrigin-RevId: 739013200
diff --git a/hpb/bazel/hpb_proto_library.bzl b/hpb/bazel/hpb_proto_library.bzl index e05d590..1317a39 100644 --- a/hpb/bazel/hpb_proto_library.bzl +++ b/hpb/bazel/hpb_proto_library.bzl
@@ -149,7 +149,7 @@ "_upbprotos": attr.label_list( default = [ # TODO: Add dependencies for cc runtime (absl/string etc..) - "//upb:generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + "//upb:generated_cpp_support", "//hpb:generated_hpb_support", "@abseil-cpp//absl/log:absl_check", "@abseil-cpp//absl/strings",
diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index 836c87c..1edc40d 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel
@@ -241,7 +241,7 @@ name = "upb", tags = ["manual"], deps = [ - "//upb:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + "//upb:generated_code_support", "//upb/json", "//upb/message:compare", "//upb/message:copy",
diff --git a/upb/BUILD b/upb/BUILD index d202846..62edcc9 100644 --- a/upb/BUILD +++ b/upb/BUILD
@@ -70,13 +70,17 @@ # upb_c_proto_library() only. This interface is not stable and by using it you # give up any backward compatibility guarantees. cc_library( - name = "generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + name = "generated_code_support", hdrs = ["generated_code_support.h"], copts = UPB_DEFAULT_COPTS, textual_hdrs = [ ":port_inc", ], - visibility = ["//visibility:public"], + visibility = [ + "//pkg:__pkg__", + "//upb/reflection:__pkg__", + "//upb_generator:__subpackages__", + ], deps = [ ":base", ":mem", @@ -90,12 +94,12 @@ # Common support code for C++ generated code. cc_library( - name = "generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + name = "generated_cpp_support", copts = UPB_DEFAULT_COPTS, textual_hdrs = [ ":port_inc", ], - visibility = ["//visibility:public"], + visibility = ["//hpb/bazel:__pkg__"], ) # Aliases ###################################################################### @@ -108,9 +112,9 @@ ) alias( - name = "generated_reflection_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", - actual = "//upb/reflection:generated_reflection_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", - visibility = ["//visibility:public"], + name = "generated_reflection_support", + actual = "//upb/reflection:generated_reflection_support", + visibility = ["//upb:friends"], ) alias( @@ -232,7 +236,7 @@ libs = [ ":base", ":eps_copy_input_stream", - ":generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + ":generated_code_support", ":mem", ":message", ":message_compare", @@ -281,7 +285,7 @@ libs = [ ":base", ":eps_copy_input_stream", - ":generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + ":generated_code_support", ":json", ":mem", ":message", @@ -331,7 +335,7 @@ libs = [ ":base", ":eps_copy_input_stream", - ":generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + ":generated_code_support", ":json", ":mem", ":message",
diff --git a/upb/reflection/BUILD b/upb/reflection/BUILD index 83407da..c3552ca 100644 --- a/upb/reflection/BUILD +++ b/upb/reflection/BUILD
@@ -146,7 +146,7 @@ ) cc_library( - name = "generated_reflection_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + name = "generated_reflection_support", hdrs = [ "def.h", "internal/def_pool.h", @@ -155,7 +155,7 @@ textual_hdrs = [ "//upb:port_inc", ], - visibility = ["//visibility:public"], + visibility = ["//upb:__pkg__"], deps = [ ":internal", "//upb:mem",
diff --git a/upb_generator/bootstrap_compiler.bzl b/upb_generator/bootstrap_compiler.bzl index c9558b2..9ede79f 100644 --- a/upb_generator/bootstrap_compiler.bzl +++ b/upb_generator/bootstrap_compiler.bzl
@@ -217,7 +217,7 @@ visibility = _bootstrap_visibility, defines = ["UPB_BOOTSTRAP_STAGE=0"], deps = [ - "//upb:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + "//upb:generated_code_support", "//upb:mini_table", ] + [dep + "_stage0" for dep in deps], **kwargs @@ -234,7 +234,7 @@ visibility = _bootstrap_visibility, defines = ["UPB_BOOTSTRAP_STAGE=1"], deps = [ - "//upb:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + "//upb:generated_code_support", ] + [dep + "_minitable_stage1" for dep in deps], **kwargs ) @@ -245,7 +245,7 @@ visibility = _bootstrap_visibility, defines = ["UPB_BOOTSTRAP_STAGE=1"], deps = [ - "//upb:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + "//upb:generated_code_support", ":" + name + "_minitable_stage1", ] + [dep + "_minitable_stage1" for dep in deps], **kwargs
diff --git a/upb_generator/c/BUILD b/upb_generator/c/BUILD index a84cba8..52a01b6 100644 --- a/upb_generator/c/BUILD +++ b/upb_generator/c/BUILD
@@ -83,7 +83,7 @@ plugin = ":protoc-gen-upb_stage1", plugin_format_flag = "--plugin=protoc-gen-upb=%s", progress_message = "Generating upb protos", - runtime = "//upb:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + runtime = "//upb:generated_code_support", # TODO: Restrict to "//bazel:__pkg__" once we are on Bazel >=6.5. visibility = ["//visibility:public"], )
diff --git a/upb_generator/minitable/BUILD b/upb_generator/minitable/BUILD index 78f6008..9ebd68b 100644 --- a/upb_generator/minitable/BUILD +++ b/upb_generator/minitable/BUILD
@@ -132,7 +132,7 @@ plugin = ":protoc-gen-upb_minitable_stage1", plugin_format_flag = "--plugin=protoc-gen-upb_minitable=%s", progress_message = "Generating upb minitables", - runtime = "//upb:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + runtime = "//upb:generated_code_support", # TODO: Restrict to "//bazel:__pkg__" once we are on Bazel >=6.5. visibility = ["//visibility:public"], )
diff --git a/upb_generator/reflection/BUILD b/upb_generator/reflection/BUILD index e763176..9a08d44 100644 --- a/upb_generator/reflection/BUILD +++ b/upb_generator/reflection/BUILD
@@ -72,7 +72,7 @@ plugin = ":protoc-gen-upbdefs", plugin_format_flag = "--plugin=protoc-gen-upbdefs=%s", progress_message = "Generating upb protos", - runtime = "//upb:generated_reflection_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", + runtime = "//upb:generated_reflection_support", # TODO: Restrict to "//bazel:__pkg__" once we are on Bazel >=6.5. visibility = ["//visibility:public"], )