-
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
Accept config_settings in target_compatible_with #12614
Comments
Interesting. What conditions are you interested in? |
We've also had some interesting discussion on compatibility based on toolchain properties (like compiler type) from the advent of this feature. So maybe there's conceptual overlap? |
I hope I understand your question correctly, that you are referring to the attributes of |
@gregestren, This is in our original proposal, but was deferred until a second phase so we could get something working first. It was how I've been thinking about implementing toolchain property based skipping. So yea, sounds great! |
Just so I understand properly. Is this functionally equivalent to creating a helper like this? def config_compatible(config_setting_target):
return select({
config_setting_target: [],
"//conditions:default": ["@platforms//:incompatible"],
}) and then using it like so: cc_binary(
...
target_compatible_with = config_compatible(":my_value"),
) Pretty sure you can do the above today. Again, so I'm clear exactly what we're talking about, you'd like to get rid of the need for a helper function like |
Ha! Thanks a lot for thinking of this Philipp. Yes, In fact, that's what I used before I realized that you can (currently, and I hear it might go away) I'm happy with Philipp's approach and as far as I'm concerned you can close this issue. Thanks for your help! |
Closing as acknowledged. To be clear, my preference is to try to limit built-in Bazel support to I like that a reasonable user-space approach was identified here, so you can get what you need without stretching Bazel's core API complexity. |
Description of the feature request:
bazel 4.0 adds a
target_compatible_with
common attribute that accepts a listconstraint_value
s. It would be great if it could also acceptconfig_setting
s.What underlying problem are you trying to solve with this feature?
I would like to mark a target to be compatible only if
:my_config_setting
is true, so that the target itself and all inverse dependencies don't build otherwise.I can currently work around this by translating a
config_setting
into aconstraint_value
byselect()
ing theconstraint_setting
'sdefault_constraint_value
. But apparently constraint_settings are supposed to be configuration independent, so that workaround is bad style:The text was updated successfully, but these errors were encountered: