Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Reflect protobuf updates into MODULE.bazel #185

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@ module(
repo_name = "contrib_rules_jvm",
)

# TODO: This should be read from repositories.bzl, but we can't until this issue is solved:
# - https://github.com/bazelbuild/bazel/issues/17880
PROTOBUF_VERSION = "21.7"
# The java packages are published to maven under a different versioning scheme.
PROTOBUF_JAVA_VERSION = "3.{}".format(PROTOBUF_VERSION)

bazel_dep(name = "apple_rules_lint", version = "0.3.2")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.2")
bazel_dep(name = "gazelle", version = "0.31.1", repo_name = "bazel_gazelle")
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")
bazel_dep(name = "protobuf", version = PROTOBUF_VERSION, repo_name = "com_google_protobuf")
bazel_dep(name = "rules_cc", version = "0.0.6")
bazel_dep(name = "rules_go", version = "0.40.1", repo_name = "io_bazel_rules_go")
bazel_dep(name = "rules_java", version = "6.1.1")
bazel_dep(name = "rules_jvm_external", version = "5.3")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "rules_proto", version = "5.3.0-{}".format(PROTOBUF_VERSION))
bazel_dep(name = "stardoc", version = "0.5.6", repo_name = "io_bazel_stardoc")

non_module_deps = use_extension("//java/private:non-module-deps.bzl", "non_module_deps")
Expand Down Expand Up @@ -119,6 +125,10 @@ maven.install(
# Spotbugs deps
"org.slf4j:slf4j-api:1.7.32",
"org.slf4j:slf4j-jdk14:1.7.32",

# We explicitly declare a protobuf runtime version
# so that it coincides with the one we use to generate the code.
"com.google.protobuf:protobuf-java:{}".format(PROTOBUF_JAVA_VERSION),
] + IO_GRPC_GRPC_JAVA_ARTIFACTS,
fail_if_repin_required = True,
generate_compat_repositories = True,
Expand Down
9 changes: 2 additions & 7 deletions java/private/non-module-deps.bzl
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//:repositories.bzl", "io_grpc_grpc_java")

def _non_module_dependencies_impl(mctx):
maybe(
http_archive,
name = "io_grpc_grpc_java",
sha256 = "b6cfc524647cc680e66989ab22a10b66dc5de8c6d8499f91a7e633634c594c61",
strip_prefix = "grpc-java-1.51.1",
urls = ["https://github.com/grpc/grpc-java/archive/v1.51.1.tar.gz"],
)
io_grpc_grpc_java()

non_module_deps = module_extension(
implementation = _non_module_dependencies_impl,
Expand Down
19 changes: 11 additions & 8 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def contrib_rules_jvm_deps():
)

def contrib_rules_jvm_gazelle_deps():
io_grpc_grpc_java()

maybe(
http_archive,
name = "bazel_gazelle",
Expand All @@ -79,14 +81,6 @@ def contrib_rules_jvm_gazelle_deps():
url = "https://github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip",
)

maybe(
http_archive,
name = "io_grpc_grpc_java",
sha256 = "17dd91014032a147c978ae99582fddd950f5444388eae700cf51eda0326ad2f9",
strip_prefix = "grpc-java-1.56.1",
urls = ["https://github.com/grpc/grpc-java/archive/v1.56.1.tar.gz"],
)

maybe(
http_archive,
name = "rules_proto",
Expand All @@ -96,3 +90,12 @@ def contrib_rules_jvm_gazelle_deps():
strip_prefix = "rules_proto-5.3.0-{}".format(PROTOBUF_VERSION),
url = "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-{}.tar.gz".format(PROTOBUF_VERSION),
)

def io_grpc_grpc_java():
maybe(
http_archive,
name = "io_grpc_grpc_java",
sha256 = "17dd91014032a147c978ae99582fddd950f5444388eae700cf51eda0326ad2f9",
strip_prefix = "grpc-java-1.56.1",
urls = ["https://github.com/grpc/grpc-java/archive/v1.56.1.tar.gz"],
)
2 changes: 2 additions & 0 deletions third_party/protobuf_version.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Please keep in sync with MODULE.bazel until
# https://github.com/bazelbuild/bazel/issues/17880 is solved.
PROTOBUF_VERSION = "21.7"

# The java packages are published to maven under a different versioning scheme.
Expand Down
Loading