diff options
author | cparsons <cparsons@google.com> | 2018-07-13 15:23:46 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-13 15:24:58 -0700 |
commit | 1771054491bcaa8bc5f2dacdb66381519e4ae29a (patch) | |
tree | de6006bb43b5e4d44911db90e88d3b0904bfc78c /src/test/java/com/google/devtools/build/skydoc/testdata/misc_apis_test/input.bzl | |
parent | ea410646981448956dd2f1ae2c1c9714347b6711 (diff) |
Improve build API support in the fakebuildapi, allowing Skydoc to run on files which define new provider types and instantiate Labels.
Also improve docstring usage in attr definitions by doing whitespace trimming.
RELNOTES: None.
PiperOrigin-RevId: 204537623
Diffstat (limited to 'src/test/java/com/google/devtools/build/skydoc/testdata/misc_apis_test/input.bzl')
-rw-r--r-- | src/test/java/com/google/devtools/build/skydoc/testdata/misc_apis_test/input.bzl | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/test/java/com/google/devtools/build/skydoc/testdata/misc_apis_test/input.bzl b/src/test/java/com/google/devtools/build/skydoc/testdata/misc_apis_test/input.bzl index 39ca085697..10ef29d783 100644 --- a/src/test/java/com/google/devtools/build/skydoc/testdata/misc_apis_test/input.bzl +++ b/src/test/java/com/google/devtools/build/skydoc/testdata/misc_apis_test/input.bzl @@ -9,13 +9,39 @@ def exercise_the_api(): exercise_the_api() +MyInfo = provider( + fields = { + "foo": "Something foo-related.", + "bar": "Something bar-related.", + }, +) + +my_info = MyInfo(foo="x", bar="y") + my_rule = rule( implementation = my_rule_impl, doc = "This rule exercises some of the build API.", attrs = { - "first": attr.label(mandatory = True, allow_files = True, single_file = True), - "second": attr.string_dict(mandatory = True), - "third": attr.output(mandatory = True), - "fourth": attr.bool(default = False, mandatory = False), - }, + "src": attr.label( + doc = "The source file.", + allow_files = [".bzl"]), + "deps": attr.label_list( + doc = """ +A list of dependencies. +These dependencies better provide MyInfo! +...or else. +""", + providers = [MyInfo], + allow_files = False), + "tool": attr.label( + doc = "The location of the tool to use.", + allow_files = True, + default = Label("//foo/bar/baz:target",), + cfg = "host", + executable = True), + "out": attr.output( + doc = "The output file.", + mandatory = True), + "extra_arguments": attr.string_list(default = []), + } ) |