fix: Bazel 9 compatibility (bump to 0.22.0) and export toolchain_type#281
Draft
nicdumz wants to merge 1 commit into
Draft
fix: Bazel 9 compatibility (bump to 0.22.0) and export toolchain_type#281nicdumz wants to merge 1 commit into
nicdumz wants to merge 1 commit into
Conversation
Bump jsonnet and jsonnet_go 0.21.0 -> 0.22.0. Under Bazel 9 the source-built compilers fail to configure (issue bazel-contrib#278): the 0.21.0 C++ sources' BUILD files use bare cc_library/cc_binary/cc_test, which Bazel 9 removed and no longer auto-provides, and jsonnet_go 0.21.0 pins rules_go 0.53.0 whose cgo.bzl references the removed CcInfo symbol, so @go_toolchains fails to load for any target. The 0.22.0 releases already load() the cc rules from @rules_cc and pull rules_go 0.59.0, gazelle 0.47.0, and rules_cc, all Bazel-9 clean. Also make //jsonnet:toolchain_type public so a downstream module can register its own Jsonnet toolchain (e.g. a prebuilt compiler) without patching rules_jsonnet. Verified on Bazel 9.1.0: examples/ builds and tests pass with both the cpp and go compilers (25/25 each), with no --incompatible_autoload_externally.
nicdumz
marked this pull request as draft
July 13, 2026 09:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #278.
Bazel 9 compatibility (dep bump)
On Bazel 9 the source-built Jsonnet compilers fail to configure:
jsonnet0.21.0 C++ sources'BUILDfiles (@jsonnet//core,@jsonnet//cmd) use barecc_library/cc_binary/cc_test, which Bazel 9 removed and no longer auto-provides:jsonnet_go0.21.0 pinsrules_go0.53.0, whosego/private/rules/cgo.bzlreferences the removedCcInfosymbol, so@go_toolchains//:allfails to load during toolchain resolution for any target (even when thecppcompiler is selected, becausejsonnet_gois an unconditional dep).Bumping
jsonnetandjsonnet_goto0.22.0fixes both: the v0.22.0 C++BUILDfiles alreadyload("@rules_cc//cc:...", ...), andjsonnet_go0.22.0 pullsrules_go0.59.0,gazelle0.47.0, andrules_cc— all Bazel-9 clean.This is the same bump proposed in #272, #273, and #274, and validated green in #275 — thanks to those authors. This PR folds it together with the toolchain-type change below into one self-contained fix; happy to rebase and drop the bump hunk if one of those merges first.
Expose
//jsonnet:toolchain_typetoolchain_typehad novisibility, so it defaulted to private. A downstream module that wants to register its own Jsonnet toolchain (e.g. a prebuilt compiler binary, to avoid building the compiler from source) cannot reference@rules_jsonnet//jsonnet:toolchain_typewithout patching this repo. Making it public is consistent with the*_jsonnet_toolchaintargets, which are already public.Verification
On Bazel 9.1.0,
examples/builds and tests pass with both compilers, with no--incompatible_autoload_externally: