Starlarkify native Bazel flags #26521
Replies: 4 comments 2 replies
-
cc @meteorcloudy this would eventually allow us to remove |
Beta Was this translation helpful? Give feedback.
-
@bazelbuild/java-team @bazelbuild/google-rules-python-team @bazelbuild/python-team @bazelbuild/protobuf-team @bazelbuild/android @bazelbuild/rules_apple-team CC'ing because Bazel has native-defined flags in your language's domain. |
Beta Was this translation helpful? Give feedback.
-
+1 to the idea. How about an auto-loading type of thing to make the transition easier? As a rule author, if I add my own flag definition, there's now two sources trying to dictate the same behavior, but I have no way to disambiguate which is supposed to be preferred (preferred = "which came later in the CLI ordering", probably). Proposal:
The first makes the transition easy on users. The second makes it possible for rules to use the correct value. Follow a similar autoload rollout/semantics as was done for the core rules. IIRC:
Hm, is autoloading flags necessary if the "can detect which flag should be read" api is available? If that API is available, does this simply down to just: rules define flags and users expected to define flag alias; release rules; Bazel can then remove flag at leisure. |
Beta Was this translation helpful? Give feedback.
-
The only part of Starlarkify native Bazel flags I'm still concerned about is Starlark API migration, i.e. Premise (discussed on proposal): We shouldn't force existing .bzl code to upgrade. Because transitive dependency upgrades are a pain. That means:
3 is what I worry about. So what do we do when Bazel 9 flips
I'd like to think 1. can work but I worry that updating modules isn't always straightforward and can bog us down. 2. risks a partial migration that lingers forever. 3's a bit awkward. I'm most tempted by 4 but open to any good ideas. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Starlarkify native Bazel flags
Part of Bazel's Starlarkification roadmap to move core rules like Java, C++, Python from Bazel's source code to .bzl. That way rule maintainers can own them without having to accommodate Bazel's development and release workflows.
This proposal is for language-specific build flags like
--javacopt
. Qualifying flags are defined in Bazel's Java code but only consumed inrules_*
.bzl files. From a domain perspective they should live where their consuming rule logic lives.Lead reviewer @mai93 .
Tracking issues:
Beta Was this translation helpful? Give feedback.
All reactions