-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a select
-like operator to resolve config_common.FeatureFlagInfo
or similar provider
#18911
Comments
Would bazelbuild/bazel-skylib#440 help with your use case? |
@fmeum Actually it would not help, because I want a calculated string (and by "calculated" I mean target-provided), not a user-defined one. |
To be clear, You're saying you'd like
when can be referenced by any string attribute on any other target, and resolves that attribute to "the actual value"? |
Yes, exactly (but the underlying provider should be public). That would allow a lot of interesting patterns, like analyzing targets in transitions.
|
Feature will help me too! |
Aside from the implementation, what use case are you trying to solve? |
@gregestren Are you asking me or @TsynkPavel? |
Either! I'm wondering if other Starlark tricks could also fulfill it. |
I want to be able to pass calculated values to rule attributes. This will allow me to examine these values in transitions. In particular, I want to pass to transition the index of the field that should be removed from the string_list. And I currently have no other way than to create a bunch of |
Description of the feature request:
I would like to pass a computed string to an arbitrary rule. If the string can only take a finite number of values, the problem can be solved by implementing a rule that returns
config_common.FeatureFlagInfo
and a set ofconfig_setting
,one for each of the allowed values (see
resolve_feature_flag_emulation
).However, if the string can have an unlimited number of values, there is currently no way to achieve the desired functionality.
In this example, you can see how the value of the
shared_lib_name
attribute should be computed based on the givenstring_flag
.My suggestion is to implement the
resolve_feature_flag
operator, which would function similarly toselect
and convert the value fromconfig_common.FeatureFlagInfo
to a string, similar to howresolve_feature_flag_emulation
works. However, it should support an unlimited set of values.What underlying problem are you trying to solve with this feature?
I want to have an ability to pass computed values to the rule attributes.
What is the output of
bazel info release
?release 6.1.0
Have you found anything relevant by searching the web?
No.
Any other information, logs, or outputs that you want to share?
Code for this proposal: https://github.com/alexander-shiryaev/bazel_issue/tree/main/feature_request/feature_flag_value
The text was updated successfully, but these errors were encountered: