bazelbuild/bazel

Documentation genrule example - maybe avoid $(location ..) or $(locations ..)

Open

#15.078 geöffnet am 18. März 2022

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (4.465 Forks)batch import
P3help wantedteam-Documentationteam-Rules-Servertype: documentation (cleanup)

Repository-Metriken

Stars
 (25.384 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 22T 20h) (77 gemergte PRs in 30 T)

Beschreibung

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