Repository navigation
fix(toolchains): use target Python version for exec tools on Bazel 10 - #4335
Merged
Merged
Conversation
Bazel 10 resets Starlark flags in exec configurations unless they have universal scope, so exec tools such as the precompiler used the default Python version instead of the target's. Give the python_version flag universal scope, and run the integration tests with Bazel 10.0.0rc2. Fixes bazel-contrib#3566 Fixes bazel-contrib#3613 Work towards bazel-contrib#3581
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.
Bazel 10 enables
--incompatible_exclude_starlark_flags_from_exec_configby default(bazelbuild/bazel#26909), which resets Starlark flags to their defaults
in the exec configuration unless they set
scope = "universal". The//python/config_settings:python_versionflag had no scope, so exectools, such as the precompiler, ran with the default Python version
instead of the target's, e.g. compiling pyc files for the wrong Python
version.
To fix, give the
python_versionflag universal scope so its valuereaches the exec configuration again, as it did before Bazel 10. The
flag target sets the scope explicitly because Bazel ignores rule-level
scope defaults for flags set on the command line
(bazelbuild/bazel#31806).
Along the way, run the bazel-in-bazel integration tests with Bazel
10.0.0rc2, accept Bazel 10's reworded "no matching toolchains" error
in an integration test, and disable
--incompatible_no_implicit_file_exportin the gazelle dev workspacebecause the pinned rules_go version isn't compatible with it.
Fixes #3566
Fixes #3613
Work towards #3581