You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

18 lines
550 B

# https://docs.bazel.build/versions/2.1.0/skylark/config.html
FlavorProvider = provider(fields = ['type'])
flavors = ["APPLE", "BANANA", "ORANGE"]
def _impl(ctx):
raw_flavor = ctx.build_setting_value
if raw_flavor not in flavors:
fail(str(ctx.label) + " build setting allowed to take values {"
+ ", ".join(flavors) + "} but was set to unallowed value "
+ raw_flavor)
return FlavorProvider(type = raw_flavor)
flavor = rule(
implementation = _impl,
build_setting = config.string(flag = True)
)