rules_proto_grpc
rules_proto_grpc copied to clipboard
Migration Help from WORKSPACE to MODULE.bazel
Description
I'm struggling to understand how to migrate from the old style workspace to the new MODULE.bazel. The world of grpc modules seems so fragmented it's hard to tell where the lines between different systems are, so my apologies if I'm asking in the wrong project.
Below is the WORKSPACE file, which I've split into parts with commentary, in order to migrate it to MODULE.bazel
All of this first bit can just be deleted from the WORKSPACE file
RULES_PROTO_GRPC_TAG = "4.6.0"
RULES_PROTO_GRPC_SHA = "2a0860a336ae836b54671cbbe0710eec17c64ef70c4c5a88ccfd47ea6e3739bd"
http_archive(
name = "rules_proto_grpc",
sha256 = RULES_PROTO_GRPC_SHA,
strip_prefix = "rules_proto_grpc-%s" % RULES_PROTO_GRPC_TAG,
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/releases/download/%s/rules_proto_grpc-%s.tar.gz" % (RULES_PROTO_GRPC_TAG, RULES_PROTO_GRPC_TAG)],
)
Replaced the following section with bazel_dep(name = "rules_proto_grpc", version = "5.0.0") in the MODULE.bazel
load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")
rules_proto_grpc_toolchains()
rules_proto_grpc_repos()
similarly below with bazel_dep(name = "rules_proto", version = "6.0.2")
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()
again below with bazel_dep(name = "rules_proto_grpc_java", version = "5.0.0")
load("@rules_proto_grpc//java:repositories.bzl", rules_proto_grpc_java_repos = "java_repos")
rules_proto_grpc_java_repos()
What is to be done with the following:
##
## Download and setup maven_grpc
##
load("@rules_jvm_external//:defs.bzl", "maven_install")
load("@io_grpc_grpc_java//:repositories.bzl", "IO_GRPC_GRPC_JAVA_ARTIFACTS", "IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS")
maven_install(
name = "maven_grpc",
artifacts = IO_GRPC_GRPC_JAVA_ARTIFACTS,
generate_compat_repositories = True,
override_targets = IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS,
repositories = [
"<URI_REDACTED>",
],
)
load("@maven_grpc//:compat.bzl", "compat_repositories")
compat_repositories()
load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories")
grpc_java_repositories()