Skip to content

Commit 56b554d

Browse files
authored
chore: add Bazel 8 testing (#39)
* 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
1 parent 5d9e196 commit 56b554d

File tree

12 files changed

+45
-48
lines changed

12 files changed

+45
-48
lines changed

.bcr/presubmit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ bcr_test_module:
22
module_path: "e2e/smoke"
33
matrix:
44
platform: ["debian10", "macos", "ubuntu2004", "windows"]
5-
bazel: ["7.x"]
5+
bazel: ["7.x", "8.x"]
66
tasks:
77
run_tests:
88
name: "Run test module"

.github/workflows/ci.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ concurrency:
1818

1919
jobs:
2020
test:
21-
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v6
21+
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@646899086d7aaee8e532540480f3e91e00596234 # Dec 11 2024
2222
with:
2323
folders: '[".", "e2e/smoke", "examples"]'
2424
exclude: |
2525
[
26-
{"bazelversion": "6.4.0"},
2726
{"folder": ".", "bzlmodEnabled": false},
2827
{"folder": "examples", "bzlmodEnabled": false},
29-
{"folder": ".", "os": "windows-latest"}
28+
{"bazelversion": "8.0.0", "bzlmodEnabled": false},
3029
]

MODULE.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module(
88

99
bazel_dep(name = "bazel_features", version = "1.9.0")
1010
bazel_dep(name = "bazel_skylib", version = "1.4.1")
11-
bazel_dep(name = "rules_proto", version = "6.0.0")
11+
bazel_dep(name = "rules_proto", version = "7.1.0")
1212
bazel_dep(name = "platforms", version = "0.0.10")
1313

1414
bazel_dep(name = "aspect_bazel_lib", version = "2.8.1", dev_dependency = True)

README.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# Pre-built protoc toolchain for Bazel 7
2-
3-
> [!CAUTION]
4-
> Bazel 8 and recent rules_proto changes broke this toolchain.
5-
> We don't currently have any plans to address this.
6-
> Instead, we expect someone on the protobuf team to follow through with the
7-
> "End Goal" promised in https://protobuf.dev/news/2024-10-01/
8-
> where this functionality is upstreamed.
9-
> Follow https://github.com/protocolbuffers/protobuf/issues/19558
1+
# Pre-built protoc toolchain for Bazel
102

113
_#NeverCompileProtocAgain_
124

e2e/smoke/.bazelversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.bazelversion

e2e/smoke/MODULE.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
bazel_dep(name = "toolchains_protoc", version = "0.0.0")
2-
bazel_dep(name = "rules_proto", version = "6.0.0-rc2")
2+
bazel_dep(name = "rules_proto", version = "7.1.0")
33

44
local_path_override(
55
module_name = "toolchains_protoc",

examples/.bazelrc

-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
common --incompatible_enable_proto_toolchain_resolution
33
common --@aspect_rules_py//py:interpreter_version=3.9.18
44

5-
# See https://github.com/bazelbuild/rules_python/issues/1069#issuecomment-1942053014
6-
common --action_env=RULES_PYTHON_ENABLE_PYSTAR=0
7-
85
# Force rules_go to disable CGO even though we have a (fake) C++ toolchain registered.
96
common --host_platform=//tools:no_cgo_host_platform

examples/.bazelversion

-1
This file was deleted.

examples/.bazelversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.bazelversion

examples/BUILD.bazel

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
load("@rules_go//proto:def.bzl", "go_proto_library")
22
load("@rules_proto//proto:defs.bzl", "proto_library")
3-
load("@rules_python//python:proto.bzl", "py_proto_library")
43

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

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

13-
py_proto_library(
14-
name = "foo_py_proto",
15-
deps = [":foo_proto"],
16-
)
12+
# Broken because rules_python's py_proto_library doesnt produce the same
13+
# PyInfo symbol that py_test expects.
14+
# load("@rules_python//python:proto.bzl", "py_proto_library")
15+
# py_proto_library(
16+
# name = "foo_py_proto",
17+
# deps = [":foo_proto"],
18+
# )
1719

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

2328
go_proto_library(
2429
name = "foo_go_proto",

examples/MODULE.bazel

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
bazel_dep(name = "toolchains_protoc", version = "0.0.0")
2-
bazel_dep(name = "aspect_bazel_lib", version = "2.8.1")
3-
bazel_dep(name = "aspect_rules_py", version = "0.7.1")
4-
bazel_dep(name = "rules_java", version = "7.6.5")
5-
bazel_dep(name = "rules_proto", version = "6.0.0")
6-
bazel_dep(name = "rules_python", version = "0.32.2")
7-
bazel_dep(name = "rules_go", version = "0.48.0")
2+
bazel_dep(name = "aspect_bazel_lib", version = "2.11.0")
3+
bazel_dep(name = "aspect_rules_py", version = "1.0.0")
4+
bazel_dep(name = "platforms", version = "0.0.11")
5+
bazel_dep(name = "rules_java", version = "8.6.3")
6+
bazel_dep(name = "rules_proto", version = "7.1.0")
7+
bazel_dep(name = "rules_python", version = "1.0.0")
8+
bazel_dep(name = "rules_go", version = "0.52.0")
89
bazel_dep(name = "rules_uv", version = "0.10.0")
910

1011
# This example is in the same repo with the ruleset, so we should point to the code at HEAD

examples/java/BUILD

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
java_binary(
2-
name = "java",
3-
srcs = ["Main.java"],
4-
main_class = "Main",
5-
deps = [
6-
"//:foo_java_proto",
7-
"@protobuf-java//jar",
8-
],
9-
)
1+
# See comment in examples/BUILD.bazel
2+
# java_binary(
3+
# name = "java",
4+
# srcs = ["Main.java"],
5+
# main_class = "Main",
6+
# deps = [
7+
# "//:foo_java_proto",
8+
# "@protobuf-java//jar",
9+
# ],
10+
# )

examples/python/BUILD

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
py_test(
2-
name = "message_test",
3-
srcs = ["message_test.py"],
4-
deps = ["//:foo_py_proto"],
5-
)
1+
# See comment in examples/BUILD.bazel
2+
# py_test(
3+
# name = "message_test",
4+
# srcs = ["message_test.py"],
5+
# deps = ["//:foo_py_proto"],
6+
# )

0 commit comments

Comments
 (0)