Skip to content

Commit 8a2fa2b

Browse files
committed
Re commercialhaskell#6564 Improve --flag documentation
The added warning is based on commercialhaskell#6565.
1 parent 4bc0c6b commit 8a2fa2b

File tree

2 files changed

+44
-12
lines changed

2 files changed

+44
-12
lines changed

doc/build_command.md

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,21 +236,44 @@ Set the flag to build nothing and output information about the build plan.
236236

237237
### `--flag` option
238238

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+
239245
`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:
241247

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
244249

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.
247251

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
251272

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.
254277

255278
### `--[no-]force-dirty` flag
256279

doc/yaml_configuration.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,17 @@ If a specified Cabal flag for a package included directly in a snapshot is
311311
different to the Cabal flag specified for that package in the snapshot, then the
312312
package will automatically be promoted to be an [extra-dep](#extra-deps).
313313

314-
In order to set a Cabal flag for a GHC boot package, the package must be
315-
specified as an [extra-dep](#extra-deps).
314+
!!! note
315+
316+
In order to set a Cabal flag for a GHC boot package, the package must be
317+
specified as an [extra-dep](#extra-deps).
318+
319+
!!! warning
320+
321+
Stack creates snapshots when building immutable dependencies of projects.
322+
The names of Cabal flags that have been manually set as disabled distinguish
323+
one such snapshot from another. However, the names of Cabal flags that have
324+
been set as enabled do not do so.
316325

317326
### drop-packages
318327

0 commit comments

Comments
 (0)