Support varying `string_flag`s on the exec configuration
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
I have a case where I want to create a custom starlark `string_flag` that has a few potential values that are mututally exclusive. But this should only apply to the target and not the exec configuration since it affects how things are compiled. In this case I don't see any easy way for me to make this flag not affect the exec configuration, nor to force a specific value for that configuration.
I found `--experimental_exclude_starlark_flags_from_exec_config`, but I worry that's too heavy handed and will potentially disable other underlying flags that I don't even know are being used.
I also found that I could override the entire exec transition with something like:
```bzl
bazel_exec_transition = transition(
implementation = lambda settings, attr: {
"//command_line_option:is exec configuration": True,
"//:my_flag": "whatever",
},
inputs = [],
outputs = [
"//command_line_option:is exec configuration",
"//:my_flag",
],
)
```
and passing `--experimental_exec_config=//:foo.bzl%bazel_exec_transition`, but I'm not sure if this has any other major downsides (from diffing the configs before and after I guess this is at least somewhat additive?) so I wasn't sure if that's a good idea.
### Which category does this issue belong to?
_No response_
### What underlying problem are you trying to solve with this feature?
_No response_
### Which operating system are you running Bazel on?
_No response_
### What is the output of `bazel info release`?
8.x
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
```text
```
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
The issue names no source file or test; begin by tracing Bazel's handling of --experimental_exclude_starlark_flags_from_exec_config and --experimental_exec_config. Compare the existing transition example with the requested selective string_flag behavior, and define done as supporting varying target values without unintentionally changing the exec configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100