Skip to content

Latest commit

 

History

History
executable file
·
203 lines (119 loc) · 8.38 KB

common_settings_doc.md

File metadata and controls

executable file
·
203 lines (119 loc) · 8.38 KB

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

bool_flag

load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

bool_flag(name, scope)

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 "universal"

bool_setting

load("@bazel_skylib//rules:common_settings.bzl", "bool_setting")

bool_setting(name, scope)

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 "universal"

int_flag

load("@bazel_skylib//rules:common_settings.bzl", "int_flag")

int_flag(name, make_variable, scope)

An int-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
make_variable If set, the build setting's value will be available as a Make variable with this name in the attributes of rules that list this build setting in their 'toolchains' attribute. String optional ""
scope The scope indicates where a flag can propagate to String optional "universal"

int_setting

load("@bazel_skylib//rules:common_settings.bzl", "int_setting")

int_setting(name, make_variable, scope)

An int-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
make_variable If set, the build setting's value will be available as a Make variable with this name in the attributes of rules that list this build setting in their 'toolchains' attribute. String optional ""
scope The scope indicates where a flag can propagate to String optional "universal"

string_flag

load("@bazel_skylib//rules:common_settings.bzl", "string_flag")

string_flag(name, make_variable, scope, values)

A string-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
make_variable If set, the build setting's value will be available as a Make variable with this name in the attributes of rules that list this build setting in their 'toolchains' attribute. String optional ""
scope The scope indicates where a flag can propagate to String optional "universal"
values The list of allowed values for this setting. An error is raised if any other value is given. List of strings optional []

string_list_flag

load("@bazel_skylib//rules:common_settings.bzl", "string_list_flag")

string_list_flag(name, scope)

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 "universal"

string_list_setting

load("@bazel_skylib//rules:common_settings.bzl", "string_list_setting")

string_list_setting(name, scope)

A string list-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 "universal"

string_setting

load("@bazel_skylib//rules:common_settings.bzl", "string_setting")

string_setting(name, make_variable, scope, values)

A string-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
make_variable If set, the build setting's value will be available as a Make variable with this name in the attributes of rules that list this build setting in their 'toolchains' attribute. String optional ""
scope The scope indicates where a flag can propagate to String optional "universal"
values The list of allowed values for this setting. An error is raised if any other value is given. List of strings optional []

BuildSettingInfo

load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")

BuildSettingInfo(value)

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.