Common build setting rules
These rules return a BuildSettingInfo with the value of the build setting. For label-typed settings, use the native label_flag and label_setting rules.
More documentation on how to use build settings at https://bazel.build/extending/config#user-defined-build-settings
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") bool_flag(<a href="#bool_flag-name">name</a>, <a href="#bool_flag-scope">scope</a>)
A bool-typed build setting that can be set on the command line
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| scope | The scope indicates where a flag can propagate to | String | optional | "target" |
load("@bazel_skylib//rules:common_settings.bzl", "bool_setting") bool_setting(<a href="#bool_setting-name">name</a>, <a href="#bool_setting-scope">scope</a>)
A bool-typed build setting that cannot be set on the command line
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| scope | The scope indicates where a flag can propagate to | String | optional | "target" |
load("@bazel_skylib//rules:common_settings.bzl", "int_flag") int_flag(<a href="#int_flag-name">name</a>, <a href="#int_flag-make_variable">make_variable</a>, <a href="#int_flag-scope">scope</a>)
An int-typed build setting that can be set on the command line
ATTRIBUTES
load("@bazel_skylib//rules:common_settings.bzl", "int_setting") int_setting(<a href="#int_setting-name">name</a>, <a href="#int_setting-make_variable">make_variable</a>, <a href="#int_setting-scope">scope</a>)
An int-typed build setting that cannot be set on the command line
ATTRIBUTES
load("@bazel_skylib//rules:common_settings.bzl", "repeatable_string_flag") repeatable_string_flag(<a href="#repeatable_string_flag-name">name</a>, <a href="#repeatable_string_flag-scope">scope</a>)
A build setting that accepts one or more string-typed settings on the command line, with the values concatenated into a single string list; for example, --//my/setting=foo --//my/setting=bar will be parsed as ['foo', 'bar']. Contrast with string_list_flag
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| scope | The scope indicates where a flag can propagate to | String | optional | "target" |
load("@bazel_skylib//rules:common_settings.bzl", "string_flag") string_flag(<a href="#string_flag-name">name</a>, <a href="#string_flag-make_variable">make_variable</a>, <a href="#string_flag-scope">scope</a>, <a href="#string_flag-values">values</a>)
A string-typed build setting that can be set on the command line
ATTRIBUTES
load("@bazel_skylib//rules:common_settings.bzl", "string_list_flag") string_list_flag(<a href="#string_list_flag-name">name</a>, <a href="#string_list_flag-scope">scope</a>)
A string list-typed build setting that can be set on the command line
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| scope | The scope indicates where a flag can propagate to | String | optional | "target" |
load("@bazel_skylib//rules:common_settings.bzl", "string_list_setting") string_list_setting(<a href="#string_list_setting-name">name</a>, <a href="#string_list_setting-scope">scope</a>)
A string list-typed build setting which expects its value on the command line to be given in comma-separated format; for example, --//my/setting=foo,bar will be parsed as ['foo', 'bar']. Contrast with repeatable_string_flag
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| scope | The scope indicates where a flag can propagate to | String | optional | "target" |
load("@bazel_skylib//rules:common_settings.bzl", "string_setting") string_setting(<a href="#string_setting-name">name</a>, <a href="#string_setting-make_variable">make_variable</a>, <a href="#string_setting-scope">scope</a>, <a href="#string_setting-values">values</a>)
A string-typed build setting that cannot be set on the command line
ATTRIBUTES
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") BuildSettingInfo(<a href="#BuildSettingInfo-value">value</a>)
A singleton provider that contains the raw value of a build setting
FIELDS
| Name | Description |
|---|---|
| value | The value of the build setting in the current configuration. This value may come from the command line or an upstream transition, or else it will be the build setting's default. |