Document providers in C/C++ rules and return values in cc_common
#9,147 opened on 2019年8月12日
Repository metrics
- Stars
- (25,384 stars)
- PR merge metrics
- (平均マージ 22d 20h) (30d で 77 merged PRs)
説明
Description of the request:
Need to document providers exposed from native rules cc_library, cc_binary (and others) and returned values from cc_common functions.
Feature requests: what underlying problem are you trying to solve with this feature?
I want to write my own rules in C++ project, which uses cc_library, cc_binary as an input, and there is no documentation about how I can use output of those rules. Also my rules are trying to use cc_common utilities and there is a lack of documentation too.
As an example: BUILD
package(default_visibility = ["//visibility:public"])
load("//:my_rule.bzl", "my_rule")
cc_library(
name = "bar",
srcs = ["main.cc"],
)
my_rule(
name = "dump",
input = ":bar",
)
my_rule.bzl
def _my_rule(ctx):
input = ctx.attr.input
print(input.output_groups.dynamic_library)
my_rule = rule(
implementation = _my_rule,
attrs = {
"input": attr.label(),
},
)
There is no information in documentation that shared library is stored in .output_groups.dynamic_library.
About cc_common: there are many places which not properly documented in https://docs.bazel.build/versions/0.28.0/skylark/lib/cc_common.html , for example
- Return value of
cc_common.link(CcLinkingOutputs) is not documented - Return value of
cc_common.compile(tuple) is not documented (there is no information about content of the tuple)
I think documentation need to be more detailed.