Skip to content

Commit ab5d5b0

Browse files
committed
Bazel 8 + rules_java 8 updates, protoc toolchain
Bumps dependencies to versions that are compatible with both Bazel 7.5.0 and 8.0.0, and adds protocol compiler toolchainization in `//protoc` for `protobuf` v29 and later. Closes bazel-contrib#1652. Part of bazel-contrib#1482. - ScalaPB jars: 0.11.17 => 1.0.0-alpha.1 - Scalafmt: 3.9.2 => 3.9.3 - `rules_python`: 0.38.0 => 1.2.0 - `rules_cc`: 0.0.9 => 0.1.1 - `rules_java`: 7.12.4 => 8.10.0 - `protobuf`: 21.7 => 30.0 - `rules_proto`: 6.0.2 => 7.1.0 Bazel 6 is officially unsupported as of this change and the upcoming `rules_scala` 7.0.0 release. Updates `.bazelci/presubmit.yml` to bump the `7.x` build to `last_rc`. Registers a precompiled protocol compiler toolchain when `--incompatible_enable_proto_toolchain_resolution` is `True`. Otherwise, `register_toolchains(//protoc:all)` toolchains is a no-op, as it will be empty. `scripts/update_protoc_integrity.py` automatically updates `scala/private/protoc/protoc_integrity.bzl`. The `protobuf` patch is the `git diff` output from protocolbuffers/protobuf#19679, which also inspired the updates to `scala_proto/scala_proto_toolchain.bzl`. The `proto_lang_toolchain` call in the `BUILD` file generated by `protoc/private/protoc_toolchain.bzl` was inspired by the `README` from: - https://github.com/aspect-build/toolchains_protoc/ Loads `java_proto_library` from `com_google_protobuf`, replacing the officially deprecated version from `rules_java`. Bumps Scalafmt to 3.9.3 out of convenience. Updates to `README.md`, and updates to `WORKSPACE` and `third_party/repositories` files precipitated by the dependency updates, comprise the remainder of this change. --- We're no longer planning to support Bazel 6 in the next major release per @simuons's decision in: - bazel-contrib#1482 (comment) The plan is now to land the Bazel 7 and 8 compatibility updates first, then land the Bzlmod change. This enables us to make only one new major version release, instead of two (whereby the first release would've continued supporting Bazel 6). It turns out the two major version plan wouldn't've been possible. Bazel 8 and `rules_java` 8 require `protobuf` >= v29, but this bump caused Windows builds to break when compiling `protoc` in bazel-contrib#1710. `src/google/protobuf/compiler/java/java_features.pb.h`, the path specified in the error message, doesn't exist until `protobuf` v25.0. @crt-31 and I found that this was related to the Windows/MSVC 260 character file path length limit. What's more, the `protobuf` team plans to drop MSVC support specifically because of this path length limit. The protocol compiler toolchain prevents `protoc` recompilation, which fixes the Windows breakage while making all builds faster. Since Windows builds break since at least `protobuf` v25, but `protoc` toolchainization requires v29, the version bump and the `protoc` toolchain must land together. --- I tried several things to get protocol compiler toolchainization to work with `protobuf` v28.2, described below. However, each path only led to the same suffering described in the new "Why this requires `protobuf` v29 or later" section of the README. I discovered along the way that `protobuf` v30 isn't compatible with Bazel 6.5.0 at all. I added an explanation to the "Limited Bazel 6.5.0 compatibility" section of `README.md`. --- I experimented with using `protobuf` v28.2, `rules_proto` 6.0.2, and `rules_java` 7.12.4 and 8.10.0. I updated the `protobuf` patch for v28.2 with the following statements: ```py load("//bazel/common:proto_common.bzl", "proto_common") load("@rules_proto//proto:proto_common.bzl", "toolchains") _PROTO_TOOLCHAIN = "@rules_proto//proto:toolchain_type" _PROTO_TOOLCHAIN_ATTR = "INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION" _PROTOC_TOOLCHAINS = toolchains.use_toolchain(_PROTO_TOOLCHAIN) def _protoc_files_to_run(ctx): if getattr(proto_common, _PROTO_TOOLCHAIN_ATTR, False): ``` I updated `protoc/private/protoc_toolchain.bzl` to use `proto_common` from `rules_proto`. I also created a `rules_proto` 6.0.2 patch for `proto_toolchain()` to fix a "no such package: //proto" breakage: ```diff 6.0.2 patch for `proto_toolchain()`: ```diff diff --git i/proto/private/rules/proto_toolchain.bzl w/proto/private/rules/proto_toolchain.bzl index a091b80..def2699 100644 --- i/proto/private/rules/proto_toolchain.bzl +++ w/proto/private/rules/proto_toolchain.bzl @@ -33,7 +33,7 @@ def proto_toolchain(*, name, proto_compiler, exec_compatible_with = []): native.toolchain( name = name + "_toolchain", - toolchain_type = "//proto:toolchain_type", + toolchain_type = Label("//proto:toolchain_type"), exec_compatible_with = exec_compatible_with, target_compatible_with = [], toolchain = name, ``` I tried adding combinations of the following `--incompatible_autoload_externally` flag values to .bazelrc`: ```txt common --incompatible_autoload_externally=+@protobuf,+@rules_java ``` Nothing worked. --- After the `protobuf` v29 bump, and before the ScalaPB 1.0.0-alpha.1 bump, `scala_proto` targets would fail with the following error: ```txt ERROR: .../external/com_google_protobuf/src/google/protobuf/BUILD.bazel:23:14: ProtoScalaPBRule external/com_google_protobuf/src/google/protobuf/any_proto_jvm_extra_protobuf_generator_scalapb.srcjar failed: (Exit 1): scalapb_worker failed: error executing ProtoScalaPBRule command (from target @@com_google_protobuf//src/google/protobuf:any_proto) bazel-out/.../bin/src/scala/scripts/scalapb_worker ... (remaining 2 arguments skipped) --jvm_extra_protobuf_generator_out: java.lang.NoSuchMethodError: 'java.lang.Object com.google.protobuf.DescriptorProtos$FieldOptions.getExtension(com.google.protobuf.GeneratedMessage$GeneratedExtension)' at scalapb.compiler.DescriptorImplicits$ExtendedFieldDescriptor.fieldOptions(DescriptorImplicits.scala:329) [ ...snip... ] java.lang.RuntimeException: Exit with code 1 at scala.sys.package$.error(package.scala:30) at scripts.ScalaPBWorker$.work(ScalaPBWorker.scala:44) at io.bazel.rulesscala.worker.Worker.persistentWorkerMain(Worker.java:96) at io.bazel.rulesscala.worker.Worker.workerMain(Worker.java:49) at scripts.ScalaPBWorker$.main(ScalaPBWorker.scala:39) at scripts.ScalaPBWorker.main(ScalaPBWorker.scala) ERROR: .../external/com_google_protobuf/src/google/protobuf/BUILD.bazel:23:14 Building source jar external/com_google_protobuf/src/google/protobuf/any_proto_scalapb-src.jar failed: (Exit 1): scalapb_worker failed: error executing ProtoScalaPBRule command (from target @@com_google_protobuf//src/google/protobuf:any_proto) bazel-out/darwin_arm64-opt-exec-ST-a828a81199fe/bin/src/scala/scripts/scalapb_worker ... (remaining 2 arguments skipped) ```
1 parent 11d3b32 commit ab5d5b0

File tree

43 files changed

+1401
-329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1401
-329
lines changed

.bazelci/presubmit.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ tasks:
2929
# Install xmllint
3030
- sudo apt update && sudo apt install --reinstall libxml2-utils -y
3131
- "./test_rules_scala.sh"
32-
test_rules_scala_linux_latest:
33-
name: "./test_rules_scala (latest Bazel)"
32+
# Switch `last_rc` to `last_green` once Bzlmod lands.
33+
# https://github.com/bazelbuild/rules_scala/issues/1482
34+
test_rules_scala_linux_last_rc:
35+
name: "./test_rules_scala (last_rc Bazel)"
3436
platform: ubuntu2004
35-
# Restore `bazel: latest` once Bazel 8 compatibility lands (#1625, #1652).
36-
bazel: 7.x
37+
bazel: last_rc
3738
shell_commands:
3839
# Install xmllint
3940
- sudo apt update && sudo apt install --reinstall libxml2-utils -y
4041
- echo "build --enable_workspace" >> .bazelrc
41-
- "./test_rules_scala.sh || buildkite-agent annotate --style 'warning' \"Optional build with latest Bazel version failed, [see here](${BUILDKITE_BUILD_URL}#${BUILDKITE_JOB_ID}) (It is not mandatory but worth checking)\""
42+
- "./test_rules_scala.sh || buildkite-agent annotate --style 'warning' \"Optional build with last_rc Bazel version failed, [see here](${BUILDKITE_BUILD_URL}#${BUILDKITE_JOB_ID}) (It is not mandatory but worth checking)\""
4243
test_rules_scala_macos:
4344
name: "./test_rules_scala"
4445
platform: macos

.bazelrc

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
# Switch to --noenable_workspace when Bzlmod lands.
2+
# https://github.com/bazelbuild/rules_scala/issues/1482
3+
common --enable_workspace --noenable_bzlmod
4+
5+
# Remove once proto toolchainization becomes the default
6+
# - https://bazel.build/reference/command-line-reference#flag--incompatible_enable_proto_toolchain_resolution
7+
# - https://docs.google.com/document/d/1CE6wJHNfKbUPBr7-mmk_0Yo3a4TaqcTPE0OWNuQkhPs/edit
8+
common --incompatible_enable_proto_toolchain_resolution
9+
110
build --enable_platform_specific_config
211

312
#Windows needs --worker_quit_after_build due to workers not being shut down when the compiler tools need to be rebuilt (resulting in 'file in use' errors). See Bazel Issue#10498.
413

514
build:windows --worker_quit_after_build --enable_runfiles
6-
7-
# Switch to --noenable_workspace when Bzlmod lands.
8-
# https://github.com/bazelbuild/rules_scala/issues/1482
9-
common --enable_workspace --noenable_bzlmod

.scalafmt.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "3.9.2"
1+
version = "3.9.3"
22
runner.dialect = scala213
33
align.openParenCallSite = false
44
align.openParenDefnSite = false

README.md

+227-15
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,20 @@ load("@rules_scala//scala:deps.bzl", "rules_scala_dependencies")
6565

6666
rules_scala_dependencies()
6767

68-
# In `rules_scala` 7.x, `scala/deps.bzl` imports `rules_java` 7.x. This
69-
# statement will change for `rules_scala` 8.x, which will use `rules_java` 8.x.
70-
load(
71-
"@rules_java//java:repositories.bzl",
72-
"rules_java_dependencies",
73-
"rules_java_toolchains",
74-
)
68+
# Only include the next two statements if using
69+
# `--incompatible_enable_proto_toolchain_resolution`.
70+
# See the "Using a precompiled protocol compiler" section below.
71+
load("@platforms//host:extension.bzl", "host_platform_repo")
72+
73+
# Instantiates the `@host_platform` repo to work around:
74+
# - https://github.com/bazelbuild/bazel/issues/22558
75+
host_platform_repo(name = "host_platform")
76+
77+
# This is optional, but still safe to include even when not using
78+
# `--incompatible_enable_proto_toolchain_resolution`.
79+
register_toolchains("@rules_scala//protoc:all")
80+
81+
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
7582

7683
rules_java_dependencies()
7784

@@ -81,13 +88,11 @@ bazel_skylib_workspace()
8188

8289
# If you need a specific `rules_python` version, specify it here.
8390
# Otherwise you may get the version defined in the `com_google_protobuf` repo.
84-
# We use 0.38.0 to maintain compatibility with the combination of `protobuf`,
85-
# `rules_cc`, and related dependencies. This will change in rules_scala 7.0.0.
8691
http_archive(
8792
name = "rules_python",
88-
sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34",
89-
strip_prefix = "rules_python-0.38.0",
90-
url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz",
93+
sha256 = "2ef40fdcd797e07f0b6abda446d1d84e2d9570d234fddf8fcd2aa262da852d1c",
94+
strip_prefix = "rules_python-1.2.0",
95+
url = "https://github.com/bazelbuild/rules_python/releases/download/1.2.0/rules_python-1.2.0.tar.gz",
9196
)
9297

9398
load("@rules_python//python:repositories.bzl", "py_repositories")
@@ -103,6 +108,8 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
103108

104109
protobuf_deps()
105110

111+
load("@rules_java//java:repositories.bzl", "rules_java_toolchains")
112+
106113
rules_java_toolchains()
107114

108115
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
@@ -187,6 +194,163 @@ load(
187194
)
188195
```
189196

197+
### <a id="protoc"></a>Using a precompiled protocol compiler
198+
199+
`rules_scala` now supports the
200+
[`--incompatible_enable_proto_toolchain_resolution`][] flag when using
201+
[`protobuf` v29 or later](#why-proto-v29). When using this flag with the
202+
`MODULE.bazel` or `WORKSPACE` configurations below, `rules_scala` will use a
203+
precompiled protocol compiler binary by default.
204+
205+
[`--incompatible_enable_proto_toolchain_resolution`]: https://bazel.build/reference/command-line-reference#flag--incompatible_enable_proto_toolchain_resolution
206+
207+
__Windows builds now require using `protobuf` v29 or later with the precompiled
208+
protocol compiler toolchain.__ See the [Windows MSVC builds of protobuf broken
209+
by default](#protoc-msvc) section below for details.
210+
211+
#### Common setup
212+
213+
To set the flag in your `.bazelrc` file:
214+
215+
```txt
216+
common --incompatible_enable_proto_toolchain_resolution
217+
```
218+
219+
In both `MODULE.bazel` and `WORKSPACE`, add the following statement _before_ any
220+
other toolchain registrations. It's safe to include even when not using
221+
`--incompatible_enable_proto_toolchain_resolution`.
222+
223+
```py
224+
# MODULE.bazel or WORKSPACE
225+
register_toolchains("@rules_scala//protoc:all")
226+
```
227+
228+
#### Temporary required `protobuf` patch
229+
230+
At the moment, enabling protocol compiler toolchainization requires applying
231+
[protoc/0001-protobuf-19679-rm-protoc-dep.patch][]. It is the `git diff` output
232+
from the branch used to create protocolbuffers/protobuf#19679. Without it, a
233+
transitive dependency on `@com_google_protobuf//:protoc` remains, causing
234+
`protoc` to recompile even with the precompiled toolchain registered first.
235+
236+
[protoc/0001-protobuf-19679-rm-protoc-dep.patch]: ./protoc/0001-protobuf-19679-rm-protoc-dep.patch
237+
238+
If and when `protobuf` merges that pull request, or applies an equivalent fix,
239+
this patch will no longer be necessary.
240+
241+
#### Bzlmod setup
242+
243+
Applying the `protobuf` patch requires using [`single_version_override`][],
244+
which also requires that the patch be a regular file in your own repo. In other
245+
words, neither `@rules_scala//protoc:0001-protobuf-19679-rm-protoc-dep.patch`
246+
nor an [`alias`][] to it will work.
247+
248+
[`single_version_override`]: https://bazel.build/rules/lib/globals/module#single_version_override
249+
[`alias`]: https://bazel.build/reference/be/general#alias
250+
251+
Assuming you've copied the patch to a file called `protobuf.patch` in the root
252+
package of your repository, add the following to your `MODULE.bazel`:
253+
254+
```py
255+
# MODULE.bazel
256+
257+
# Required for protocol compiler toolchainization until resolution of
258+
# protocolbuffers/protobuf#19679.
259+
bazel_dep(
260+
name = "protobuf",
261+
version = "30.0",
262+
repo_name = "com_google_protobuf",
263+
)
264+
265+
single_version_override(
266+
module_name = "protobuf",
267+
version = "30.0",
268+
patches = ["//:protobuf.patch"],
269+
patch_strip = 1,
270+
)
271+
```
272+
273+
#### `WORKSPACE` setup
274+
275+
[`scala/deps.bzl`](./scala/deps.bzl) already applies the `protobuf` patch by
276+
default. If you need to apply it yourself, you can also copy it to your repo as
277+
described in the Bzlmod setup above. Then follow the example in `scala/deps.bzl`
278+
to apply it in your own `http_archive` call.
279+
280+
However, `WORKSPACE` must include the `host_platform_repo` snippet from
281+
[Getting started](#getting-started) to work around bazelbuild/bazel#22558:
282+
283+
```py
284+
# WORKSPACE
285+
load("@platforms//host:extension.bzl", "host_platform_repo")
286+
287+
# Instantiates the `@host_platform` repo to work around:
288+
# - https://github.com/bazelbuild/bazel/issues/22558
289+
host_platform_repo(name = "host_platform")
290+
```
291+
292+
#### <a id="why-proto-v29"></a>Why this requires `protobuf` v29 or later
293+
294+
Using `--incompatible_enable_proto_toolchain_resolution` with versions of
295+
`protobuf` before v29 causes build failures due to a missing internal Bazel
296+
dependency.
297+
298+
Bazel's builtin `bazel_java_proto_aspect` transitively depends on a toolchain
299+
with a [`toolchain_type`][] of `@rules_java//java/proto:toolchain_type`.
300+
Experimentation with `protobuf` v28.2 using both Bazel 6.5.0 and 7.5.0 led to
301+
the following error:
302+
303+
```txt
304+
ERROR: .../external/bazel_tools/src/main/protobuf/BUILD:28:15:
305+
in @@_builtins//:common/java/proto/java_proto_library.bzl%bazel_java_proto_aspect
306+
aspect on proto_library rule
307+
@@bazel_tools//src/main/protobuf:worker_protocol_proto:
308+
309+
Traceback (most recent call last):
310+
File "/virtual_builtins_bzl/common/java/proto/java_proto_library.bzl",
311+
line 53, column 53, in _bazel_java_proto_aspect_impl
312+
File "/virtual_builtins_bzl/common/proto/proto_common.bzl",
313+
line 364, column 17, in _find_toolchain
314+
Error in fail: No toolchains registered for
315+
'@rules_java//java/proto:toolchain_type'.
316+
317+
ERROR: Analysis of target
318+
'@@bazel_tools//src/main/protobuf:worker_protocol_proto' failed
319+
```
320+
321+
See bazelbuild/rules_scala#1710 for details of the experiment.
322+
323+
For `protobuf` v29.0, protocolbuffers/protobuf#18308 added the
324+
[`@protobuf//bazel/private/toolchains`][proto-private-tc] package and updated
325+
`protobuf_deps()` from `@protobuf//:protobuf_deps.bzl` to register it:
326+
327+
```py
328+
native.register_toolchains("//bazel/private/toolchains:all")
329+
```
330+
331+
[`toolchain_type`]: https://bazel.build/extending/toolchains#writing-rules-toolchains
332+
[proto-private-tc]: https://github.com/protocolbuffers/protobuf/blob/v29.0/bazel/private/toolchains/BUILD.bazel
333+
334+
protocolbuffers/protobuf#18435 then introduced
335+
[`java_source_toolchain_bazel7`][java-proto-tc] with the required
336+
`toolchain_type`.
337+
338+
[java-proto-tc]: https://github.com/protocolbuffers/protobuf/blob/v29.0/bazel/private/toolchains/BUILD.bazel#L50-L74
339+
340+
#### More background on protocol compiler toolchainization
341+
342+
- [Proto Toolchainisation Design Doc](
343+
https://docs.google.com/document/d/1CE6wJHNfKbUPBr7-mmk_0Yo3a4TaqcTPE0OWNuQkhPs/edit)
344+
345+
- [bazelbuild/bazel#7095: Protobuf repo recompilation sensitivity](
346+
https://github.com/bazelbuild/bazel/issues/7095)
347+
348+
- [bazelbuild/rules_proto#179: Implement proto toolchainisation](
349+
https://github.com/bazelbuild/rules_proto/issues/179)
350+
351+
- [rules_proto 6.0.0 release notes mentioning Protobuf Toolchainization](
352+
https://github.com/bazelbuild/rules_proto/releases/tag/6.0.0)
353+
190354
### Persistent workers
191355

192356
To run with a persistent worker (much faster), add the following to
@@ -646,6 +810,24 @@ http_archive(
646810
)
647811
```
648812

813+
### <a id="protoc-msvc"></a>Windows MSVC builds of `protobuf` broken by default
814+
815+
MSVC builds of recent `protobuf` versions started failing, as first noted in
816+
bazelbuild/rules_scala#1710. On top of that, `protobuf` is planning to stop
817+
supporting Bazel + MSVC builds per:
818+
819+
- [protocolbuffers/protobuf#12947: src build on windows not working](
820+
https://github.com/protocolbuffers/protobuf/issues/12947)
821+
822+
- [protobuf.dev News Announcements for Version 30.x:Poison MSVC + Bazel](
823+
https://protobuf.dev/news/v30/#poison-msvc--bazel)
824+
825+
- [protocolbuffers/protobuf#20085: Breaking Change: Dropping support for
826+
Bazel+MSVC](https://github.com/protocolbuffers/protobuf/issues/20085)
827+
828+
Enable [protocol compiler toolchainization](#protoc) to fix broken Windows
829+
builds by avoiding `@com_google_protobuf//:protoc` recompilation.
830+
649831
### Embedded resource paths no longer begin with `external/<repo_name>`
650832

651833
[Any program compiled with an external repo asset in its 'resources' attribute
@@ -768,9 +950,39 @@ with Bazel 6.5.0 won't work at all because [Bazel 6.5.0 doesn't support
768950
https://github.com/bazelbuild/rules_scala/issues/1482#issuecomment-2515496234).
769951

770952
At the moment, `WORKSPACE` builds mostly continue to work with Bazel 6.5.0, but
771-
not out of the box, and may break at any time. Per bazelbuild/rules_scala#1647,
772-
you must add the following flags to `.bazelrc`, required by the newer
773-
`abseil-cpp` version used by `protobuf`:
953+
not out of the box, and may break at any time. You will have to choose one of
954+
the following approaches to resolve `protobuf` compatibility issues.
955+
956+
First of all, you _must_ use `protobuf` v29 or earlier. `rules_scala` now uses
957+
v30 by default, which removes `py_proto_library` and other symbols that Bazel
958+
6.5.0 requires:
959+
960+
```txt
961+
ERROR: Traceback (most recent call last):
962+
File ".../external/bazel_tools/src/main/protobuf/BUILD",
963+
line 1, column 46, in <toplevel>
964+
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")
965+
966+
Error: file '@com_google_protobuf//:protobuf.bzl'
967+
does not contain symbol 'py_proto_library'
968+
969+
ERROR: .../src/java/io/bazel/rulesscala/worker/BUILD:3:13:
970+
no such target '@bazel_tools//src/main/protobuf:worker_protocol_java_proto':
971+
target 'worker_protocol_java_proto'
972+
not declared in package 'src/main/protobuf'
973+
defined by .../external/bazel_tools/src/main/protobuf/BUILD
974+
(Tip: use `query "@bazel_tools//src/main/protobuf:*"`
975+
to see all the targets in that package)
976+
and referenced by '//src/java/io/bazel/rulesscala/worker:worker'
977+
```
978+
979+
You may use protocol compiler toolchainization with `protobuf` v29 to avoid
980+
recompiling `protoc`. See the [Using a precompiled protocol compiler](#protoc)
981+
section for details.
982+
983+
Otherwise, per bazelbuild/rules_scala#1647, add the following flags to
984+
`.bazelrc` to compile the newer `abseil-cpp` versions used by newer `protobuf`
985+
versions:
774986

775987
```txt
776988
common --enable_platform_specific_config

WORKSPACE

+18-8
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@ load("//scala:deps.bzl", "rules_scala_dependencies")
55

66
rules_scala_dependencies()
77

8-
load(
9-
"@rules_java//java:repositories.bzl",
10-
"rules_java_dependencies",
11-
"rules_java_toolchains",
12-
)
8+
# Only include the next two statements if using
9+
# `--incompatible_enable_proto_toolchain_resolution`.
10+
load("@platforms//host:extension.bzl", "host_platform_repo")
11+
12+
# Instantiates the `@host_platform` repo to work around:
13+
# - https://github.com/bazelbuild/bazel/issues/22558
14+
host_platform_repo(name = "host_platform")
15+
16+
# This is optional, but still safe to include even when not using
17+
# `--incompatible_enable_proto_toolchain_resolution`.
18+
register_toolchains("//protoc:all")
19+
20+
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
1321

1422
rules_java_dependencies()
1523

@@ -19,9 +27,9 @@ bazel_skylib_workspace()
1927

2028
http_archive(
2129
name = "rules_python",
22-
sha256 = "ca2671529884e3ecb5b79d6a5608c7373a82078c3553b1fa53206e6b9dddab34",
23-
strip_prefix = "rules_python-0.38.0",
24-
url = "https://github.com/bazelbuild/rules_python/releases/download/0.38.0/rules_python-0.38.0.tar.gz",
30+
sha256 = "2ef40fdcd797e07f0b6abda446d1d84e2d9570d234fddf8fcd2aa262da852d1c",
31+
strip_prefix = "rules_python-1.2.0",
32+
url = "https://github.com/bazelbuild/rules_python/releases/download/1.2.0/rules_python-1.2.0.tar.gz",
2533
)
2634

2735
load("@rules_python//python:repositories.bzl", "py_repositories")
@@ -32,6 +40,8 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
3240

3341
protobuf_deps()
3442

43+
load("@rules_java//java:repositories.bzl", "rules_java_toolchains")
44+
3545
rules_java_toolchains()
3646

3747
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")

0 commit comments

Comments
 (0)