bazelbuild/bazel

Please fix the genrule documentation!

Open

#13,338 opened on 2021年4月13日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)Java (4,465 forks)batch import
P3help wantedteam-Documentationteam-Rules-CPPtype: documentation (cleanup)

Repository metrics

Stars
 (25,384 stars)
PR merge metrics
 (平均マージ 22d 20h) (30d で 77 merged PRs)

説明

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.

コントリビューターガイド