Skip to content

Commit a75ed4d

Browse files
committed
bazel: Export deps from maven stand-in targets
If an artifact on Maven Central exposes a type from gRPC on its API surface, then consumers of that artifact need that gRPC API in the compile classpath. Bazel handles this by making hjars for transitive dependencies, but if the dependencies are runtime_deps then Bazel won't generate hjars containing the needed symbols. We don't export netty-shaded because the classes already don't match Maven Central. If an artifact on Maven Central is exposing a netty-shaded class on its API surface, it wouldn't work anyway since the class simply doesn't exist for the Bazel build. Fixes #9772
1 parent f71447c commit a75ed4d

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

core/BUILD.bazel

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,12 @@ java_library(
6565
)
6666

6767
# Mirrors the dependencies included in the artifact on Maven Central for usage
68-
# with maven_install's override_targets. Purposefully does not export any
69-
# symbols, as it should only be used as a dep for pre-compiled binaries on
70-
# Maven Central.
68+
# with maven_install's override_targets. Should only be used as a dep for
69+
# pre-compiled binaries on Maven Central.
7170
java_library(
7271
name = "core_maven",
7372
visibility = ["//visibility:public"],
74-
runtime_deps = [
73+
exports = [
7574
":inprocess",
7675
":internal",
7776
":util",

netty/BUILD.bazel

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@ java_library(
2020
"@io_netty_netty_codec_http2//jar",
2121
"@io_netty_netty_codec_socks//jar",
2222
"@io_netty_netty_common//jar",
23-
"@io_netty_netty_transport_native_unix_common//jar",
2423
"@io_netty_netty_handler//jar",
2524
"@io_netty_netty_handler_proxy//jar",
2625
"@io_netty_netty_resolver//jar",
2726
"@io_netty_netty_transport//jar",
27+
"@io_netty_netty_transport_native_unix_common//jar",
2828
"@io_perfmark_perfmark_api//jar",
2929
],
3030
)
3131

3232
# Mirrors the dependencies included in the artifact on Maven Central for usage
33-
# with maven_install's override_targets. Purposefully does not export any
34-
# symbols, as it should only be used as a dep for pre-compiled binaries on
35-
# Maven Central. Not actually shaded; libraries should not be referencing
36-
# unstable APIs so there should not be any references to the shaded package.
33+
# with maven_install's override_targets. Should only be used as a dep for
34+
# pre-compiled binaries on Maven Central.
35+
#
36+
# Not actually shaded; libraries should not be referencing unstable APIs so
37+
# there should not be any references to the shaded package.
3738
java_library(
3839
name = "shaded_maven",
3940
visibility = ["//visibility:public"],

services/BUILD.bazel

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ load("//:java_grpc_library.bzl", "java_grpc_library")
33
package(default_visibility = ["//visibility:public"])
44

55
# Mirrors the dependencies included in the artifact on Maven Central for usage
6-
# with maven_install's override_targets. Purposefully does not export any
7-
# symbols, as it should only be used as a dep for pre-compiled binaries on
8-
# Maven Central.
6+
# with maven_install's override_targets. Should only be used as a dep for
7+
# pre-compiled binaries on Maven Central.
98
java_library(
109
name = "services_maven",
11-
runtime_deps = [
10+
exports = [
1211
":admin",
1312
":binarylog",
1413
":channelz",

xds/BUILD.bazel

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
load("//:java_grpc_library.bzl", "java_grpc_library")
22

33
# Mirrors the dependencies included in the artifact on Maven Central for usage
4-
# with maven_install's override_targets. Purposefully does not export any
5-
# symbols, as it should only be used as a dep for pre-compiled binaries on
6-
# Maven Central.
4+
# with maven_install's override_targets. Should only be used as a dep for
5+
# pre-compiled binaries on Maven Central.
76
java_library(
87
name = "xds_maven",
98
visibility = ["//visibility:public"],
10-
runtime_deps = [
9+
exports = [
1110
":orca",
1211
":xds",
1312
],

0 commit comments

Comments
 (0)