• 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    return []
7
8MyProviderInfo = provider(
9    fields = {
10        "foo": "Something foo-related.",
11        "bar": "Something bar-related.",
12    },
13)
14
15OtherProviderInfo = provider()
16other_provider_info = OtherProviderInfo(fields = ["foo"])
17
18my_rule = rule(
19    implementation = my_rule_impl,
20    doc = "This rule does things.",
21    attrs = {
22        "first": attr.label_keyed_string_dict(
23            providers = [MyProviderInfo, PyInfo, cc_common.CcToolchainInfo],
24            doc = "this is the first attribute.",
25        ),
26        "second": attr.label_list(
27            providers = [[CcInfo], [OtherProviderInfo, DepProviderInfo]],
28        ),
29        "third": attr.label(
30            providers = [OtherProviderInfo],
31        ),
32        "fourth": attr.label(
33            # buildifier: disable=native-proto
34            providers = [ProtoInfo, DefaultInfo, JavaInfo],
35        ),
36        "fifth": attr.label(
37            providers = [["LegacyProvider", "ObjectProvider"], [DefaultInfo, JavaInfo]],
38        ),
39        "sixth": attr.label(
40            providers = ["LegacyProvider"],
41        ),
42    },
43)
44