Skip to content

Commit fb8ee79

Browse files
Upgrade rules_cc 0.0.15 and rules_java 8.3.1 (#19215)
Both versions are again compatible with WORKSPACE mode on Bazel 8. The version also extends the compabibility down to Bazel 6. PiperOrigin-RevId: 695246603 Co-authored-by: Protobuf Team Bot <protobuf-github-bot@google.com>
1 parent 6f310d5 commit fb8ee79

File tree

7 files changed

+42
-31
lines changed

7 files changed

+42
-31
lines changed

MODULE.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ bazel_dep(
3030

3131
bazel_dep(
3232
name = "rules_cc",
33-
version = "0.0.13",
33+
version = "0.0.16",
3434
)
3535

3636
bazel_dep(
@@ -40,7 +40,7 @@ bazel_dep(
4040

4141
bazel_dep(
4242
name = "rules_java",
43-
version = "7.12.2",
43+
version = "8.3.2",
4444
)
4545

4646
bazel_dep(

WORKSPACE

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ workspace(name = "com_google_protobuf")
55
# buildifier: disable=duplicated-name
66
local_repository(name = "com_google_protobuf", path = ".")
77

8-
# Second self-reference that makes it possible to load proto rules from @protobuf.
9-
# buildifier: disable=duplicated-name
10-
local_repository(name = "protobuf", path = ".")
11-
128
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
139

1410
local_repository(
@@ -94,6 +90,12 @@ load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependen
9490

9591
apple_support_dependencies()
9692

93+
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
94+
95+
rules_java_dependencies()
96+
97+
rules_java_toolchains()
98+
9799
load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies")
98100

99101
rules_cc_dependencies()

benchmarks/BUILD.googleapis

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030

3131
load(
32-
"@protobuf//bazel:proto_library.bzl",
32+
"@com_google_protobuf//bazel:proto_library.bzl",
3333
"proto_library",
3434
)
3535

examples/BUILD.bazel

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# example.
66

77
load("@bazel_skylib//rules:build_test.bzl", "build_test")
8-
load("@protobuf//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
9-
load("@protobuf//bazel:java_proto_library.bzl", "java_proto_library")
10-
load("@protobuf//bazel:proto_library.bzl", "proto_library")
11-
load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")
8+
load("@com_google_protobuf//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
9+
load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
10+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
11+
load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
1212
load("@rules_cc//cc:defs.bzl", "cc_binary")
1313
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
1414
load("@rules_python//python:py_binary.bzl", "py_binary")
@@ -25,7 +25,7 @@ load("@rules_python//python:py_binary.bzl", "py_binary")
2525
proto_library(
2626
name = "addressbook_proto",
2727
srcs = ["addressbook.proto"],
28-
deps = ["@protobuf//:timestamp_proto"],
28+
deps = ["@com_google_protobuf//:timestamp_proto"],
2929
)
3030

3131
# The cc_proto_library rule generates C++ code for a proto_library rule. It
@@ -45,8 +45,8 @@ cc_binary(
4545
srcs = ["add_person.cc"],
4646
deps = [
4747
":addressbook_cc_proto",
48-
"@protobuf",
49-
"@protobuf//src/google/protobuf/util:time_util",
48+
"@com_google_protobuf//:protobuf",
49+
"@com_google_protobuf//src/google/protobuf/util:time_util",
5050
],
5151
)
5252

@@ -55,8 +55,8 @@ cc_binary(
5555
srcs = ["list_people.cc"],
5656
deps = [
5757
":addressbook_cc_proto",
58-
"@protobuf",
59-
"@protobuf//src/google/protobuf/util:time_util",
58+
"@com_google_protobuf//:protobuf",
59+
"@com_google_protobuf//src/google/protobuf/util:time_util",
6060
],
6161
)
6262

examples/MODULE.bazel

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""Bazel module dependencies"""
2-
bazel_dep(name = "protobuf", version = "0.0.0", dev_dependency = True)
32

3+
bazel_dep(name = "protobuf", version = "0.0.0", repo_name = "com_google_protobuf")
44
local_path_override(
55
module_name = "protobuf",
66
path = "..",
77
)
88

99
bazel_dep(name = "bazel_skylib", version = "1.0.3")
10-
bazel_dep(name = "rules_cc", version = "0.0.1")
11-
bazel_dep(name = "rules_java", version = "7.3.0")
10+
bazel_dep(name = "rules_cc", version = "0.0.16")
11+
bazel_dep(name = "rules_java", version = "8.3.2")
1212
bazel_dep(name = "rules_pkg", version = "0.7.0")
1313
bazel_dep(name = "rules_python", version = "0.25.0")

examples/WORKSPACE

+16-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
99
# before they get merged. You'll want to use the following instead:
1010
#
1111
# http_archive(
12-
# name = "protobuf",
12+
# name = "com_google_protobuf",
1313
# sha256 = "c29d8b4b79389463c546f98b15aa4391d4ed7ec459340c47bffe15db63eb9126",
1414
# strip_prefix = "protobuf-3.21.3",
1515
# urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.3.tar.gz"],
@@ -20,11 +20,6 @@ local_repository(
2020
path = "..",
2121
)
2222

23-
local_repository(
24-
name = "protobuf",
25-
path = "..",
26-
)
27-
2823
# Similar to com_google_protobuf but for Java lite. If you are building
2924
# for Android, the lite version should be preferred because it has a much
3025
# smaller code size.
@@ -42,6 +37,20 @@ http_archive(
4237
url = "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.0.tar.gz",
4338
)
4439

45-
load("@protobuf//:protobuf_deps.bzl", "protobuf_deps")
40+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
4641

4742
protobuf_deps()
43+
44+
http_archive(
45+
name = "rules_java",
46+
sha256 = "9b9614f8a7f7b7ed93cb7975d227ece30fe7daed2c0a76f03a5ee37f69e437de",
47+
urls = [
48+
"https://github.com/bazelbuild/rules_java/releases/download/8.3.2/rules_java-8.3.2.tar.gz",
49+
],
50+
)
51+
52+
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
53+
54+
rules_java_dependencies()
55+
56+
rules_java_toolchains()

protobuf_deps.bzl

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ def protobuf_deps():
9292
if not native.existing_rule("rules_cc"):
9393
http_archive(
9494
name = "rules_cc",
95-
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"],
96-
sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80",
97-
strip_prefix = "rules_cc-0.0.13",
95+
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.16/rules_cc-0.0.16.tar.gz"],
96+
sha256 = "bbf1ae2f83305b7053b11e4467d317a7ba3517a12cef608543c1b1c5bf48a4df",
97+
strip_prefix = "rules_cc-0.0.16",
9898
)
9999

100100
if not native.existing_rule("rules_java"):
101101
http_archive(
102102
name = "rules_java",
103-
url = "https://github.com/bazelbuild/rules_java/releases/download/7.12.2/rules_java-7.12.2.tar.gz",
104-
sha256 = "a9690bc00c538246880d5c83c233e4deb83fe885f54c21bb445eb8116a180b83",
103+
url = "https://github.com/bazelbuild/rules_java/releases/download/8.3.2/rules_java-8.3.2.tar.gz",
104+
sha256 = "9b9614f8a7f7b7ed93cb7975d227ece30fe7daed2c0a76f03a5ee37f69e437de",
105105
)
106106

107107
if not native.existing_rule("rules_shell"):

0 commit comments

Comments
 (0)