Skip to content
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

Label crashes in BUILD files #12971

Closed
brandjon opened this issue Feb 5, 2021 · 2 comments
Closed

Label crashes in BUILD files #12971

brandjon opened this issue Feb 5, 2021 · 2 comments
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

Comments

@brandjon
Copy link
Member

brandjon commented Feb 5, 2021

(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 for BUILD 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.

@brandjon brandjon added type: bug P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Starlark labels Feb 5, 2021
@brandjon brandjon added team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob and removed team-Build-Language labels Nov 4, 2022
Copy link

github-actions bot commented Jan 9, 2024

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Jan 9, 2024
Copy link

github-actions bot commented Apr 9, 2024

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage in a comment here and we'll take a look. Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant