bazelbuild/bazel

Please fix the genrule documentation!

Open

#13.338 aberto em 13 de abr. de 2021

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)Java (4.465 forks)batch import
P3help wantedteam-Documentationteam-Rules-CPPtype: documentation (cleanup)

Métricas do repositório

Stars
 (25.384 stars)
Métricas de merge de PR
 (Mesclagem média 22d 20h) (77 fundiu PRs em 30d)

Description

Description of the problem / feature request:

It's way too hard to figure out how to use genrules for the trivial case of generating and depending on multiple c header files. I have a very simple cc_binary rule that needs headers generated by:

genrule(
    name = "mkhdrs",
    srcs = ["obazl.c","fs_utils.c"],
    outs = ["obazl.h","fs_utils.h"],
    cmd = "\n".join([
        "$(location :makeheaders) coq/*.c;",
        "cp coq/*.h $(@D)"
    ]),
    tools = [":makeheaders"]
)

By trial and error I discovered this works:

    copts = ["-I", "bazel-out/darwin-fastbuild/bin/coq"]

which is obviously a hack. After too much time searching the web, I found:

    copts = ["-I", "$(GENDIR)/coq"],

This is very obscure, but only because the documentation is so spare. At the least I recommend adding something like this to the "Examples" section of genrule

Feature requests: what underlying problem are you trying to solve with this feature?

Inadequate documentation.

Have you found anything relevant by searching the web?

Yes, but the point is this sort of base case should not require web searching.

Guia do colaborador