Commit 48e3d87
authored
Support Protobuf 33.4 w/ prebuilt protoc toolchain (#1803)
Replaces the `rules_scala` prebuilt `protoc` toolchain everywhere except
in a few `test_dependency_versions.sh` test cases. Updates `README.md`
to recommend using the `protobuf` prebuilt `protoc` toolchain, and
refactors and adds test cases to `test_dependency_versions.sh`.
Note that legacy `WORKSPACE` builds continue to use the `rules_scala`
prebuilt `protoc` toolchain, since the `protobuf` implementation only
supports Bzlmod.
After removing `protobuf.patch` files, updating `MODULE.bazel{,.lock}`
files, and updating Maven dependencies, the most significant changes for
supporting `protobuf` v33.4 are:
- `protoc/BUILD`, `protoc/private/protoc_toolchains.bzl`:
Moves `proto_lang_toolchain` from `@rules_scala_protoc_toolchains` to
`//protoc:scala_protoc_toolchain`. This can break users using
`rules_proto` < 7.0.0 and `protobuf` < v28.2, but `README.md` contains
a patch for such users.
- `protoc/private/toolchain_impl.bzl`:
Applies changes from the final state of protocolbuffers/protobuf#19679
and updates the prebuilt `protoc` toolchain resolution check and error
message.
- `test_dependency_versions.sh`, `deps/test/MODULE.bazel.template`,
`deps/test/protoc_toolchains.template`: Adds Bazel 9 and `protobuf`
prebuilt `protoc` toolchain test cases. Updates `do_build_and_test` to
support both toolchains. Extracts the `protoc_toolchains.template` to
include it only in test cases using the `rules_scala` toolchain.
Other key components of this change include:
- `protoc/BUILD`:
Aliases `@protobuf//bazel/toolchains:prefer_prebuilt_protoc` as
`@rules_scala//protoc:prefer_prebuilt_protoc`.
- `.bazelrc`, `tools/bazel.rc.buildkite`:
Adds `common --@rules_scala//protoc:prefer_prebuilt_protoc`.
- `.bazelci/presubmit.yml`, `.bcr/presubmit.yml`:
Adds `9.x` to the `bcr_bazel` matrix . Also applies whitespace and
quoting format changes to `.bazelci/presubmit.yml`.
Also contains these small, but important changes to fix continuous
integration breakages and `last_green` Bazel compatibility:
- `.github/workflows/release_prep.sh`:
Excludes `.bazelversion` symlinks, since per
bazelbuild/bazel-worker-api#21, these break Bazel as of
bazelbuild/bazel@f942a70.
- `MODULE.bazel`, `scala/private/macros/workspace_compat.bzl`:
Bumps `bazelbuild/bazel-worker-api` to v0.0.10 to fix `last_green`
builds per bazelbuild/bazel-worker-api#22.
- `test/shell/test_runner.sh`, `test/shell/test_bzlmod_macros.sh`:
Replaces `relative_path_to_parent` with `convert_msys2_path` for
bazelbuild/continuous-integration#2445, bazelbuild/bazel#28406.
It turns out @WojciechMazur patched this in #1794, but this change
supersedes the change from that pull request.
Other minor changes include:
- `MODULE.bazel`:
Removes the `version` parameter from the `module` declaration. The
Publish to BCR GitHub Actions workflow patches this parameter anyway.
See:
- https://bazel.build/external/faq#module-versioning-best-practices
- https://github.com/bazel-contrib/publish-to-bcr/blob/v1.1.0/src/domain/create-entry.ts#L176-L216
- https://bazelbuild.slack.com/archives/C014RARENH0/p1767892286188219
- Replaces `precompiled` with `prebuilt` in every reference to the
prebuilt `protoc` toolchain.
- `scala/toolchains_repo.bzl`:
Replaces `@@{rules_scala_repo}` references with plain `@rules_scala`
references, allowing repo mapping to do its thing.
- `test_dependency_version.sh`:
Skips non-prebuilt `protoc` prebuilt toolchain test cases from for
macOS on continuous integration. This test suite was taking a
disproportionately long time to run before adding the new test cases,
which Linux builds will continue to cover.
A summary of these changes excluding `README.md`, `protobuf.patch`,
`MODULE.bazel{,.lock}` files, and Maven dependency updates:
```txt
$ git diff --stat HEAD^ ':!README.md' ':!**MODULE.bazel*' \
':!**protobuf.patch' ':!third_party/repositories/scala_*'
.bazelci/presubmit.yml | 66 ++++++...
.bazelrc | 9 ++++--
.bcr/presubmit.yml | 2 +-
.github/workflows/release_prep.sh | 7 ++++-
WORKSPACE | 15 ++++++...
deps/test/protoc_toolchains.template | 12 ++++++++
protoc/BUILD | 20 ++++++...
protoc/private/protoc_integrity.bzl | 10 +++++++
protoc/private/protoc_toolchains.bzl | 19 +++---...
protoc/private/toolchain_impl.bzl | 30 ++++++...
protoc/toolchains.bzl | 2 +-
scala/extensions/protoc.bzl | 8 +++---
scala/latest_deps.bzl | 8 ++----
scala/private/macros/test/MODULE.bzlmod_test | 8 +++++-
scala/private/macros/test/MODULE.bzlmod_test_root_module | 8 +++++-
scala/private/macros/workspace_compat.bzl | 6 ++--
scala/toolchains.bzl | 5 +++-
scala/toolchains_repo.bzl | 26 ++++++...
scala_proto/scala_proto_toolchain.bzl | 2 ++
scripts/create_repository.py | 2 +-
scripts/update_protoc_integrity.py | 6 ++--
test/shell/test_bzlmod_macros.sh | 23 ++++--...
test/shell/test_runner.sh | 34 ++++++...
test_dependency_versions.sh | 151 ++++++...
test_version.sh | 2 --
tools/bazel.rc.buildkite | 9 ++++--
26 files changed, 317 insertions(+), 173 deletions(-)
```
---
In the following Bazel Slack thread, @rafikk pointed out the apparent
incompatibility with the new Bazel 9.0.0 release:
- https://bazelbuild.slack.com/archives/CDCKJ2KFZ/p1768383285232129
- https://github.com/bazelbuild/bazel/releases/tag/9.0.0
This happened because Bazel 9 now sets
`--incompatible_enable_proto_toolchain_resolution` by default:
- https://bazel.build/reference/command-line-reference#flag--incompatible_enable_proto_toolchain_resolution
Since the `scala_proto` implementation depends on this flag, this broke
projects that didn't configure the `rules_scala` prebuilt `protoc`
toolchain. This change fixes that problem while ensuring seamless
compatibility with the `protobuf` v33.4 prebuilt protoc toolchain.
---
Also, Bazel 10.0.0-pre.20251208.3 selects the prebuilt `protoc`
toolchain, and 10.0.0-pre.20251217.3 doesn't. See:
- protocolbuffers/protobuf#255611 parent 1851877 commit 48e3d87
File tree
85 files changed
+1544
-893
lines changed- .bazelci
- .bcr
- .github/workflows
- deps
- latest
- test
- dt_patches
- test_dt_patches_user_srcjar
- test_dt_patches
- examples
- crossbuild
- overridden_artifacts
- scala3
- semanticdb
- testing
- multi_frameworks_toolchain
- scalatest_repositories
- specs2_junit_repositories
- twitter_scrooge
- protoc
- private
- scala_proto
- scala
- extensions
- private/macros
- test
- scripts
- test_cross_build
- test_version
- test
- compiler_sources_integrity
- shell
- third_party
- repositories
- test
- example_external_workspace
- proto
- tools
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
85 files changed
+1544
-893
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
147 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
49 | | - | |
50 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 57 | | |
61 | 58 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 59 | + | |
65 | 60 | | |
66 | 61 | | |
67 | 62 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 63 | + | |
76 | 64 | | |
77 | 65 | | |
78 | 66 | | |
| |||
100 | 88 | | |
101 | 89 | | |
102 | 90 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | 91 | | |
109 | 92 | | |
110 | 93 | | |
111 | 94 | | |
112 | 95 | | |
113 | 96 | | |
114 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
115 | 101 | | |
116 | 102 | | |
117 | 103 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments