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
This commit is contained in:
Eric Anderson 2023-01-03 10:12:18 -08:00
parent 51ee3eb6ab
commit f0614e5a76
4 changed files with 15 additions and 17 deletions

View File

@ -65,13 +65,12 @@ java_library(
) )
# Mirrors the dependencies included in the artifact on Maven Central for usage # Mirrors the dependencies included in the artifact on Maven Central for usage
# with maven_install's override_targets. Purposefully does not export any # with maven_install's override_targets. Should only be used as a dep for
# symbols, as it should only be used as a dep for pre-compiled binaries on # pre-compiled binaries on Maven Central.
# Maven Central.
java_library( java_library(
name = "core_maven", name = "core_maven",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
runtime_deps = [ exports = [
":inprocess", ":inprocess",
":internal", ":internal",
":util", ":util",

View File

@ -20,20 +20,21 @@ java_library(
"@io_netty_netty_codec_http2//jar", "@io_netty_netty_codec_http2//jar",
"@io_netty_netty_codec_socks//jar", "@io_netty_netty_codec_socks//jar",
"@io_netty_netty_common//jar", "@io_netty_netty_common//jar",
"@io_netty_netty_transport_native_unix_common//jar",
"@io_netty_netty_handler//jar", "@io_netty_netty_handler//jar",
"@io_netty_netty_handler_proxy//jar", "@io_netty_netty_handler_proxy//jar",
"@io_netty_netty_resolver//jar", "@io_netty_netty_resolver//jar",
"@io_netty_netty_transport//jar", "@io_netty_netty_transport//jar",
"@io_netty_netty_transport_native_unix_common//jar",
"@io_perfmark_perfmark_api//jar", "@io_perfmark_perfmark_api//jar",
], ],
) )
# Mirrors the dependencies included in the artifact on Maven Central for usage # Mirrors the dependencies included in the artifact on Maven Central for usage
# with maven_install's override_targets. Purposefully does not export any # with maven_install's override_targets. Should only be used as a dep for
# symbols, as it should only be used as a dep for pre-compiled binaries on # pre-compiled binaries on Maven Central.
# Maven Central. Not actually shaded; libraries should not be referencing #
# unstable APIs so there should not be any references to the shaded package. # Not actually shaded; libraries should not be referencing unstable APIs so
# there should not be any references to the shaded package.
java_library( java_library(
name = "shaded_maven", name = "shaded_maven",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],

View File

@ -3,12 +3,11 @@ load("//:java_grpc_library.bzl", "java_grpc_library")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
# Mirrors the dependencies included in the artifact on Maven Central for usage # Mirrors the dependencies included in the artifact on Maven Central for usage
# with maven_install's override_targets. Purposefully does not export any # with maven_install's override_targets. Should only be used as a dep for
# symbols, as it should only be used as a dep for pre-compiled binaries on # pre-compiled binaries on Maven Central.
# Maven Central.
java_library( java_library(
name = "services_maven", name = "services_maven",
runtime_deps = [ exports = [
":admin", ":admin",
":binarylog", ":binarylog",
":channelz", ":channelz",

View File

@ -1,13 +1,12 @@
load("//:java_grpc_library.bzl", "java_grpc_library") load("//:java_grpc_library.bzl", "java_grpc_library")
# Mirrors the dependencies included in the artifact on Maven Central for usage # Mirrors the dependencies included in the artifact on Maven Central for usage
# with maven_install's override_targets. Purposefully does not export any # with maven_install's override_targets. Should only be used as a dep for
# symbols, as it should only be used as a dep for pre-compiled binaries on # pre-compiled binaries on Maven Central.
# Maven Central.
java_library( java_library(
name = "xds_maven", name = "xds_maven",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
runtime_deps = [ exports = [
":orca", ":orca",
":xds", ":xds",
], ],