Documentation genrule example - maybe avoid $(location ..) or $(locations ..)
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the problem / feature request:
https://docs.bazel.build/versions/main/be/general.html#genrule_examples
Elsewhere I've seen that we're not supposed to be using $(location) calls and should instead be using $(rootpath ..) or $(execpath ..)
https://github.com/bazelbuild/bazel/issues/2475#issuecomment-339318016
I just spent hours debugging why a genrule of mine didn't work, when it wasn't exactly clear from the example that
1. We shouldn't be using $(location ..)
2. That $(location ..) can return different things in Skylark depending on srcs vs other generated outs.
Maybe this is clear for people who've been in Bazel for years and are aware of the changes to all make-style vars.
Contributor guide
Research direction
Read the genrule examples section at https://docs.bazel.build/versions/main/be/general.html#genrule_examples and compare its $(location) guidance with the discussion in issue #2475. Clarify whether the example should use $(rootpath ..) or $(execpath ..), and explain how $(location ..) differs for srcs versus generated outs. Done means the example and surrounding text remove that ambiguity.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100