diff options
author | Han-Wen Nienhuys <hanwen@google.com> | 2016-01-15 15:54:12 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-01-15 22:29:37 +0000 |
commit | 67e6f98d7659ac41154f93c39e548ba0ecc43c80 (patch) | |
tree | aa1804d5058d3e0d53c58ab1af4e6301da1fd190 /src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSuite.java | |
parent | 8cc0541da1ec912568c8df2fc13a9b72b668cda2 (diff) |
Add native.rule(NAME), which returns the attributes of a previously defined rule.
Add native.rules(), which returns all previously defined rules.
These primitives can be used to write Skylark extensions that aggregate over the contents of a BUILD file, eg.
def instantiate_if_needed(name):
n = name + "_wrapped"
if not native.rule(n):
py_test(name = n , ... )
def archive_cc_src_files(tag):
all_src = []
for r in native.rules().values():
if tag in r["tags"] and r["kind"] == "cc_library":
all_src.append(r["srcs"])
native.genrule(cmd = "zip $@ $^", srcs = all_src, outs = ["out.zip"])
RELNOTES: Support aggregation over existing rules in Skylark extensions
through native.rules and native.rule.
--
MOS_MIGRATED_REVID=112249050
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSuite.java')
0 files changed, 0 insertions, 0 deletions