Skip to content

Commit 8312baf

Browse files
committed
Further extend documentation of stack build command
1 parent f57cc68 commit 8312baf

File tree

1 file changed

+55
-12
lines changed

1 file changed

+55
-12
lines changed

doc/build_command.md

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ intended for tool usage. It may break when used on multiple packages at once.
253253
Pass the flag to skip building the targets. The flag `--dependencies-only` has
254254
the same effect.
255255

256+
### The `stack build --only-locals` flag
257+
258+
Pass the flag to build only packages in the local database. Fails if the build
259+
plan includes packages in the snapshot database.
260+
256261
### The `stack build --only-snapshot` flag
257262

258263
Pass the flag to build only snapshot dependencies, which are cached and shared
@@ -357,12 +362,21 @@ symbols.
357362
Pass the flag to enable profiling in libraries, executables, etc. for all
358363
expressions, and generate a backtrace on exception.
359364

360-
## Other flags and options
365+
## Flags relating to build outputs
361366

362-
There are a number of other flags accepted by `stack build`. Instead of listing
363-
all of them, please use `stack build --help`. Some particularly convenient ones
364-
worth mentioning here since they compose well with the rest of the build system
365-
as described:
367+
### The `stack build --[no]-cabal-verbose` flag
368+
369+
Default: Disabled
370+
371+
Set the flag to enable verbose output from Cabal (the library). This flag is an
372+
alternative to the `--cabal-verbosity` option.
373+
374+
### The `stack build --[no]-cabal-verbosity` option
375+
376+
`stack build --cabal-verbosity <verbosity_level>` sets the specified verbosity
377+
level for output from Cabal (the library). It accepts Cabal's numerical and
378+
extended syntax. This option is an alternative to setting the `--cabal-verbose`
379+
flag.
366380

367381
### The `stack build --[no-]copy-bins` flag
368382

@@ -383,16 +397,22 @@ binary directory (see `stack path --compiler-tools-bin`).
383397
Pass the flag to generate a code coverage report. For further information, see
384398
the [code coverage](hpc_command.md) documentation.
385399

386-
### The `stack build --exec` option
400+
### The `stack build --ddump-dir` option
387401

388-
`stack build --exec "<command> [<arguments>]"` will run a command after a
389-
successful build.
402+
GHC has a number of `ddump-*` flags and options to allow dumping out of
403+
intermediate structures produced by the compiler. They include the
404+
`-ddump-to-file` flag that causes the output from other flags to be dumped to a
405+
file or files.
390406

391-
### The `stack build --file-watch` flag
407+
`stack build --ddump_dir <relative_directory>` causes Stack to copy `*.dump-*`
408+
files to subdirectories of the specified directory, which is relative to Stack's
409+
working directory for the project.
392410

393-
Pass the flag to rebuild your project every time a file changes. By default it
394-
will take into account all files belonging to the targets you specify. See also
395-
the `--watch-all` flag.
411+
For example:
412+
413+
~~~text
414+
stack build --ghc-options "-ddump-to-file -ddump-timings" --ddump-dir my-ddump-dir
415+
~~~
396416

397417
### The `stack build --[no-]interleaved-output` flag
398418

@@ -454,6 +474,29 @@ Default: Disabled
454474

455475
Set the flag to enable opening the local Haddock documentation in the browser.
456476

477+
## Other flags and options
478+
479+
There are a number of other flags accepted by `stack build`. Instead of listing
480+
all of them, please use `stack build --help`. Some particularly convenient ones
481+
worth mentioning here since they compose well with the rest of the build system
482+
as described:
483+
484+
### The `stack build --exec` option
485+
486+
`stack build --exec "<command> [<arguments>]"` will run a command after a
487+
successful build.
488+
489+
### The `stack build --file-watch` flag
490+
491+
Pass the flag to rebuild your project every time a file changes. By default it
492+
will take into account all files belonging to the targets you specify. See also
493+
the `--watch-all` flag.
494+
495+
### The `stack build --file-watch-poll` flag
496+
497+
Like the `--file-watch` flag, but based on polling the file system instead of
498+
using events to determine if a file has changed.
499+
457500
### The `stack build --[no]-prefetch` flag
458501

459502
Default: Disabled

0 commit comments

Comments
 (0)