xref: /aosp_15_r20/external/bazelbuild-rules_rust/rust/settings/incompatible.bzl (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1"""This file contains definitions of all current incompatible flags.
2
3See COMPATIBILITY.md for the backwards compatibility policy.
4"""
5
6IncompatibleFlagInfo = provider(
7    doc = "Provider for the current value of an incompatible flag.",
8    fields = {
9        "enabled": "(bool) whether the flag is enabled",
10        "issue": "(string) link to the github issue associated with this flag",
11    },
12)
13
14def _incompatible_flag_impl(ctx):
15    return [IncompatibleFlagInfo(enabled = ctx.build_setting_value, issue = ctx.attr.issue)]
16
17incompatible_flag = rule(
18    doc = "A rule defining an incompatible flag.",
19    implementation = _incompatible_flag_impl,
20    build_setting = config.bool(flag = True),
21    attrs = {
22        "issue": attr.string(
23            doc = "The link to the github issue associated with this flag",
24            mandatory = True,
25        ),
26    },
27)
28