Skip to content

Commit

Permalink
Test against bazel 8.0.0, update dependencies to bazel 8 compatible v…
Browse files Browse the repository at this point in the history
…ersions, and remove protobuf_extra_deps.

PiperOrigin-RevId: 705992287
  • Loading branch information
deannagarcia authored and copybara-github committed Jan 16, 2025
1 parent d02df7f commit af8234b
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
fail-fast: false
matrix:
runner: [ ubuntu, windows, macos ]
bazelversion: [ '7.1.2' ]
bazelversion: [ '7.1.2', '8.0.0' ]
bzlmod: [ true, false ]
toolchain_resolution: [ "", "--incompatible_enable_proto_toolchain_resolution=true" ]
runs-on: ${{ matrix.runner }}-latest
Expand Down Expand Up @@ -58,4 +58,4 @@ jobs:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: examples
version: ${{ matrix.bazelversion }}
bash: cd examples && bazel build //... $BAZEL_FLAGS --enable_bzlmod=${{ matrix.bzlmod }} ${{ matrix.toolchain_resolution }}
bash: cd examples && bazel build //... $BAZEL_FLAGS --subcommands --verbose_failures --enable_bzlmod=${{ matrix.bzlmod }} --enable_workspace=${{ !matrix.bzlmod }} ${{ matrix.toolchain_resolution }}
8 changes: 4 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ module(
# https://bazel.build/versions/6.0.0/build/bzlmod#version-resolution
# Thus the highest version in their module graph is resolved.
bazel_dep(name = "abseil-cpp", version = "20240722.0", repo_name = "com_google_absl")
bazel_dep(name = "bazel_skylib", version = "1.7.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "jsoncpp", version = "1.9.6")
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "rules_cc", version = "0.0.16")
bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "rules_fuzzing", version = "0.5.2")
bazel_dep(name = "rules_java", version = "8.3.2")
bazel_dep(name = "rules_java", version = "8.6.1")
bazel_dep(name = "rules_jvm_external", version = "6.3")
bazel_dep(name = "rules_kotlin", version = "1.9.6")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_python", version = "0.28.0")
bazel_dep(name = "rules_python", version = "1.0.0")
bazel_dep(name = "rules_rust", version = "0.51.0")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "zlib", version = "1.3.1")
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ bazel_dep(name = "protobuf", version = <VERSION>, repo_name = "com_google_protob
Users can also add the following to their legacy
[WORKSPACE](https://bazel.build/external/overview#workspace-system) file.

Note that the `protobuf_extra_deps.bzl` is added in the `v30.x` release.
Note that with the release of 30.x there are a few more load statements to
properly set up rules_java and rules_python.

```
http_archive(
Expand All @@ -70,9 +71,17 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
load("@com_google_protobuf//:protobuf_extra_deps.bzl", "protobuf_extra_deps")
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
protobuf_extra_deps();
rules_java_dependencies()
load("@rules_java//java:repositories.bzl", "rules_java_toolchains")
rules_java_toolchains()
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
```

Protobuf Compiler Installation
Expand Down
18 changes: 6 additions & 12 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps")

protobuf_deps()

load("//:protobuf_extra_deps.bzl", "protobuf_extra_deps")
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")

protobuf_extra_deps()
rules_java_dependencies()

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

rules_java_toolchains()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

Expand All @@ -32,10 +36,6 @@ load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies")

pip_install_dependencies()

# Bazel platform rules.
http_archive(
name = "platforms",
Expand Down Expand Up @@ -102,12 +102,6 @@ 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
10 changes: 5 additions & 5 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ local_path_override(
path = "..",
)

bazel_dep(name = "bazel_skylib", version = "1.0.3")
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")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "rules_java", version = "8.6.1")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_python", version = "1.0.0")
23 changes: 10 additions & 13 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
workspace(name = "com_google_protobuf_examples")

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

# This protobuf repository is required for proto_library rule.
# It provides the protocol compiler binary (i.e., protoc).
#
Expand All @@ -28,19 +26,18 @@ local_repository(
path = "..",
)

# Needed because protobuf_deps brings rules_python 0.26.0 which is broken:
# https://github.com/bazelbuild/rules_python/issues/1543
http_archive(
name = "rules_python",
sha256 = "5868e73107a8e85d8f323806e60cad7283f34b32163ea6ff1020cf27abef6036",
strip_prefix = "rules_python-0.25.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.0.tar.gz",
)

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

protobuf_deps()

load("@com_google_protobuf//:protobuf_extra_deps.bzl", "protobuf_extra_deps")
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")

rules_java_dependencies()

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

rules_java_toolchains()

load("@rules_python//python:repositories.bzl", "py_repositories")

protobuf_extra_deps()
py_repositories()
24 changes: 17 additions & 7 deletions protobuf_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
load("@com_google_protobuf//:protobuf_extra_deps.bzl", "protobuf_extra_deps")
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
protobuf_extra_deps();
rules_java_dependencies()
load("@rules_java//java:repositories.bzl", "rules_java_toolchains")
rules_java_toolchains()
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
```
"""

Expand Down Expand Up @@ -111,8 +119,10 @@ def protobuf_deps():
if not native.existing_rule("rules_java"):
http_archive(
name = "rules_java",
url = "https://github.com/bazelbuild/rules_java/releases/download/8.3.2/rules_java-8.3.2.tar.gz",
sha256 = "9b9614f8a7f7b7ed93cb7975d227ece30fe7daed2c0a76f03a5ee37f69e437de",
urls = [
"https://github.com/bazelbuild/rules_java/releases/download/8.6.1/rules_java-8.6.1.tar.gz",
],
sha256 = "c5bc17e17bb62290b1fd8fdd847a2396d3459f337a7e07da7769b869b488ec26",
)

if not native.existing_rule("rules_shell"):
Expand All @@ -129,9 +139,9 @@ def protobuf_deps():
if not native.existing_rule("rules_python"):
http_archive(
name = "rules_python",
sha256 = "d70cd72a7a4880f0000a6346253414825c19cdd40a28289bdf67b8e6480edff8",
strip_prefix = "rules_python-0.28.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.28.0/rules_python-0.28.0.tar.gz",
sha256 = "4f7e2aa1eb9aa722d96498f5ef514f426c1f55161c3c9ae628c857a7128ceb07",
strip_prefix = "rules_python-1.0.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/1.0.0/rules_python-1.0.0.tar.gz",
)

if not native.existing_rule("system_python"):
Expand Down
31 changes: 0 additions & 31 deletions protobuf_extra_deps.bzl

This file was deleted.

0 comments on commit af8234b

Please sign in to comment.