Label
crashes in BUILD files
#12971
Labels
P3
We're not considering working on this, but happy to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-Loading-API
BUILD file and macro processing: labels, package(), visibility, glob
type: bug
(Context: #12963)
When you try to call
Label
within a BUILD file, you're treated to an NPE crash.Label
is not ordinarily accessible in BUILD files, but you can bind it to a symbol with a different name, and load that symbol instead.The crash is because
Label
attempts to retrieve the BazelModuleContext of the calling file, which doesn't exist forBUILD
files.This makes it harder to use an idiom whereby you pass Label objects as argument values to macros instead of strings. Such an idiom is needed if you want to lock in your own repo remapping instead of using the one in the repo of the macro that you're calling.
Before fixing this bug, we should reassess the nature of repository remapping. Even if this use case worked without crashing it would still be confusing to end users.
The text was updated successfully, but these errors were encountered: