Skip to content

Commit

Permalink
Upgrade rules_cc 0.0.15 and rules_java 8.3.1 (#19215)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
comius and protobuf-github-bot authored Nov 12, 2024
1 parent 6f310d5 commit fb8ee79
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 31 deletions.
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bazel_dep(

bazel_dep(
name = "rules_cc",
version = "0.0.13",
version = "0.0.16",
)

bazel_dep(
Expand All @@ -40,7 +40,7 @@ bazel_dep(

bazel_dep(
name = "rules_java",
version = "7.12.2",
version = "8.3.2",
)

bazel_dep(
Expand Down
10 changes: 6 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ workspace(name = "com_google_protobuf")
# buildifier: disable=duplicated-name
local_repository(name = "com_google_protobuf", path = ".")

# Second self-reference that makes it possible to load proto rules from @protobuf.
# buildifier: disable=duplicated-name
local_repository(name = "protobuf", path = ".")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

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

apple_support_dependencies()

load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")

rules_java_dependencies()

rules_java_toolchains()

load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies")

rules_cc_dependencies()
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/BUILD.googleapis
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

load(
"@protobuf//bazel:proto_library.bzl",
"@com_google_protobuf//bazel:proto_library.bzl",
"proto_library",
)

Expand Down
18 changes: 9 additions & 9 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# example.

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@protobuf//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
load("@protobuf//bazel:java_proto_library.bzl", "java_proto_library")
load("@protobuf//bazel:proto_library.bzl", "proto_library")
load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")
load("@com_google_protobuf//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_python//python:py_binary.bzl", "py_binary")
Expand All @@ -25,7 +25,7 @@ load("@rules_python//python:py_binary.bzl", "py_binary")
proto_library(
name = "addressbook_proto",
srcs = ["addressbook.proto"],
deps = ["@protobuf//:timestamp_proto"],
deps = ["@com_google_protobuf//:timestamp_proto"],
)

# The cc_proto_library rule generates C++ code for a proto_library rule. It
Expand All @@ -45,8 +45,8 @@ cc_binary(
srcs = ["add_person.cc"],
deps = [
":addressbook_cc_proto",
"@protobuf",
"@protobuf//src/google/protobuf/util:time_util",
"@com_google_protobuf//:protobuf",
"@com_google_protobuf//src/google/protobuf/util:time_util",
],
)

Expand All @@ -55,8 +55,8 @@ cc_binary(
srcs = ["list_people.cc"],
deps = [
":addressbook_cc_proto",
"@protobuf",
"@protobuf//src/google/protobuf/util:time_util",
"@com_google_protobuf//:protobuf",
"@com_google_protobuf//src/google/protobuf/util:time_util",
],
)

Expand Down
6 changes: 3 additions & 3 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Bazel module dependencies"""
bazel_dep(name = "protobuf", version = "0.0.0", dev_dependency = True)

bazel_dep(name = "protobuf", version = "0.0.0", repo_name = "com_google_protobuf")
local_path_override(
module_name = "protobuf",
path = "..",
)

bazel_dep(name = "bazel_skylib", version = "1.0.3")
bazel_dep(name = "rules_cc", version = "0.0.1")
bazel_dep(name = "rules_java", version = "7.3.0")
bazel_dep(name = "rules_cc", version = "0.0.16")
bazel_dep(name = "rules_java", version = "8.3.2")
bazel_dep(name = "rules_pkg", version = "0.7.0")
bazel_dep(name = "rules_python", version = "0.25.0")
23 changes: 16 additions & 7 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# before they get merged. You'll want to use the following instead:
#
# http_archive(
# name = "protobuf",
# name = "com_google_protobuf",
# sha256 = "c29d8b4b79389463c546f98b15aa4391d4ed7ec459340c47bffe15db63eb9126",
# strip_prefix = "protobuf-3.21.3",
# urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.3.tar.gz"],
Expand All @@ -20,11 +20,6 @@ local_repository(
path = "..",
)

local_repository(
name = "protobuf",
path = "..",
)

# Similar to com_google_protobuf but for Java lite. If you are building
# for Android, the lite version should be preferred because it has a much
# smaller code size.
Expand All @@ -42,6 +37,20 @@ http_archive(
url = "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.0.tar.gz",
)

load("@protobuf//:protobuf_deps.bzl", "protobuf_deps")
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

http_archive(
name = "rules_java",
sha256 = "9b9614f8a7f7b7ed93cb7975d227ece30fe7daed2c0a76f03a5ee37f69e437de",
urls = [
"https://github.com/bazelbuild/rules_java/releases/download/8.3.2/rules_java-8.3.2.tar.gz",
],
)

load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")

rules_java_dependencies()

rules_java_toolchains()
10 changes: 5 additions & 5 deletions protobuf_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ def protobuf_deps():
if not native.existing_rule("rules_cc"):
http_archive(
name = "rules_cc",
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"],
sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80",
strip_prefix = "rules_cc-0.0.13",
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.16/rules_cc-0.0.16.tar.gz"],
sha256 = "bbf1ae2f83305b7053b11e4467d317a7ba3517a12cef608543c1b1c5bf48a4df",
strip_prefix = "rules_cc-0.0.16",
)

if not native.existing_rule("rules_java"):
http_archive(
name = "rules_java",
url = "https://github.com/bazelbuild/rules_java/releases/download/7.12.2/rules_java-7.12.2.tar.gz",
sha256 = "a9690bc00c538246880d5c83c233e4deb83fe885f54c21bb445eb8116a180b83",
url = "https://github.com/bazelbuild/rules_java/releases/download/8.3.2/rules_java-8.3.2.tar.gz",
sha256 = "9b9614f8a7f7b7ed93cb7975d227ece30fe7daed2c0a76f03a5ee37f69e437de",
)

if not native.existing_rule("rules_shell"):
Expand Down

0 comments on commit fb8ee79

Please sign in to comment.