tree: 95f3e06856621eb4268307553eed071da149b799 [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"),
    },
)