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