Skip to content

Commit e1d9216

Browse files
authored
impl(v3): bazel non-public visibility for testing libs (#15929)
1 parent 46847d2 commit e1d9216

8 files changed

Lines changed: 44 additions & 57 deletions

File tree

ci/cloudbuild/builds/bazel-targets.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ source module ci/cloudbuild/builds/lib/bazel.sh
2121
source module ci/cloudbuild/builds/lib/cloudcxxrc.sh
2222

2323
mapfile -t args < <(bazel::common_args)
24-
for repo_root in "ci/verify_current_targets" "ci/verify_deprecated_targets"; do
25-
io::log_h2 "Verifying Bazel targets in repo root: ${repo_root}"
26-
env -C "${repo_root}" bazel test "${args[@]}" ...
27-
done
24+
repo_root="ci/verify_current_targets"
25+
io::log_h2 "Verifying Bazel targets in repo root: ${repo_root}"
26+
env -C "${repo_root}" bazel test "${args[@]}" ...

ci/verify_deprecated_targets/BUILD.bazel

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,12 @@ package(default_visibility = ["//visibility:private"])
1616

1717
licenses(["notice"]) # Apache 2.0
1818

19-
# TODO(#5726) - DO NOT CHANGE THESE TARGET NAMES These package names are
20-
# expected to remain usable until we have retired them. They are *deprecated*
21-
# (that is, we no longer recommend their use), but *NOT* retired (that is, they
22-
# remain available). This is a test for backwards compatibility. If you need to
23-
# change the test, there is good chance you are breaking something.
19+
# These package names are expected to remain usable until we have retired them.
20+
# They are *deprecated* (that is, we no longer recommend their use), but *NOT*
21+
# decommissioned (that is, they remain available). This is a test for backwards
22+
# compatibility. If you need to change the test, there is good chance you are
23+
# breaking something.
2424
DEPRECATED_TARGETS = [
25-
"google/cloud/pubsub:pubsub_client_testing",
26-
"google/cloud/spanner:spanner_client_testing",
27-
"google/cloud/testing_util:google_cloud_cpp_testing",
28-
"google/cloud/testing_util:google_cloud_cpp_testing_grpc",
29-
"google/cloud/testing_util:google_cloud_cpp_testing_rest",
30-
"google/cloud:google_cloud_cpp_common",
31-
"google/cloud:google_cloud_cpp_grpc_utils",
3225
]
3326

3427
[cc_test(

google/cloud/BUILD.bazel

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,11 @@ cc_library(
9191

9292
cc_library(
9393
name = "google_cloud_cpp_common",
94-
deprecation = """
95-
This target is deprecated and will be removed on or after 2023-04-01. Use
96-
//:common instead. More info:
97-
https://github.com/googleapis/google-cloud-cpp/issues/3701
98-
""",
9994
tags = ["manual"],
100-
visibility = ["//visibility:public"],
95+
visibility = [
96+
":__subpackages__",
97+
"//:__pkg__",
98+
],
10199
deps = [":google_cloud_cpp_common_private"],
102100
)
103101

@@ -162,13 +160,11 @@ cc_library(
162160

163161
cc_library(
164162
name = "google_cloud_cpp_grpc_utils",
165-
deprecation = """
166-
This target is deprecated and will be removed on or after 2023-04-01. Use
167-
//:grpc_utils instead. More info:
168-
https://github.com/googleapis/google-cloud-cpp/issues/3701
169-
""",
170163
tags = ["manual"],
171-
visibility = ["//visibility:public"],
164+
visibility = [
165+
":__subpackages__",
166+
"//:__pkg__",
167+
],
172168
deps = [":google_cloud_cpp_grpc_utils_private"],
173169
)
174170

google/cloud/bigtable/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ cc_library(
100100
testonly = True,
101101
srcs = bigtable_client_testing_srcs,
102102
hdrs = bigtable_client_testing_hdrs,
103-
visibility = ["//visibility:public"],
103+
visibility = [
104+
":__subpackages__",
105+
"//:__pkg__",
106+
],
104107
deps = [
105108
":google_cloud_cpp_bigtable",
106109
":google_cloud_cpp_bigtable_mocks",

google/cloud/pubsub/BUILD.bazel

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,14 @@ cc_library(
6060
],
6161
)
6262

63-
# TODO(#3701): Delete this target after 2023-04-01.
6463
cc_library(
6564
name = "pubsub_client_testing",
6665
testonly = True,
67-
deprecation = """
68-
This target is deprecated and will be removed on or after 2023-04-01. More
69-
info: https://github.com/googleapis/google-cloud-cpp/issues/3701
70-
""",
7166
tags = ["manual"],
72-
visibility = ["//visibility:public"],
67+
visibility = [
68+
":__subpackages__",
69+
"//:__pkg__",
70+
],
7371
deps = [":pubsub_client_testing_private"],
7472
)
7573

google/cloud/spanner/BUILD.bazel

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,14 @@ cc_library(
110110
],
111111
)
112112

113-
# TODO(#3701): Delete this target after 2023-04-01.
114113
cc_library(
115114
name = "spanner_client_testing",
116115
testonly = True,
117-
deprecation = """
118-
This target is deprecated and will be removed on or after 2023-04-01. More
119-
info: https://github.com/googleapis/google-cloud-cpp/issues/3701
120-
""",
121116
tags = ["manual"],
122-
visibility = ["//visibility:public"],
117+
visibility = [
118+
":__subpackages__",
119+
"//:__pkg__",
120+
],
123121
deps = [":spanner_client_testing_private"],
124122
)
125123

google/cloud/storage/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ cc_library(
185185
testonly = True,
186186
srcs = storage_client_testing_srcs,
187187
hdrs = storage_client_testing_hdrs,
188-
visibility = ["//visibility:public"],
188+
visibility = [
189+
":__subpackages__",
190+
"//:__pkg__",
191+
],
189192
deps = [
190193
":google_cloud_cpp_storage",
191194
":google_cloud_cpp_storage_grpc",

google/cloud/testing_util/BUILD.bazel

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@ cc_library(
5252
cc_library(
5353
name = "google_cloud_cpp_testing",
5454
testonly = True,
55-
deprecation = """
56-
This target is deprecated and will be removed on or after 2023-04-01. More
57-
info: https://github.com/googleapis/google-cloud-cpp/issues/3701
58-
""",
5955
tags = ["manual"],
60-
visibility = ["//visibility:public"],
56+
visibility = [
57+
":__subpackages__",
58+
"//:__pkg__",
59+
],
6160
deps = [":google_cloud_cpp_testing_private"],
6261
)
6362

@@ -91,12 +90,11 @@ cc_library(
9190
cc_library(
9291
name = "google_cloud_cpp_testing_grpc",
9392
testonly = True,
94-
deprecation = """
95-
This target is deprecated and will be removed on or after 2023-04-01. More
96-
info: https://github.com/googleapis/google-cloud-cpp/issues/3701
97-
""",
9893
tags = ["manual"],
99-
visibility = ["//visibility:public"],
94+
visibility = [
95+
":__subpackages__",
96+
"//:__pkg__",
97+
],
10098
deps = [":google_cloud_cpp_testing_grpc_private"],
10199
)
102100

@@ -125,11 +123,10 @@ cc_library(
125123
cc_library(
126124
name = "google_cloud_cpp_testing_rest",
127125
testonly = True,
128-
deprecation = """
129-
This target is deprecated and will be removed on or after 2023-04-01. More
130-
info: https://github.com/googleapis/google-cloud-cpp/issues/3701
131-
""",
132126
tags = ["manual"],
133-
visibility = ["//visibility:public"],
127+
visibility = [
128+
":__subpackages__",
129+
"//:__pkg__",
130+
],
134131
deps = [":google_cloud_cpp_testing_rest_private"],
135132
)

0 commit comments

Comments
 (0)