forked from rh-messaging/cli-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_settings.bzl
25 lines (20 loc) · 896 Bytes
/
build_settings.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# https://docs.google.com/document/d/1vc8v-kXjvgZOdQdnxPTaV0rrLxtP2XwnD2tAZlYJOqw
# This file defines the build_flag and build_setting rules which can be used in
# BUILD files to declare specific settings.
BuildSettingInfo = provider(fields = ["name", "value"])
def _build_setting_impl(ctx):
# The rule implementation. We could do validation, type conversion, etc. if we
# want. But this example just dumps ctx.build_setting_value into a provider.
return [BuildSettingInfo(name = ctx.attr.name, value = ctx.build_setting_value )]
string_flag = rule(
implementation = _build_setting_impl,
build_setting = config.string(flag=True) # Settable at the command line
)
bool_setting = rule(
implementation = _build_setting_impl,
build_setting = config.bool() # Only settable by other rules
)
label_flag = rule(
implementation = _build_setting_impl,
#build_setting = attr.label()
)