Skip to content

Commit f57cc68

Browse files
committed
Extend documentation of stack build flag and options
1 parent 4e5cfa7 commit f57cc68

File tree

1 file changed

+130
-10
lines changed

1 file changed

+130
-10
lines changed

doc/build_command.md

Lines changed: 130 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ retained, with the following flags:
146146
### The `stack build --bench` flag
147147

148148
Pass the flag to add benchmark components to the targets, if specific components
149-
are not identified.
149+
are not identified. The `stack bench` synonym sets this flag.
150150

151151
### The `stack build --dependencies-only` flag
152152

@@ -193,7 +193,31 @@ based on file dirtiness.
193193
Default: Disabled
194194

195195
Set the flag to build Haddock documentation. This may cause a lot of packages to
196-
get re-built, so that the documentation links work.
196+
get re-built, so that the documentation links work. The `stack haddock` synonym
197+
sets this flag.
198+
199+
### The `stack build --haddock-arguments` option
200+
201+
`stack haddock --haddock-arguments <haddock_arguments>` passes the specified
202+
arguments to the Haddock tool.
203+
204+
### The `stack build --[no-]haddock-deps` flag
205+
206+
Default: Enabled (if building Haddock documnentation)
207+
208+
Unset the flag to disable building Haddock documentation for dependencies.
209+
210+
### The `stack build --[no-]haddock-hyperlink-source` flag
211+
212+
Default: Enabled
213+
214+
Unset the flag to disable building building hyperlinked source for Haddock.
215+
216+
### The `stack build --[no-]haddock-internal` flag
217+
218+
Default: Disabled
219+
220+
Set the flag to enable building Haddock documentation for internal modules.
197221

198222
### The `stack build --[no-]keep-going` flag
199223

@@ -256,7 +280,82 @@ This option can be specified multiple times to skip multiple components.
256280
### The `stack build --test` flag
257281

258282
Pass the flag to add test suite components to the targets, if specific
259-
components are not identified.
283+
components are not identified. The `stack test` synonym sets this flag.
284+
285+
## Flags affecting GHC's behaviour
286+
287+
### The `stack build --[no-]executable-profiling` flag
288+
289+
Default: Disabled
290+
291+
Set the flag to enable executable profiling for TARGETs and all its
292+
dependencies.
293+
294+
### The `stack build --[no-]executable-stripping` flag
295+
296+
Default: Enabled
297+
298+
Unset the flag to disable executable stripping for TARGETs and all its
299+
dependencies.
300+
301+
### The `stack build --fast` flag
302+
303+
Pass the flag to build your project with the GHC option `-O0`. `-O0` disables
304+
GHC's optimisations (which is GHC's default).
305+
306+
### The `stack build --ghc-options` option
307+
308+
`stack build ghc-options <ghc_options>` passes the specified options to GHC.
309+
310+
### The `stack build --[no-]library-profiling` flag
311+
312+
Default: Disabled
313+
314+
Set the flag to enable library profiling for TARGETs and all its dependencies.
315+
316+
### The `stack build --[no-]library-stripping` flag
317+
318+
Default: Enabled
319+
320+
Unset the flag to disable library stripping for TARGETs and all its
321+
dependencies.
322+
323+
### The `stack build --pedantic` flag
324+
325+
Pass the flag to build your project with the GHC options `-Wall` and `-Werror`.
326+
`-Wall` turns on all warning options that indicate potentially suspicious code.
327+
`-Werror` makes any warning into a fatal error.
328+
329+
### The `stack build --profile` flag
330+
331+
Pass the flag to enable profiling in libraries, executables, etc. for all
332+
expressions, and generate a profiling report in tests or benchmarks.
333+
334+
### The `stack build --[no-]split-objs` flag
335+
336+
Default: Disabled
337+
338+
Set the flag to enable the GHC option `--split-objs`. This will reduce output
339+
size (at the cost of build time).
340+
341+
!!! note
342+
343+
This feature is EXPERIMENTAL, and its behavior may be changed and improved.
344+
You will need to clean your workdirs before use. If you want to compile all
345+
dependencies with split-objs, you will need to delete the snapshot (and all
346+
snapshots that could reference that snapshot).
347+
348+
### The `stack build --no-strip` flag
349+
350+
Pass the flag to disable DWARF debugging symbol stripping in libraries,
351+
executables, etc. for all expressions, producing larger executables but allowing
352+
the use of standard debuggers/profiling tools/other utilities that use debugging
353+
symbols.
354+
355+
### The `stack build --trace` flag
356+
357+
Pass the flag to enable profiling in libraries, executables, etc. for all
358+
expressions, and generate a backtrace on exception.
260359

261360
## Other flags and options
262361

@@ -265,6 +364,20 @@ all of them, please use `stack build --help`. Some particularly convenient ones
265364
worth mentioning here since they compose well with the rest of the build system
266365
as described:
267366

367+
### The `stack build --[no-]copy-bins` flag
368+
369+
Default: Disabled
370+
371+
Set the flag to enable copying binaries to Stack's local binary directory (see
372+
`stack path --local-bin`). The `stack install` synonym sets this flag.
373+
374+
### The `stack build --[no-]copy-compiler-tool` flag
375+
376+
Default: Disabled
377+
378+
Set the flag to enable copying binaries of targets to Stack's compiler tools
379+
binary directory (see `stack path --compiler-tools-bin`).
380+
268381
### The `stack build --coverage` flag
269382

270383
Pass the flag to generate a code coverage report. For further information, see
@@ -335,16 +448,18 @@ package is targetted in a multi-package project (for example, using
335448
default `dump-logs` mode is to output the contents of the log files that are
336449
warnings.
337450

338-
### The `stack build --pedantic` flag
451+
### The `stack build --[no]-open` flag
339452

340-
Pass the flag to build your project with the GHC options `-Wall` and `-Werror`.
341-
`-Wall` turns on all warning options that indicate potentially suspicious code.
342-
`-Werror` makes any warning into a fatal error.
453+
Default: Disabled
343454

344-
### The `stack build --watch-all` flag
455+
Set the flag to enable opening the local Haddock documentation in the browser.
345456

346-
Pass the flag to rebuild your project every time any local file changes (from
347-
project packages or from local dependencies). See also the `--file-watch` flag.
457+
### The `stack build --[no]-prefetch` flag
458+
459+
Default: Disabled
460+
461+
Set the flag to enable fetching packages necessary for the build immediately.
462+
This can be useful with `stack build --dry-run`.
348463

349464
### The `stack build --tests-allow-stdin` flag
350465

@@ -360,6 +475,11 @@ specification and allow the executable to receive input on that channel. If you
360475
pass `--no-tests-allow-stdin` and the executable seeks input on the standard
361476
input channel, an exception will be thown.
362477

478+
### The `stack build --watch-all` flag
479+
480+
Pass the flag to rebuild your project every time any local file changes (from
481+
project packages or from local dependencies). See also the `--file-watch` flag.
482+
363483
## Examples
364484

365485
* `stack build --test --copy-bins` or, equivalently, `stack test --copy-bins`

0 commit comments

Comments
 (0)