bazelbuild / bazelbuild/bazel

Genrule recommends using $(location) but it's described as legacy reference to either $(execpath) or $(rootpath)

Open
#25,204 4 comments 0 reactions 0 assignees View on GitHub
P2 team-Configurability team-Documentation type: documentation (cleanup)
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Page link:

https://bazel.build/reference/be/general#genrule_args

### Problem description (include actual vs expected text, if applicable):

From https://bazel.build/reference/be/make-variables#predefined_label_variables:
> location: A synonym for either execpath or rootpath, depending on the attribute being expanded. This is legacy pre-Starlark behavior and not recommended unless you really know what it does for a particular rule. See [#2475](https://github.com/bazelbuild/bazel/issues/2475#issuecomment-339318016) for details.

But https://bazel.build/reference/be/general#genrule suggests using $ (location) as well as presents various examples with using it instead of using $(execpath). Multiple examples within bazel codebase also use $ (location). The genrule description links to the make-variables page that contains recommendation not to use $ (location).

### Where do you see this issue? (include link to specific section of the page, if applicable)

_No response_

### Any other information you'd like to share?

It would be nice to clarify whether genrule actually should stick to use $ (location) or whether examples and documentation should use $ (execpath) instead.

Contributor guide

Open the contributing guide

Research direction

Compare the genrule_args page with the predefined_label_variables page, then review the linked #2475 discussion and the cited genrule examples. Determine whether the documentation should consistently recommend $(location), $(execpath), or $(rootpath), and update the wording and examples so the recommendation is unambiguous.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.