Skip to content

Commit

Permalink
Move grpc-java to MODULE.bazel, bump to 1.62.2
Browse files Browse the repository at this point in the history
grpc-java only got MODULE.bazel support as of this most recent version:

- grpc/grpc-java#11046
- bazelbuild/bazel-central-registry#1699

This grpc-java version bump exposed two issues that are fixed in this
commit:

1. The //java/com/engflow/notificationqueue:client target dependency on
   @maven//:io_netty_netty_handler broke.

   The original WORKSPACE import of io_grpc_grpc_java imported this
   dependency directly by passing IO_GRPC_GRPC_JAVA_ARTIFACTS directly
   to `maven_install`. The `maven.install` call from grpc/grpc-java's
   MODULE.bazel sets `strict_visibility = True`. Somehow the other
   dependencies registered by grpc-java's MODULE.bazel
   are accessible to notificationqueue:client, but netty-handler isn't.

   The solution was to add the `io.netty:netty-handler:4.1.100.Final`
   artifact to the `maven.install` call in this project's MODULE.bazel.
   It doesn't seem an optimal solution, but it works for now.

2. grpc/grpc-java removed `io.grpc.stub.MetadataUtils.attachHeaders()`
   in grpc/grpc-java#10443.

   This caused notificationqueue:client to fail to compile, but that PR
   revealed the replacement for the deprecated `attachHeaders` call.
   This commit applies that replacement.
  • Loading branch information
mbland committed Apr 12, 2024
1 parent d41dc3d commit 8355551
Show file tree
Hide file tree
Showing 4 changed files with 6,780 additions and 3,102 deletions.
19 changes: 19 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,29 @@ bazel_dep(name = "rules_java", version = "7.5.0")

# https://github.com/bazelbuild/rules_jvm_external/blob/master/docs/bzlmod.md
bazel_dep(name = "rules_jvm_external", version = "6.0")
bazel_dep(
name = "grpc-java",
version = "1.62.2",
repo_name = "io_grpc_grpc_java",
)

# Loads rules required to compile proto files
bazel_dep(name = "rules_proto_grpc", version = "5.0.0-alpha2")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
artifacts = [
"commons-cli:commons-cli:1.5.0",
"com.google.oauth-client:google-oauth-client:1.34.1",
"io.netty:netty-handler:4.1.100.Final",
],
strict_visibility = True,
repositories = [
"https://repo.maven.apache.org/maven2/",
],
)
use_repo(maven, "maven")

bazel_dep(
name = "rules_swift",
version = "1.18.0",
Expand Down
Loading

0 comments on commit 8355551

Please sign in to comment.