native.repository_name() and ctx.workspace_name() are similar function but with different name
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
To get the workspace name of the call site, we do `native.repository_name()` in a macro and `ctx.workspace_name()` in a rule. The latter is behaving differently in the main repository probably (returning the name, whereas the repository name can be empty).
This is a [confusing API](https://stackoverflow.com/questions/47068989/how-to-compute-the-bazel-workspace-name-in-a-macro) and it needs to be cleaned.
Contributor guide
Research direction
Start by comparing native.repository_name() in macros with ctx.workspace_name() in rules, especially their behavior in the main repository. Determine the intended consistent API semantics, then update the relevant implementation and coverage so both entry points agree and the confusing naming or behavior is resolved.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, developer-experience
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100