Fix visibility on "internal to any protobuf usage outside of this directory" for rust_library targets in OSS

PiperOrigin-RevId: 676060420
pull/18383/head
Protobuf Team Bot 2 months ago committed by Copybara-Service
parent c29dfb5e2d
commit 4671dce58a
  1. 39
      rust/BUILD
  2. 2
      rust/test/cpp/BUILD

@ -6,15 +6,16 @@ load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
package(
default_visibility = [
"//:__pkg__", # "public" targets are alias rules in //.
"//src/google/protobuf:__subpackages__",
licenses(["notice"])
package_group(
name = "protobuf_internal",
packages = [
"//rust/...",
"//src/google/protobuf/...",
],
)
licenses(["notice"])
# The current Rust Protobuf runtime for the build. Depending on the value of
# `:rust_proto_library_kernel` build setting it forwards to the cpp or upb kernels. This is the
# target that users are expected to depend on.
@ -83,10 +84,7 @@ rust_library(
"--cfg=upb_kernel",
"--cfg=bzl",
],
visibility = [
"//rust:__subpackages__",
"//src/google/protobuf:__subpackages__",
],
visibility = [":protobuf_internal"],
deps = [
":utf8",
"//rust/upb",
@ -112,9 +110,7 @@ rust_library(
testonly = True,
srcs = ["protobuf.rs"],
rustc_flags = ["--cfg=upb_kernel"],
visibility = [
"//src/google/protobuf:__subpackages__",
],
visibility = [":protobuf_internal"],
deps = [":protobuf_upb"],
)
@ -134,6 +130,7 @@ rust_library(
"--cfg=cpp_kernel",
"--cfg=bzl",
],
visibility = [":protobuf_internal"],
deps = [
":utf8",
"//rust/cpp_kernel:cpp_api",
@ -159,9 +156,7 @@ rust_library(
testonly = True,
srcs = ["protobuf.rs"],
rustc_flags = ["--cfg=cpp_kernel"],
visibility = [
"//src/google/protobuf:__subpackages__",
],
visibility = [":protobuf_internal"],
deps = [":protobuf_cpp"],
)
@ -172,6 +167,7 @@ alias(
"//conditions:default": ":protobuf_gtest_matchers_cpp",
}),
visibility = [
"//visibility:public",
],
)
@ -182,10 +178,7 @@ rust_library(
aliases = {
"//rust:protobuf_cpp": "protobuf",
},
visibility = [
"//rust:__subpackages__",
"//src/google/protobuf:__subpackages__",
],
visibility = [":protobuf_internal"],
deps = [
":protobuf_cpp",
"@crate_index//:googletest",
@ -199,10 +192,7 @@ rust_library(
aliases = {
"//rust:protobuf_upb": "protobuf",
},
visibility = [
"//rust:__subpackages__",
"//src/google/protobuf:__subpackages__",
],
visibility = [":protobuf_internal"],
deps = [
":protobuf_upb",
"@crate_index//:googletest",
@ -212,7 +202,6 @@ rust_library(
rust_library(
name = "utf8",
srcs = ["utf8.rs"],
visibility = ["//visibility:private"],
)
proto_lang_toolchain(

@ -50,7 +50,7 @@ rust_test(
deps = [
":debug_cpp_rust_proto",
":optimize_for_lite_cpp_rust_proto",
"//rust:protobuf_cpp",
"//rust:protobuf_cpp_export",
"@crate_index//:googletest",
],
)

Loading…
Cancel
Save