tree: 81bc03a7b4e833a84ab159ec3628337537195a31 [path history] [tgz]
  1. BUILD
  2. common_settings.bzl
  3. README.md
tools/config/README.md

Common scalar build settings.

Overview

These definitions are only for use in Bazel built-in tools. In all other cases, use flag type definitions from github.com/bazelbuild/bazel-skylib/rules/common_settings.bzl.

Basic Example

//tools/my_pkg/BUILD

load("//tools/config:common_settings.bzl", "bool_flag")

bool_flag(
    name = "experimental_new_behavior",
    build_setting_default = False,
)

//tools/my_pkg/myrule.bzl

load("//tools/flags:flags.bzl", "BuildSettingInfo")


def _myrule_impl(ctx):
    if ctx.attr._experimental_new_behavior[BuildSettingInfo].value:
       ...
    ...


myrule = rule(
    implementation = _myrule_impl.
    attrs = {
        ...

        "_experimental_new_behavior": attr.label(
            default = "//tools/my_pkg:experimental_new_behavior"),
    },
)