• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""The input file for the providers for attributes test"""
2
3load(":testdata/providers_for_attributes_test/dep.bzl", "DepProviderInfo")
4
5def my_rule_impl(ctx):
6    _ignore = [ctx]  # @unused
7    return []
8
9# buildifier: disable=provider-params
10# buildifier: disable=unsorted-dict-items
11MyProviderInfo = provider(
12    fields = {
13        "foo": "Something foo-related.",
14        "bar": "Something bar-related.",
15    },
16)
17
18# buildifier: disable=provider-params
19OtherProviderInfo = provider()
20other_provider_info = OtherProviderInfo(fields = ["foo"])
21
22# buildifier: disable=unsorted-dict-items
23my_rule = rule(
24    implementation = my_rule_impl,
25    doc = "This rule does things.",
26    attrs = {
27        "first": attr.label_keyed_string_dict(
28            providers = [MyProviderInfo, PyInfo, cc_common.CcToolchainInfo],
29            doc = "this is the first attribute.",
30        ),
31        "second": attr.label_list(
32            providers = [[CcInfo], [OtherProviderInfo, DepProviderInfo]],
33        ),
34        "third": attr.label(
35            providers = [OtherProviderInfo],
36        ),
37        "fourth": attr.label(
38            # buildifier: disable=native-proto
39            providers = [ProtoInfo, DefaultInfo, JavaInfo],
40        ),
41        "fifth": attr.label(
42            providers = [["LegacyProvider", "ObjectProvider"], [DefaultInfo, JavaInfo]],
43        ),
44        "sixth": attr.label(
45            providers = ["LegacyProvider"],
46        ),
47    },
48)
49