Skip to content

Commit cbcf83c

Browse files
A Googlercopybara-github
authored andcommitted
Stop exposing the native --stamp flag to all Android rules.
PiperOrigin-RevId: 869867184 Change-Id: I293763bb53aa0522377a9cf0f6c6a44acb8dcc29
1 parent dd245bd commit cbcf83c

2 files changed

Lines changed: 1 addition & 60 deletions

File tree

rules/flags/flag_defs.bzl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ def define_flags():
8383
)
8484

8585

86-
flags.EXPOSE_native_bool(
87-
name = "stamp",
88-
description = "Accesses the native --stamp CLI flag",
89-
)
90-
9186
flags.DEFINE_bool(
9287
name = "use_studio_deployer",
9388
default = True,

rules/flags/flags.bzl

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -41,54 +41,10 @@ _IntFlagInfo = provider(
4141
value = "flag value",
4242
),
4343
)
44-
_NativeBoolFlagInfo = provider(
45-
doc = "Provides information about a native boolean flag",
46-
fields = dict(
47-
name = "flag name, the name of the native flag being accessed.",
48-
value = "flag value, derived from config_setting targets that access the value",
49-
),
50-
)
5144
FlagsInfo = provider(
5245
doc = "Provides all flags",
5346
)
5447

55-
def _native_bool_impl(ctx):
56-
return _NativeBoolFlagInfo(
57-
name = ctx.label.name,
58-
value = ctx.attr.value,
59-
)
60-
61-
native_bool_flag = rule(
62-
implementation = _native_bool_impl,
63-
attrs = dict(
64-
value = attr.bool(mandatory = True),
65-
),
66-
provides = [_NativeBoolFlagInfo],
67-
)
68-
69-
def native_bool_flag_macro(name, description):
70-
"""Provides access to a native boolean flag from Starlark.
71-
72-
Args:
73-
name: The name of the native flag to access.
74-
description: The description of the flag.
75-
"""
76-
native.config_setting(
77-
name = name + "_on",
78-
values = {name: "True"},
79-
)
80-
native.config_setting(
81-
name = name + "_off",
82-
values = {name: "False"},
83-
)
84-
native_bool_flag(
85-
name = name,
86-
value = select({
87-
(":" + name + "_on"): True,
88-
(":" + name + "_off"): False,
89-
}),
90-
)
91-
9248
def _get_bool(v):
9349
v = v.lower()
9450
if v == "true":
@@ -178,7 +134,7 @@ int_flag = rule(
178134
provides = [_IntFlagInfo],
179135
)
180136

181-
def _flags_impl_internal(bool_flags, bool_flag_groups, int_flags, native_bool_flags):
137+
def _flags_impl_internal(bool_flags, bool_flag_groups, int_flags):
182138
flags = dict()
183139

184140
# For each group, set all flags to the group value
@@ -202,20 +158,13 @@ def _flags_impl_internal(bool_flags, bool_flag_groups, int_flags, native_bool_fl
202158
for i in int_flags:
203159
flags[i.name] = i.value
204160

205-
# Set native bool flags
206-
for n in native_bool_flags:
207-
if n.name in flags:
208-
fail("Flag '%s' defined as both native and non-native flag type" % n.name)
209-
flags[n.name] = n.value
210-
211161
return FlagsInfo(**flags)
212162

213163
def _flags_impl(ctx):
214164
return _flags_impl_internal(
215165
utils.collect_providers(_BoolFlagInfo, ctx.attr.targets),
216166
utils.collect_providers(_BoolFlagGroupInfo, ctx.attr.targets),
217167
utils.collect_providers(_IntFlagInfo, ctx.attr.targets),
218-
utils.collect_providers(_NativeBoolFlagInfo, ctx.attr.targets),
219168
)
220169

221170
flags_rule = rule(
@@ -242,7 +191,6 @@ flags = struct(
242191
DEFINE_bool = bool_flag,
243192
DEFINE_bool_group = bool_flag_group,
244193
DEFINE_int = int_flag,
245-
EXPOSE_native_bool = native_bool_flag_macro,
246194
FLAGS = _flags_macro,
247195
FlagsInfo = FlagsInfo,
248196
get = _get_flags,
@@ -252,9 +200,7 @@ exported_for_test = struct(
252200
BoolFlagGroupInfo = _BoolFlagGroupInfo,
253201
BoolFlagInfo = _BoolFlagInfo,
254202
IntFlagInfo = _IntFlagInfo,
255-
NativeBoolFlagInfo = _NativeBoolFlagInfo,
256203
bool_impl = _bool_impl,
257204
flags_impl_internal = _flags_impl_internal,
258205
int_impl = _int_impl,
259-
native_bool_flag_macro = native_bool_flag_macro,
260206
)

0 commit comments

Comments
 (0)