-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Motivation
Part of Starlarkify native Bazel flags: move language flags out of Bazel and into the rule's .bzl definitions. This gives rules owners more ownership over their logic.
This Starlarkifies https://github.com/bazel-contrib/rules_python flags.
This removes ctx.fragments.py. See #27080 for similar flag for ctx.fragments.bazel_py.
Description
When flipped, ctx.fragments.py no longer exists. A new rules_python release uses that as signal to read its flags from Starlark definitions in the rules_python repo.
This is meant to be a user no-op. But there are some small differences meriting an incompatible flip:
$ bazel build //foo --flag valueno longer works. You must now set$ bazel build //foo --flag=value.- Your repo must load
rules_pythonfor Python flags to resolve. This should already be true for Python builds, but maybe not, e.g., for agenrulethetselect()s on a Python flag. It might also be true universally so this might not be a real effect. - If you have your own
.bzlcode that readsctx.fragments.py, you need to change it to read equivalentrules_python-defined Starlark flags. Comment here for details. $ bazel help flags-as-protono longer shows Python flags.
This only affects Bazel 9+. Older Bazel continue to work with any version of rules_python (both old and new).
Incompatible Flag
--incompatible_remove_ctx_py_fragment
Migration Guide
If using Bazel 9.0+: update to a recent rules_python version that supports Starlark-based flags. Release info TBD.
If using Bazel <9.0: no action needed.
In which Bazel LTS version will this incompatible change be enabled?
Bazel 9
TODO List
- Prepare
rules_pythonrelease that supports Starlark flags - Flip flag