xref: /aosp_15_r20/external/stardoc/test/testdata/input_template_test/input.bzl (revision b2fa42943c124aa9c7163734493fc7a7559681cf)
1"""Input file for input template test"""
2
3def template_function(foo):
4    """Runs some checks on the given function parameter.
5
6    This rule runs checks on a given function parameter in chosen template.
7    Use `bazel build` to run the check.
8
9    Args:
10        foo: A unique name for this function.
11    """
12    _ignore = [foo]  # @unused
13    pass
14
15# buildifier: disable=unsorted-dict-items
16example = provider(
17    doc = "Stores information about an example in chosen template.",
18    fields = {
19        "foo": "A string representing foo",
20        "bar": "A string representing bar",
21        "baz": "A string representing baz",
22    },
23)
24
25def _rule_impl(ctx):
26    _ignore = [ctx]  # @unused
27    return []
28
29my_example = rule(
30    implementation = _rule_impl,
31    doc = "Small example of rule using chosen template.",
32    attrs = {
33        "useless": attr.string(
34            doc = "This argument will be ignored.",
35            default = "word",
36        ),
37    },
38)
39
40def my_aspect_impl(ctx):
41    _ignore = [ctx]  # @unused
42    return []
43
44my_aspect = aspect(
45    implementation = my_aspect_impl,
46    doc = "This is my aspect. It does stuff.",
47    attr_aspects = ["deps", "attr_aspect"],
48    attrs = {
49        "first": attr.label(mandatory = True, allow_single_file = True),
50    },
51)
52