xref: /aosp_15_r20/external/bazel-skylib/docs/common_settings_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2
3Common build setting rules
4
5These rules return a BuildSettingInfo with the value of the build setting.
6For label-typed settings, use the native label_flag and label_setting rules.
7
8More documentation on how to use build settings at
9https://bazel.build/extending/config#user-defined-build-settings
10
11<a id="bool_flag"></a>
12
13## bool_flag
14
15<pre>
16bool_flag(<a href="#bool_flag-name">name</a>)
17</pre>
18
19A bool-typed build setting that can be set on the command line
20
21**ATTRIBUTES**
22
23
24| Name  | Description | Type | Mandatory | Default |
25| :------------- | :------------- | :------------- | :------------- | :------------- |
26| <a id="bool_flag-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
27
28
29<a id="bool_setting"></a>
30
31## bool_setting
32
33<pre>
34bool_setting(<a href="#bool_setting-name">name</a>)
35</pre>
36
37A bool-typed build setting that cannot be set on the command line
38
39**ATTRIBUTES**
40
41
42| Name  | Description | Type | Mandatory | Default |
43| :------------- | :------------- | :------------- | :------------- | :------------- |
44| <a id="bool_setting-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
45
46
47<a id="int_flag"></a>
48
49## int_flag
50
51<pre>
52int_flag(<a href="#int_flag-name">name</a>, <a href="#int_flag-make_variable">make_variable</a>)
53</pre>
54
55An int-typed build setting that can be set on the command line
56
57**ATTRIBUTES**
58
59
60| Name  | Description | Type | Mandatory | Default |
61| :------------- | :------------- | :------------- | :------------- | :------------- |
62| <a id="int_flag-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
63| <a id="int_flag-make_variable"></a>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 |  `""`  |
64
65
66<a id="int_setting"></a>
67
68## int_setting
69
70<pre>
71int_setting(<a href="#int_setting-name">name</a>, <a href="#int_setting-make_variable">make_variable</a>)
72</pre>
73
74An int-typed build setting that cannot be set on the command line
75
76**ATTRIBUTES**
77
78
79| Name  | Description | Type | Mandatory | Default |
80| :------------- | :------------- | :------------- | :------------- | :------------- |
81| <a id="int_setting-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
82| <a id="int_setting-make_variable"></a>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 |  `""`  |
83
84
85<a id="string_flag"></a>
86
87## string_flag
88
89<pre>
90string_flag(<a href="#string_flag-name">name</a>, <a href="#string_flag-make_variable">make_variable</a>, <a href="#string_flag-values">values</a>)
91</pre>
92
93A string-typed build setting that can be set on the command line
94
95**ATTRIBUTES**
96
97
98| Name  | Description | Type | Mandatory | Default |
99| :------------- | :------------- | :------------- | :------------- | :------------- |
100| <a id="string_flag-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
101| <a id="string_flag-make_variable"></a>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 |  `""`  |
102| <a id="string_flag-values"></a>values |  The list of allowed values for this setting. An error is raised if any other value is given.   | List of strings | optional |  `[]`  |
103
104
105<a id="string_list_flag"></a>
106
107## string_list_flag
108
109<pre>
110string_list_flag(<a href="#string_list_flag-name">name</a>)
111</pre>
112
113A string list-typed build setting that can be set on the command line
114
115**ATTRIBUTES**
116
117
118| Name  | Description | Type | Mandatory | Default |
119| :------------- | :------------- | :------------- | :------------- | :------------- |
120| <a id="string_list_flag-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
121
122
123<a id="string_list_setting"></a>
124
125## string_list_setting
126
127<pre>
128string_list_setting(<a href="#string_list_setting-name">name</a>)
129</pre>
130
131A string list-typed build setting that cannot be set on the command line
132
133**ATTRIBUTES**
134
135
136| Name  | Description | Type | Mandatory | Default |
137| :------------- | :------------- | :------------- | :------------- | :------------- |
138| <a id="string_list_setting-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
139
140
141<a id="string_setting"></a>
142
143## string_setting
144
145<pre>
146string_setting(<a href="#string_setting-name">name</a>, <a href="#string_setting-make_variable">make_variable</a>, <a href="#string_setting-values">values</a>)
147</pre>
148
149A string-typed build setting that cannot be set on the command line
150
151**ATTRIBUTES**
152
153
154| Name  | Description | Type | Mandatory | Default |
155| :------------- | :------------- | :------------- | :------------- | :------------- |
156| <a id="string_setting-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
157| <a id="string_setting-make_variable"></a>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 |  `""`  |
158| <a id="string_setting-values"></a>values |  The list of allowed values for this setting. An error is raised if any other value is given.   | List of strings | optional |  `[]`  |
159
160
161<a id="BuildSettingInfo"></a>
162
163## BuildSettingInfo
164
165<pre>
166BuildSettingInfo(<a href="#BuildSettingInfo-value">value</a>)
167</pre>
168
169A singleton provider that contains the raw value of a build setting
170
171**FIELDS**
172
173
174| Name  | Description |
175| :------------- | :------------- |
176| <a id="BuildSettingInfo-value"></a>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.    |
177
178
179