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

Allow exported name override for rules #8640

Closed
c-parsons opened this issue Jun 14, 2019 · 2 comments
Closed

Allow exported name override for rules #8640

c-parsons opened this issue Jun 14, 2019 · 2 comments
Assignees
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request

Comments

@c-parsons
Copy link
Contributor

When a rule is defined, the first name of that rule gets special treatment as the forever-name of the rule (for example, under bazel query)

For example:

_fake_rule_name = rule(...)

foo_library = _fake_rule_name

When querying foo_library targets using bazel query, the targets will show up as type _fake_rule_name because that was their first name.

This is counter-intuitive, and it often becomes problematic in cases when users would like to override this behavior.
One concrete example where an override makes sense: #7977 (comment)

One should be allowed to specify the canonical rule name of a rule definition, overriding the behavior that this must be the first exported name.

Proposal:
Add a string parameter to the rule() function, exported_name. When specified, the rule will have this canonical name. When unspecified, the rule will take on the name of the first exported name (previous behavior). This change will not require an incompatible change flag.

@c-parsons c-parsons added type: feature request P1 I'll work on this now. (Assignee required) team-Starlark labels Jun 14, 2019
@katre
Copy link
Member

katre commented May 13, 2020

This does not appear to be a P1. Downgrading and marking as untriaged so Starlark team can decide about whether this is needed.

@katre katre added untriaged and removed P1 I'll work on this now. (Assignee required) labels May 13, 2020
@laurentlb laurentlb added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels May 13, 2020
@brandjon
Copy link
Member

Dedupping against #5078.

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) type: feature request
Projects
None yet
Development

No branches or pull requests

4 participants