You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates `README.md` to explain why this requirement exists, and why
Bazel 6.5.0 is capped at `protobuf` v29 in general, even without
protocol compiler toolchainization. Removes the `v28.2` and `v28.3`
entries from `scripts/update_protoc_integrity.py` and
`protoc/private/protoc_integrity.bzl`.
I tried several things to get it to work with `protobuf` v28.2, as
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.
Without `--incompatible_enable_proto_toolchain_resolution`, everything
still worked (i.e., `bazel build` compiled `protoc` and finished
successfully). But there's no point in keeping any of the new patches
or flags if `--incompatible_enable_proto_toolchain_resolution` still
breaks.
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.
0 commit comments