Skip to content

Commit

Permalink
chore: add Bazel 8 testing (#39)
Browse files Browse the repository at this point in the history
* chore: add Bazel 8 testing

* fix: revert rules_uv upgrade

* chore: rules_proto leaked another setup routine for WORKSPACE users

* PYSTAR is now required

* chore: reduce delta

* fix: add a rules_java dependency that protobuf is leaking

* chore: give up on bazel8 without bzlmod

Revert WORKSPACE-only changes

* fix: disable Java toolchain which is causing C++ compiles

* disable python too
  • Loading branch information
alexeagle authored Jan 16, 2025
1 parent 5d9e196 commit 56b554d
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .bcr/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ bcr_test_module:
module_path: "e2e/smoke"
matrix:
platform: ["debian10", "macos", "ubuntu2004", "windows"]
bazel: ["7.x"]
bazel: ["7.x", "8.x"]
tasks:
run_tests:
name: "Run test module"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ concurrency:

jobs:
test:
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v6
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@646899086d7aaee8e532540480f3e91e00596234 # Dec 11 2024
with:
folders: '[".", "e2e/smoke", "examples"]'
exclude: |
[
{"bazelversion": "6.4.0"},
{"folder": ".", "bzlmodEnabled": false},
{"folder": "examples", "bzlmodEnabled": false},
{"folder": ".", "os": "windows-latest"}
{"bazelversion": "8.0.0", "bzlmodEnabled": false},
]
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module(

bazel_dep(name = "bazel_features", version = "1.9.0")
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_proto", version = "6.0.0")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "platforms", version = "0.0.10")

bazel_dep(name = "aspect_bazel_lib", version = "2.8.1", dev_dependency = True)
Expand Down
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
# Pre-built protoc toolchain for Bazel 7

> [!CAUTION]
> Bazel 8 and recent rules_proto changes broke this toolchain.
> We don't currently have any plans to address this.
> Instead, we expect someone on the protobuf team to follow through with the
> "End Goal" promised in https://protobuf.dev/news/2024-10-01/
> where this functionality is upstreamed.
> Follow https://github.com/protocolbuffers/protobuf/issues/19558
# Pre-built protoc toolchain for Bazel

_#NeverCompileProtocAgain_

Expand Down
1 change: 1 addition & 0 deletions e2e/smoke/.bazelversion
2 changes: 1 addition & 1 deletion e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bazel_dep(name = "toolchains_protoc", version = "0.0.0")
bazel_dep(name = "rules_proto", version = "6.0.0-rc2")
bazel_dep(name = "rules_proto", version = "7.1.0")

local_path_override(
module_name = "toolchains_protoc",
Expand Down
3 changes: 0 additions & 3 deletions examples/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
common --incompatible_enable_proto_toolchain_resolution
common --@aspect_rules_py//py:interpreter_version=3.9.18

# See https://github.com/bazelbuild/rules_python/issues/1069#issuecomment-1942053014
common --action_env=RULES_PYTHON_ENABLE_PYSTAR=0

# Force rules_go to disable CGO even though we have a (fake) C++ toolchain registered.
common --host_platform=//tools:no_cgo_host_platform
1 change: 0 additions & 1 deletion examples/.bazelversion

This file was deleted.

1 change: 1 addition & 0 deletions examples/.bazelversion
23 changes: 14 additions & 9 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load("@rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_python//python:proto.bzl", "py_proto_library")

package(default_visibility = ["//visibility:public"])

Expand All @@ -10,15 +9,21 @@ proto_library(
deps = ["@com_google_protobuf//:any_proto"],
)

py_proto_library(
name = "foo_py_proto",
deps = [":foo_proto"],
)
# Broken because rules_python's py_proto_library doesnt produce the same
# PyInfo symbol that py_test expects.
# load("@rules_python//python:proto.bzl", "py_proto_library")
# py_proto_library(
# name = "foo_py_proto",
# deps = [":foo_proto"],
# )

java_proto_library(
name = "foo_java_proto",
deps = [":foo_proto"],
)
# Broken by https://github.com/protocolbuffers/protobuf/pull/19679
# which causes building C++ code from source.
# TODO: re-enable once protobuf honors the toolchain
# java_proto_library(
# name = "foo_java_proto",
# deps = [":foo_proto"],
# )

go_proto_library(
name = "foo_go_proto",
Expand Down
13 changes: 7 additions & 6 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
bazel_dep(name = "toolchains_protoc", version = "0.0.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.8.1")
bazel_dep(name = "aspect_rules_py", version = "0.7.1")
bazel_dep(name = "rules_java", version = "7.6.5")
bazel_dep(name = "rules_proto", version = "6.0.0")
bazel_dep(name = "rules_python", version = "0.32.2")
bazel_dep(name = "rules_go", version = "0.48.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.11.0")
bazel_dep(name = "aspect_rules_py", version = "1.0.0")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_java", version = "8.6.3")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "rules_python", version = "1.0.0")
bazel_dep(name = "rules_go", version = "0.52.0")
bazel_dep(name = "rules_uv", version = "0.10.0")

# This example is in the same repo with the ruleset, so we should point to the code at HEAD
Expand Down
19 changes: 10 additions & 9 deletions examples/java/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
java_binary(
name = "java",
srcs = ["Main.java"],
main_class = "Main",
deps = [
"//:foo_java_proto",
"@protobuf-java//jar",
],
)
# See comment in examples/BUILD.bazel
# java_binary(
# name = "java",
# srcs = ["Main.java"],
# main_class = "Main",
# deps = [
# "//:foo_java_proto",
# "@protobuf-java//jar",
# ],
# )
11 changes: 6 additions & 5 deletions examples/python/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
py_test(
name = "message_test",
srcs = ["message_test.py"],
deps = ["//:foo_py_proto"],
)
# See comment in examples/BUILD.bazel
# py_test(
# name = "message_test",
# srcs = ["message_test.py"],
# deps = ["//:foo_py_proto"],
# )

0 comments on commit 56b554d

Please sign in to comment.