@@ -236,21 +236,44 @@ Set the flag to build nothing and output information about the build plan.
236
236
237
237
### ` --flag ` option
238
238
239
+ The option can be specified multiple times. It has two forms:
240
+
241
+ * ` --flag <package_name>:[-]<flag_name> ` ; and
242
+
243
+ * ` --flag *:[-]<flag_name> ` .
244
+
239
245
` stack build --flag <package_name>:[-]<flag_name> ` sets (or unsets) the
240
- specified Cabal flag for the specified package.
246
+ specified Cabal flag for the specified package. Stack will report an error if:
241
247
242
- This option can be specified multiple times to set (or unset) multiple Cabal
243
- flags.
248
+ * a package of that name is not known to Stack; or
244
249
245
- The same Cabal flag name can be set (or unset) for multiple packages (at the
246
- command line only) with:
250
+ * a flag of that name is not a flag of that package.
247
251
248
- ~~~ text
249
- stack build --flag *:[-]<flag_name>
250
- ~~~
252
+ This overrides:
253
+
254
+ * any Cabal flag specifications for the package in Stack's project-level
255
+ configuration file (` stack.yaml ` ); and
256
+
257
+ * any use of ` --flag * ` (see below).
258
+
259
+ ` stack build --flag *:[-]<flag_name> ` sets (or unsets) the specified Cabal flag
260
+ for all packages (project packages and dependencies) (whether or not a flag of
261
+ that name is a flag of the package).
262
+
263
+ This overrides any Cabal flag specifications for packages in Stack's
264
+ project-level configuration file (` stack.yaml ` ).
265
+
266
+ !!! note
267
+
268
+ In order to set a Cabal flag for a GHC boot package, the package must be
269
+ specified as an [extra-dep](yaml_configuration.md#extra-deps).
270
+
271
+ !!! warning
251
272
252
- In order to set a Cabal flag for a GHC boot package, the package must be
253
- specified as an extra-dep.
273
+ Stack creates snapshots when building immutable dependencies of projects.
274
+ The names of Cabal flags that have been manually set as disabled distinguish
275
+ one such snapshot from another. However, the names of Cabal flags that have
276
+ been set as enabled do not do so.
254
277
255
278
### ` --[no-]force-dirty ` flag
256
279
0 commit comments