Skip to content

Commit 0064991

Browse files
authoredMar 28, 2024··
bazel: Use the artifact macro for loading maven deps
The recommended way to load dependencies from `rules_jvm_external` is to make use of the `@maven` workspace, and the most readable way of doing that is to use the `artifact` macro provides. This removes the need to generate the "compat" namespaces, which `rules_jvm_external` provided for backwards compatibility with older releases. This change also sets things up for supporting `bzlmod`: this requires all workspaces accessed by a library to be named "up front" in the `MODULE.bazel` file. This way, the only repo that needs to be exported is `@maven`, rather than the current huge list.
1 parent 4ef1bad commit 0064991

File tree

22 files changed

+169
-139
lines changed

22 files changed

+169
-139
lines changed
 

‎BUILD.bazel

+8-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
load("@rules_jvm_external//:defs.bzl", "artifact")
1516
load(":java_grpc_library.bzl", "java_grpc_library")
1617

1718
java_proto_library(
@@ -33,9 +34,9 @@ java_library(
3334
"//protobuf",
3435
"//stub",
3536
"//stub:javax_annotation",
36-
"@com_google_code_findbugs_jsr305//jar",
37-
"@com_google_guava_guava//jar",
3837
"@com_google_protobuf//:protobuf_java",
38+
artifact("com.google.code.findbugs:jsr305"),
39+
artifact("com.google.guava:guava"),
3940
],
4041
)
4142

@@ -47,16 +48,16 @@ java_library(
4748
"//protobuf-lite",
4849
"//stub",
4950
"//stub:javax_annotation",
50-
"@com_google_code_findbugs_jsr305//jar",
51-
"@com_google_guava_guava//jar",
51+
artifact("com.google.code.findbugs:jsr305"),
52+
artifact("com.google.guava:guava"),
5253
],
5354
)
5455

5556
java_plugin(
5657
name = "auto_value",
5758
generates_api = 1,
5859
processor_class = "com.google.auto.value.processor.AutoValueProcessor",
59-
deps = ["@com_google_auto_value_auto_value//jar"],
60+
deps = [artifact("com.google.auto.value:auto-value")],
6061
)
6162

6263
java_library(
@@ -65,7 +66,7 @@ java_library(
6566
neverlink = 1,
6667
visibility = ["//:__subpackages__"],
6768
exports = [
68-
"@com_google_auto_value_auto_value_annotations//jar",
69-
"@org_apache_tomcat_annotations_api//jar", # @Generated for Java 9+
69+
artifact("com.google.auto.value:auto-value-annotations"),
70+
artifact("org.apache.tomcat:annotations-api"), # @Generated for Java 9+
7071
],
7172
)

‎WORKSPACE

-5
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,9 @@ switched_rules_by_language(
3434

3535
maven_install(
3636
artifacts = IO_GRPC_GRPC_JAVA_ARTIFACTS + PROTOBUF_MAVEN_ARTIFACTS,
37-
generate_compat_repositories = True,
3837
override_targets = IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS,
3938
repositories = [
4039
"https://repo.maven.apache.org/maven2/",
4140
],
4241
strict_visibility = True,
4342
)
44-
45-
load("@maven//:compat.bzl", "compat_repositories")
46-
47-
compat_repositories()

‎alts/BUILD.bazel

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
12
load("@rules_proto//proto:defs.bzl", "proto_library")
23
load("//:java_grpc_library.bzl", "java_grpc_library")
34

@@ -14,16 +15,16 @@ java_library(
1415
"//grpclb",
1516
"//netty",
1617
"//stub",
17-
"@com_google_code_findbugs_jsr305//jar",
18-
"@com_google_guava_guava//jar",
19-
"@com_google_j2objc_j2objc_annotations//jar",
2018
"@com_google_protobuf//:protobuf_java",
2119
"@com_google_protobuf//:protobuf_java_util",
22-
"@io_netty_netty_buffer//jar",
23-
"@io_netty_netty_codec//jar",
24-
"@io_netty_netty_common//jar",
25-
"@io_netty_netty_handler//jar",
26-
"@io_netty_netty_transport//jar",
20+
artifact("com.google.code.findbugs:jsr305"),
21+
artifact("com.google.guava:guava"),
22+
artifact("com.google.j2objc:j2objc-annotations"),
23+
artifact("io.netty:netty-buffer"),
24+
artifact("io.netty:netty-codec"),
25+
artifact("io.netty:netty-common"),
26+
artifact("io.netty:netty-handler"),
27+
artifact("io.netty:netty-transport"),
2728
],
2829
)
2930

@@ -41,13 +42,13 @@ java_library(
4142
"//auth",
4243
"//core:internal",
4344
"//netty",
44-
"@com_google_auth_google_auth_library_oauth2_http//jar",
45-
"@com_google_code_findbugs_jsr305//jar",
46-
"@com_google_guava_guava//jar",
47-
"@com_google_j2objc_j2objc_annotations//jar",
48-
"@io_netty_netty_common//jar",
49-
"@io_netty_netty_handler//jar",
50-
"@io_netty_netty_transport//jar",
45+
artifact("com.google.auth:google-auth-library-oauth2-http"),
46+
artifact("com.google.code.findbugs:jsr305"),
47+
artifact("com.google.guava:guava"),
48+
artifact("com.google.j2objc:j2objc-annotations"),
49+
artifact("io.netty:netty-common"),
50+
artifact("io.netty:netty-handler"),
51+
artifact("io.netty:netty-transport"),
5152
],
5253
)
5354

‎api/BUILD.bazel

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "api",
35
srcs = glob([
@@ -7,10 +9,10 @@ java_library(
79
javacopts = ["-Xep:DoNotCall:OFF"], # Remove once requiring Bazel 3.4.0+; allows non-final
810
visibility = ["//visibility:public"],
911
deps = [
10-
"@com_google_code_findbugs_jsr305//jar",
11-
"@com_google_errorprone_error_prone_annotations//jar",
12-
"@com_google_guava_failureaccess//jar", # future transitive dep of Guava. See #5214
13-
"@com_google_guava_guava//jar",
14-
"@com_google_j2objc_j2objc_annotations//jar",
12+
artifact("com.google.code.findbugs:jsr305"),
13+
artifact("com.google.errorprone:error_prone_annotations"),
14+
artifact("com.google.guava:failureaccess"), # future transitive dep of Guava. See #5214
15+
artifact("com.google.guava:guava"),
16+
artifact("com.google.j2objc:j2objc-annotations"),
1517
],
1618
)

‎auth/BUILD.bazel

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "auth",
35
srcs = glob([
@@ -6,9 +8,9 @@ java_library(
68
visibility = ["//visibility:public"],
79
deps = [
810
"//api",
9-
"@com_google_auth_google_auth_library_credentials//jar",
10-
"@com_google_code_findbugs_jsr305//jar",
11-
"@com_google_guava_guava//jar",
12-
"@com_google_j2objc_j2objc_annotations//jar",
11+
artifact("com.google.auth:google-auth-library-credentials"),
12+
artifact("com.google.code.findbugs:jsr305"),
13+
artifact("com.google.guava:guava"),
14+
artifact("com.google.j2objc:j2objc-annotations"),
1315
],
1416
)

‎census/BUILD.bazel

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "census",
35
srcs = glob([
@@ -7,9 +9,9 @@ java_library(
79
deps = [
810
"//api",
911
"//context",
10-
"@com_google_code_findbugs_jsr305//jar",
11-
"@com_google_guava_guava//jar",
12-
"@io_opencensus_opencensus_api//jar",
13-
"@io_opencensus_opencensus_contrib_grpc_metrics//jar",
12+
artifact("com.google.code.findbugs:jsr305"),
13+
artifact("com.google.guava:guava"),
14+
artifact("io.opencensus:opencensus-api"),
15+
artifact("io.opencensus:opencensus-contrib-grpc-metrics"),
1416
],
1517
)

‎compiler/BUILD.bazel

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@rules_cc//cc:defs.bzl", "cc_binary")
2+
load("@rules_jvm_external//:defs.bzl", "artifact")
23
load("//:java_grpc_library.bzl", "java_rpc_toolchain")
34

45
# This should not generally be referenced. Users should use java_grpc_library
@@ -22,8 +23,8 @@ java_library(
2223
"//protobuf",
2324
"//stub",
2425
"//stub:javax_annotation",
25-
"@com_google_code_findbugs_jsr305//jar",
26-
"@com_google_guava_guava//jar",
26+
artifact("com.google.code.findbugs:jsr305"),
27+
artifact("com.google.guava:guava"),
2728
"@com_google_protobuf//:protobuf_java",
2829
],
2930
)
@@ -35,8 +36,8 @@ java_library(
3536
"//protobuf-lite",
3637
"//stub",
3738
"//stub:javax_annotation",
38-
"@com_google_code_findbugs_jsr305//jar",
39-
"@com_google_guava_guava//jar",
39+
artifact("com.google.code.findbugs:jsr305"),
40+
artifact("com.google.guava:guava"),
4041
],
4142
)
4243

‎core/BUILD.bazel

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "core",
35
visibility = ["//visibility:public"],
@@ -23,14 +25,14 @@ java_library(
2325
deps = [
2426
"//api",
2527
"//context",
26-
"@com_google_android_annotations//jar",
27-
"@com_google_code_findbugs_jsr305//jar",
28-
"@com_google_code_gson_gson//jar",
29-
"@com_google_errorprone_error_prone_annotations//jar",
30-
"@com_google_guava_guava//jar",
31-
"@com_google_j2objc_j2objc_annotations//jar",
32-
"@io_perfmark_perfmark_api//jar",
33-
"@org_codehaus_mojo_animal_sniffer_annotations//jar",
28+
artifact("com.google.code.gson:gson"),
29+
artifact("com.google.android:annotations"),
30+
artifact("com.google.code.findbugs:jsr305"),
31+
artifact("com.google.errorprone:error_prone_annotations"),
32+
artifact("com.google.guava:guava"),
33+
artifact("com.google.j2objc:j2objc-annotations"),
34+
artifact("io.perfmark:perfmark-api"),
35+
artifact("org.codehaus.mojo:animal-sniffer-annotations"),
3436
],
3537
)
3638

‎googleapis/BUILD.bazel

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "googleapis",
35
srcs = glob([
@@ -9,6 +11,6 @@ java_library(
911
"//api",
1012
"//core:internal",
1113
"//xds",
12-
"@com_google_guava_guava//jar",
14+
artifact("com.google.guava:guava"),
1315
],
1416
)

‎grpclb/BUILD.bazel

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
12
load("//:java_grpc_library.bzl", "java_grpc_library")
23

34
java_library(
@@ -16,11 +17,11 @@ java_library(
1617
"//core:internal",
1718
"//util",
1819
"//stub",
19-
"@com_google_code_findbugs_jsr305//jar",
20-
"@com_google_guava_guava//jar",
21-
"@com_google_j2objc_j2objc_annotations//jar",
2220
"@com_google_protobuf//:protobuf_java_util",
2321
"@io_grpc_grpc_proto//:grpclb_load_balancer_java_proto",
22+
artifact("com.google.code.findbugs:jsr305"),
23+
artifact("com.google.guava:guava"),
24+
artifact("com.google.j2objc:j2objc-annotations"),
2425
],
2526
)
2627

‎inprocess/BUILD.bazel

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "inprocess",
35
srcs = glob([
46
"src/main/java/io/grpc/inprocess/*.java",
57
]),
68
visibility = ["//visibility:public"],
79
deps = [
8-
"//core:internal",
910
"//api",
1011
"//context",
11-
"@com_google_code_findbugs_jsr305//jar",
12-
"@com_google_errorprone_error_prone_annotations//jar",
13-
"@com_google_guava_guava//jar",
14-
"@com_google_j2objc_j2objc_annotations//jar",
12+
"//core:internal",
13+
artifact("com.google.code.findbugs:jsr305"),
14+
artifact("com.google.errorprone:error_prone_annotations"),
15+
artifact("com.google.guava:guava"),
16+
artifact("com.google.j2objc:j2objc-annotations"),
1517
],
1618
)

‎netty/BUILD.bazel

+18-16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "netty",
35
srcs = glob([
@@ -10,22 +12,22 @@ java_library(
1012
deps = [
1113
"//api",
1214
"//core:internal",
13-
"@com_google_code_findbugs_jsr305//jar",
14-
"@com_google_errorprone_error_prone_annotations//jar",
15-
"@com_google_guava_guava//jar",
16-
"@com_google_j2objc_j2objc_annotations//jar",
17-
"@io_netty_netty_buffer//jar",
18-
"@io_netty_netty_codec//jar",
19-
"@io_netty_netty_codec_http//jar",
20-
"@io_netty_netty_codec_http2//jar",
21-
"@io_netty_netty_codec_socks//jar",
22-
"@io_netty_netty_common//jar",
23-
"@io_netty_netty_handler//jar",
24-
"@io_netty_netty_handler_proxy//jar",
25-
"@io_netty_netty_resolver//jar",
26-
"@io_netty_netty_transport//jar",
27-
"@io_netty_netty_transport_native_unix_common//jar",
28-
"@io_perfmark_perfmark_api//jar",
15+
artifact("com.google.code.findbugs:jsr305"),
16+
artifact("com.google.errorprone:error_prone_annotations"),
17+
artifact("com.google.guava:guava"),
18+
artifact("com.google.j2objc:j2objc-annotations"),
19+
artifact("io.netty:netty-buffer"),
20+
artifact("io.netty:netty-codec"),
21+
artifact("io.netty:netty-codec-http"),
22+
artifact("io.netty:netty-codec-http2"),
23+
artifact("io.netty:netty-codec-socks"),
24+
artifact("io.netty:netty-common"),
25+
artifact("io.netty:netty-handler"),
26+
artifact("io.netty:netty-handler-proxy"),
27+
artifact("io.netty:netty-resolver"),
28+
artifact("io.netty:netty-transport"),
29+
artifact("io.netty:netty-transport-native-unix-common"),
30+
artifact("io.perfmark:perfmark-api"),
2931
],
3032
)
3133

‎netty/shaded/BUILD.bazel

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
# Publicly exposed in //netty package. Purposefully does not export any symbols.
24
java_library(
35
name = "shaded",
46
visibility = ["//netty:__pkg__"],
57
runtime_deps = [
68
"//netty",
7-
"@io_netty_netty_tcnative_boringssl_static//jar",
8-
"@io_netty_netty_tcnative_classes//jar",
9-
"@io_netty_netty_transport_native_unix_common//jar",
10-
"@io_netty_netty_transport_native_epoll_linux_x86_64//jar",
9+
artifact("io.netty:netty-tcnative-boringssl-static"),
10+
artifact("io.netty:netty-tcnative-classes"),
11+
artifact("io.netty:netty-transport-native-unix-common"),
12+
artifact("io.netty:netty-transport-native-epoll_linux_x86_64"),
1113
],
1214
)

‎okhttp/BUILD.bazel

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "okhttp",
35
srcs = glob([
@@ -12,12 +14,12 @@ java_library(
1214
"//api",
1315
"//core:internal",
1416
"//util",
15-
"@com_google_code_findbugs_jsr305//jar",
16-
"@com_google_errorprone_error_prone_annotations//jar",
17-
"@com_google_guava_guava//jar",
18-
"@com_google_j2objc_j2objc_annotations//jar",
19-
"@com_squareup_okhttp_okhttp//jar",
20-
"@com_squareup_okio_okio//jar",
21-
"@io_perfmark_perfmark_api//jar",
17+
artifact("com.google.code.findbugs:jsr305"),
18+
artifact("com.google.errorprone:error_prone_annotations"),
19+
artifact("com.google.guava:guava"),
20+
artifact("com.google.j2objc:j2objc-annotations"),
21+
artifact("com.squareup.okhttp:okhttp"),
22+
artifact("com.squareup.okio:okio"),
23+
artifact("io.perfmark:perfmark-api"),
2224
],
2325
)

‎protobuf-lite/BUILD.bazel

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "protobuf-lite",
35
srcs = glob([
@@ -6,9 +8,9 @@ java_library(
68
visibility = ["//visibility:public"],
79
deps = [
810
"//api",
9-
"@com_google_code_findbugs_jsr305//jar",
10-
"@com_google_guava_guava//jar",
11-
"@com_google_j2objc_j2objc_annotations//jar",
11+
artifact("com.google.code.findbugs:jsr305"),
12+
artifact("com.google.guava:guava"),
13+
artifact("com.google.j2objc:j2objc-annotations"),
1214
] + select({
1315
":android": ["@com_google_protobuf_javalite//:protobuf_javalite"],
1416
"//conditions:default": ["@com_google_protobuf//:protobuf_java"],

‎protobuf/BUILD.bazel

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "protobuf",
35
srcs = glob([
@@ -7,10 +9,10 @@ java_library(
79
deps = [
810
"//api",
911
"//protobuf-lite",
10-
"@com_google_api_grpc_proto_google_common_protos//jar",
11-
"@com_google_code_findbugs_jsr305//jar",
12-
"@com_google_guava_guava//jar",
13-
"@com_google_j2objc_j2objc_annotations//jar",
1412
"@com_google_protobuf//:protobuf_java",
13+
artifact("com.google.api.grpc:proto-google-common-protos"),
14+
artifact("com.google.code.findbugs:jsr305"),
15+
artifact("com.google.guava:guava"),
16+
artifact("com.google.j2objc:j2objc-annotations"),
1517
],
1618
)

‎rls/BUILD.bazel

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
12
load("//:java_grpc_library.bzl", "java_grpc_library")
23

34
java_library(
@@ -12,13 +13,13 @@ java_library(
1213
"//api",
1314
"//core",
1415
"//core:internal",
15-
"//util",
1616
"//stub",
17-
"@com_google_auto_value_auto_value_annotations//jar",
18-
"@com_google_code_findbugs_jsr305//jar",
19-
"@com_google_guava_guava//jar",
17+
"//util",
2018
"@io_grpc_grpc_proto//:rls_config_java_proto",
2119
"@io_grpc_grpc_proto//:rls_java_proto",
20+
artifact("com.google.auto.value:auto-value-annotations"),
21+
artifact("com.google.code.findbugs:jsr305"),
22+
artifact("com.google.guava:guava"),
2223
],
2324
)
2425

‎services/BUILD.bazel

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
12
load("//:java_grpc_library.bzl", "java_grpc_library")
23

34
package(default_visibility = ["//visibility:public"])
@@ -26,7 +27,7 @@ java_library(
2627
deps = [
2728
":channelz",
2829
"//api",
29-
"@com_google_code_findbugs_jsr305//jar",
30+
artifact("com.google.code.findbugs:jsr305"),
3031
],
3132
)
3233

@@ -35,15 +36,15 @@ java_library(
3536
srcs = [
3637
"src/main/java/io/grpc/services/CallMetricRecorder.java",
3738
"src/main/java/io/grpc/services/MetricRecorder.java",
38-
"src/main/java/io/grpc/services/MetricReport.java",
3939
"src/main/java/io/grpc/services/MetricRecorderHelper.java",
40+
"src/main/java/io/grpc/services/MetricReport.java",
4041
],
4142
deps = [
4243
"//api",
4344
"//context",
44-
"@com_google_code_findbugs_jsr305//jar",
45-
"@com_google_errorprone_error_prone_annotations//jar",
46-
"@com_google_guava_guava//jar",
45+
artifact("com.google.code.findbugs:jsr305"),
46+
artifact("com.google.errorprone:error_prone_annotations"),
47+
artifact("com.google.guava:guava"),
4748
],
4849
)
4950

@@ -72,11 +73,11 @@ java_library(
7273
":_channelz_java_grpc",
7374
"//api",
7475
"//stub",
75-
"@com_google_code_findbugs_jsr305//jar",
76-
"@com_google_guava_guava//jar",
7776
"@com_google_protobuf//:protobuf_java",
7877
"@com_google_protobuf//:protobuf_java_util",
7978
"@io_grpc_grpc_proto//:channelz_java_proto",
79+
artifact("com.google.code.findbugs:jsr305"),
80+
artifact("com.google.guava:guava"),
8081
],
8182
)
8283

@@ -90,11 +91,11 @@ java_library(
9091
"//api",
9192
"//protobuf",
9293
"//stub",
93-
"@com_google_code_findbugs_jsr305//jar",
94-
"@com_google_guava_guava//jar",
9594
"@com_google_protobuf//:protobuf_java",
9695
"@com_google_protobuf//:protobuf_java_util",
9796
"@io_grpc_grpc_proto//:reflection_java_proto_deprecated",
97+
artifact("com.google.code.findbugs:jsr305"),
98+
artifact("com.google.guava:guava"),
9899
],
99100
)
100101

@@ -110,9 +111,9 @@ java_library(
110111
"//api",
111112
"//context",
112113
"//stub",
113-
"@com_google_code_findbugs_jsr305//jar",
114-
"@com_google_guava_guava//jar",
115114
"@io_grpc_grpc_proto//:health_java_proto",
115+
artifact("com.google.code.findbugs:jsr305"),
116+
artifact("com.google.guava:guava"),
116117
],
117118
)
118119

@@ -131,9 +132,9 @@ java_library(
131132
"//api",
132133
"//core:internal",
133134
"//util",
134-
"@com_google_code_findbugs_jsr305//jar",
135-
"@com_google_guava_guava//jar",
136135
"@io_grpc_grpc_proto//:health_java_proto",
136+
artifact("com.google.code.findbugs:jsr305"),
137+
artifact("com.google.guava:guava"),
137138
],
138139
)
139140

‎stub/BUILD.bazel

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "stub",
35
srcs = glob([
@@ -7,10 +9,10 @@ java_library(
79
deps = [
810
"//api",
911
"//context",
10-
"@com_google_code_findbugs_jsr305//jar",
11-
"@com_google_errorprone_error_prone_annotations//jar",
12-
"@com_google_guava_guava//jar",
13-
"@com_google_j2objc_j2objc_annotations//jar",
12+
artifact("com.google.code.findbugs:jsr305"),
13+
artifact("com.google.errorprone:error_prone_annotations"),
14+
artifact("com.google.guava:guava"),
15+
artifact("com.google.j2objc:j2objc-annotations"),
1416
],
1517
)
1618

@@ -20,5 +22,5 @@ java_library(
2022
name = "javax_annotation",
2123
neverlink = 1, # @Generated is source-retention
2224
visibility = ["//visibility:public"],
23-
exports = ["@org_apache_tomcat_annotations_api//jar"],
25+
exports = [artifact("org.apache.tomcat:annotations-api")],
2426
)

‎testing/BUILD.bazel

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "testing",
35
testonly = 1,
@@ -12,12 +14,12 @@ java_library(
1214
"//api",
1315
"//context",
1416
"//inprocess",
15-
"//util",
1617
"//stub",
17-
"@com_google_code_findbugs_jsr305//jar",
18-
"@com_google_guava_guava//jar",
19-
"@com_google_j2objc_j2objc_annotations//jar",
20-
"@com_google_truth_truth//jar",
21-
"@junit_junit//jar",
18+
"//util",
19+
artifact("com.google.code.findbugs:jsr305"),
20+
artifact("com.google.guava:guava"),
21+
artifact("com.google.j2objc:j2objc-annotations"),
22+
artifact("com.google.truth:truth"),
23+
artifact("junit:junit"),
2224
],
2325
)

‎util/BUILD.bazel

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
2+
13
java_library(
24
name = "util",
35
srcs = glob([
@@ -10,9 +12,9 @@ java_library(
1012
deps = [
1113
"//api",
1214
"//core:internal",
13-
"@com_google_code_findbugs_jsr305//jar",
14-
"@com_google_guava_guava//jar",
15-
"@com_google_j2objc_j2objc_annotations//jar",
16-
"@org_codehaus_mojo_animal_sniffer_annotations//jar",
15+
artifact("com.google.code.findbugs:jsr305"),
16+
artifact("com.google.guava:guava"),
17+
artifact("com.google.j2objc:j2objc-annotations"),
18+
artifact("org.codehaus.mojo:animal-sniffer-annotations"),
1719
],
1820
)

‎xds/BUILD.bazel

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_jvm_external//:defs.bzl", "artifact")
12
load("//:java_grpc_library.bzl", "java_grpc_library")
23

34
# Mirrors the dependencies included in the artifact on Maven Central for usage
@@ -43,19 +44,19 @@ java_library(
4344
"//stub",
4445
"//services:metrics",
4546
"//services:metrics_internal",
46-
"@com_google_code_findbugs_jsr305//jar",
47-
"@com_google_code_gson_gson//jar",
48-
"@com_google_errorprone_error_prone_annotations//jar",
4947
"@com_google_googleapis//google/rpc:rpc_java_proto",
50-
"@com_google_guava_guava//jar",
5148
"@com_google_protobuf//:protobuf_java",
5249
"@com_google_protobuf//:protobuf_java_util",
53-
"@com_google_re2j_re2j//jar",
54-
"@io_netty_netty_buffer//jar",
55-
"@io_netty_netty_codec//jar",
56-
"@io_netty_netty_common//jar",
57-
"@io_netty_netty_handler//jar",
58-
"@io_netty_netty_transport//jar",
50+
artifact("com.google.code.findbugs:jsr305"),
51+
artifact("com.google.code.gson:gson"),
52+
artifact("com.google.errorprone:error_prone_annotations"),
53+
artifact("com.google.guava:guava"),
54+
artifact("com.google.re2j:re2j"),
55+
artifact("io.netty:netty-buffer"),
56+
artifact("io.netty:netty-codec"),
57+
artifact("io.netty:netty-common"),
58+
artifact("io.netty:netty-handler"),
59+
artifact("io.netty:netty-transport"),
5960
],
6061
)
6162

@@ -150,9 +151,9 @@ java_library(
150151
"//services:metrics",
151152
"//services:metrics_internal",
152153
"//stub",
153-
"@com_google_code_findbugs_jsr305//jar",
154-
"@com_google_guava_guava//jar",
155154
"@com_google_protobuf//:protobuf_java_util",
155+
artifact("com.google.code.findbugs:jsr305"),
156+
artifact("com.google.guava:guava"),
156157
],
157158
)
158159

0 commit comments

Comments
 (0)
Please sign in to comment.