-
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
Add alias_label
struct field to all targets
#18100
base: master
Are you sure you want to change the base?
Conversation
This allows rules to obtain the label of an `alias` target rather than only the label of the target an alias chain ultimately resolves to. The former is the label as specified by the user on the rule, which can be important to know for e.g. fixup messages and manual implementations of location expansion.
We already have |
To me Unless there is additional alias-related logic that may need to be exposed to Starlark, a struct field on |
FWIW, @comius do you have an opinion? |
@lberki Do you have an example use case that relies on the intermediate labels in the chain? I have a hard time coming up with any and wonder whether exposing this chain would really be a desirable feature. Bazel appears to only contain a single reference and that is in aspect logic. |
To be pedantic, I didn't say that it's useful, I said that it's possible :) Bazel uses it internally for better error reporting ("Target |
Could I ask for a design document here? I think there are several different ways how to implement this, several problems and APIs related to this. There's also a philosophical aspect (or call it a good design practice), that an alias should be indistinguishable from the target it points to. I'm lacking bandwidth to do an ad hoc "design doc" in my mind, review all the surrounding code and then confirm all the implicit design decision a PR like this could be making. |
This allows rules to obtain the label of an
alias
target rather than only the label of the target an alias chain ultimately resolves to. The former is the label as specified by the user on the rule, which can be important to know for e.g. fixup messages and manual implementations of location expansion.Fixes #11044