Skip to content

Commit 87f1c1c

Browse files
committed
Simplify stack build flag/option subheadings
1 parent 8312baf commit 87f1c1c

File tree

1 file changed

+65
-66
lines changed

1 file changed

+65
-66
lines changed

doc/build_command.md

Lines changed: 65 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -143,23 +143,23 @@ about how these dependencies get specified.
143143
In addition to specifying targets, you can also control what gets built, or
144144
retained, with the following flags:
145145

146-
### The `stack build --bench` flag
146+
### `--bench` flag
147147

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

151-
### The `stack build --dependencies-only` flag
151+
### `--dependencies-only` flag
152152

153153
Pass the flag to skip building the targets. The flag `--only-dependencies` has
154154
the same effect.
155155

156-
### The `stack build --[no-]dry-run` flag
156+
### `--[no-]dry-run` flag
157157

158158
Default: Disabled
159159

160160
Set the flag to build nothing and output information about the build plan.
161161

162-
### The `stack build --flag` option
162+
### `--flag` option
163163

164164
`stack build --flag <package_name>:[-]<flag_name>` sets (or unsets) the
165165
specified Cabal flag for the specified package.
@@ -181,45 +181,45 @@ stack build --flag *:[-]<flag)name>
181181
behavior currently and doesn't require that the modules be listed. This may
182182
change in a future release.
183183

184-
### The `stack build --[no-]force-dirty` flag
184+
### `--[no-]force-dirty` flag
185185

186186
Default: Disabled
187187

188188
Set the flag to force rebuild of packages even when it doesn't seem necessary
189189
based on file dirtiness.
190190

191-
### The `stack build --[no-]haddock` flag
191+
### `--[no-]haddock` flag
192192

193193
Default: Disabled
194194

195195
Set the flag to build Haddock documentation. This may cause a lot of packages to
196196
get re-built, so that the documentation links work. The `stack haddock` synonym
197197
sets this flag.
198198

199-
### The `stack build --haddock-arguments` option
199+
### `--haddock-arguments` option
200200

201201
`stack haddock --haddock-arguments <haddock_arguments>` passes the specified
202202
arguments to the Haddock tool.
203203

204-
### The `stack build --[no-]haddock-deps` flag
204+
### `--[no-]haddock-deps` flag
205205

206206
Default: Enabled (if building Haddock documnentation)
207207

208208
Unset the flag to disable building Haddock documentation for dependencies.
209209

210-
### The `stack build --[no-]haddock-hyperlink-source` flag
210+
### `--[no-]haddock-hyperlink-source` flag
211211

212212
Default: Enabled
213213

214214
Unset the flag to disable building building hyperlinked source for Haddock.
215215

216-
### The `stack build --[no-]haddock-internal` flag
216+
### `--[no-]haddock-internal` flag
217217

218218
Default: Disabled
219219

220220
Set the flag to enable building Haddock documentation for internal modules.
221221

222-
### The `stack build --[no-]keep-going` flag
222+
### `--[no-]keep-going` flag
223223

224224
Default (`stack build`): Disabled
225225

@@ -228,15 +228,15 @@ Default (`stack test` or `stack bench`): Enabled
228228
Set the flag to continue building packages even after some build step fails.
229229
The packages which depend upon the failed build won't get built.
230230

231-
### The `stack build --[no-]keep-tmp-files` flag
231+
### `--[no-]keep-tmp-files` flag
232232

233233
Default: Disabled
234234

235235
Set the flag to keep intermediate files and build directories that would
236236
otherwise be considered temporary and deleted. It may be useful to inspect
237237
these, if a build fails. By default, they are not kept.
238238

239-
### The `stack build --only-configure` flag
239+
### `--only-configure` flag
240240

241241
[:octicons-tag-24: 0.1.4.0](https://github.com/commercialhaskell/stack/releases/tag/v0.1.4.0)
242242

@@ -248,30 +248,30 @@ intended for tool usage. It may break when used on multiple packages at once.
248248
If there are downstream actions that require a package to be built then a
249249
full build will occur, even if the flag is passed.
250250

251-
### The `stack build --only-dependencies` flag
251+
### `--only-dependencies` flag
252252

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
256+
### `--only-locals` flag
257257

258258
Pass the flag to build only packages in the local database. Fails if the build
259259
plan includes packages in the snapshot database.
260260

261-
### The `stack build --only-snapshot` flag
261+
### `--only-snapshot` flag
262262

263263
Pass the flag to build only snapshot dependencies, which are cached and shared
264264
with other projects.
265265

266-
### The `stack build --[no-]reconfigure` flag
266+
### `--[no-]reconfigure` flag
267267

268268
Default: Disabled
269269

270270
Set the flag to force reconfiguration even when it doesn't seem necessary based
271271
on file dirtiness. This is sometimes useful with custom `Setup.hs` files, in
272272
particular when they depend on external data files.
273273

274-
### The `stack build --skip` option
274+
### `--skip` option
275275

276276
`stack build --skip <component>` skips building the specified components of a
277277
local package. It allows you to skip test suites and benchmark without
@@ -282,61 +282,86 @@ executables won't work the first time the package is built due to an issue in
282282

283283
This option can be specified multiple times to skip multiple components.
284284

285-
### The `stack build --test` flag
285+
### `--test` flag
286286

287287
Pass the flag to add test suite components to the targets, if specific
288288
components are not identified. The `stack test` synonym sets this flag.
289289

290+
## Controlling when building occurs
291+
292+
### `--file-watch` flag
293+
294+
Pass the flag to rebuild your project every time a file changes. By default it
295+
will take into account all files belonging to the targets you specify. See also
296+
the `--watch-all` flag.
297+
298+
### `--file-watch-poll` flag
299+
300+
Like the `--file-watch` flag, but based on polling the file system instead of
301+
using events to determine if a file has changed.
302+
303+
### `--watch-all` flag
304+
305+
Pass the flag to rebuild your project every time any local file changes (from
306+
project packages or from local dependencies). See also the `--file-watch` flag.
307+
308+
## Controlling what happens after building
309+
310+
### `--exec` option
311+
312+
`stack build --exec "<command> [<arguments>]"` will run the specified command
313+
after a successful build.
314+
290315
## Flags affecting GHC's behaviour
291316

292-
### The `stack build --[no-]executable-profiling` flag
317+
### `--[no-]executable-profiling` flag
293318

294319
Default: Disabled
295320

296321
Set the flag to enable executable profiling for TARGETs and all its
297322
dependencies.
298323

299-
### The `stack build --[no-]executable-stripping` flag
324+
### `--[no-]executable-stripping` flag
300325

301326
Default: Enabled
302327

303328
Unset the flag to disable executable stripping for TARGETs and all its
304329
dependencies.
305330

306-
### The `stack build --fast` flag
331+
### `--fast` flag
307332

308333
Pass the flag to build your project with the GHC option `-O0`. `-O0` disables
309334
GHC's optimisations (which is GHC's default).
310335

311-
### The `stack build --ghc-options` option
336+
### `--ghc-options` option
312337

313338
`stack build ghc-options <ghc_options>` passes the specified options to GHC.
314339

315-
### The `stack build --[no-]library-profiling` flag
340+
### `--[no-]library-profiling` flag
316341

317342
Default: Disabled
318343

319344
Set the flag to enable library profiling for TARGETs and all its dependencies.
320345

321-
### The `stack build --[no-]library-stripping` flag
346+
### `--[no-]library-stripping` flag
322347

323348
Default: Enabled
324349

325350
Unset the flag to disable library stripping for TARGETs and all its
326351
dependencies.
327352

328-
### The `stack build --pedantic` flag
353+
### `--pedantic` flag
329354

330355
Pass the flag to build your project with the GHC options `-Wall` and `-Werror`.
331356
`-Wall` turns on all warning options that indicate potentially suspicious code.
332357
`-Werror` makes any warning into a fatal error.
333358

334-
### The `stack build --profile` flag
359+
### `--profile` flag
335360

336361
Pass the flag to enable profiling in libraries, executables, etc. for all
337362
expressions, and generate a profiling report in tests or benchmarks.
338363

339-
### The `stack build --[no-]split-objs` flag
364+
### `--[no-]split-objs` flag
340365

341366
Default: Disabled
342367

@@ -350,54 +375,54 @@ size (at the cost of build time).
350375
dependencies with split-objs, you will need to delete the snapshot (and all
351376
snapshots that could reference that snapshot).
352377

353-
### The `stack build --no-strip` flag
378+
### `--no-strip` flag
354379

355380
Pass the flag to disable DWARF debugging symbol stripping in libraries,
356381
executables, etc. for all expressions, producing larger executables but allowing
357382
the use of standard debuggers/profiling tools/other utilities that use debugging
358383
symbols.
359384

360-
### The `stack build --trace` flag
385+
### `--trace` flag
361386

362387
Pass the flag to enable profiling in libraries, executables, etc. for all
363388
expressions, and generate a backtrace on exception.
364389

365390
## Flags relating to build outputs
366391

367-
### The `stack build --[no]-cabal-verbose` flag
392+
### `--[no]-cabal-verbose` flag
368393

369394
Default: Disabled
370395

371396
Set the flag to enable verbose output from Cabal (the library). This flag is an
372397
alternative to the `--cabal-verbosity` option.
373398

374-
### The `stack build --[no]-cabal-verbosity` option
399+
### `--[no]-cabal-verbosity` option
375400

376401
`stack build --cabal-verbosity <verbosity_level>` sets the specified verbosity
377402
level for output from Cabal (the library). It accepts Cabal's numerical and
378403
extended syntax. This option is an alternative to setting the `--cabal-verbose`
379404
flag.
380405

381-
### The `stack build --[no-]copy-bins` flag
406+
### `--[no-]copy-bins` flag
382407

383408
Default: Disabled
384409

385410
Set the flag to enable copying binaries to Stack's local binary directory (see
386411
`stack path --local-bin`). The `stack install` synonym sets this flag.
387412

388-
### The `stack build --[no-]copy-compiler-tool` flag
413+
### `--[no-]copy-compiler-tool` flag
389414

390415
Default: Disabled
391416

392417
Set the flag to enable copying binaries of targets to Stack's compiler tools
393418
binary directory (see `stack path --compiler-tools-bin`).
394419

395-
### The `stack build --coverage` flag
420+
### `--coverage` flag
396421

397422
Pass the flag to generate a code coverage report. For further information, see
398423
the [code coverage](hpc_command.md) documentation.
399424

400-
### The `stack build --ddump-dir` option
425+
### `--ddump-dir` option
401426

402427
GHC has a number of `ddump-*` flags and options to allow dumping out of
403428
intermediate structures produced by the compiler. They include the
@@ -414,7 +439,7 @@ For example:
414439
stack build --ghc-options "-ddump-to-file -ddump-timings" --ddump-dir my-ddump-dir
415440
~~~
416441

417-
### The `stack build --[no-]interleaved-output` flag
442+
### `--[no-]interleaved-output` flag
418443

419444
[:octicons-tag-24: 2.1.1](https://github.com/commercialhaskell/stack/releases/tag/v2.1.1)
420445

@@ -468,43 +493,22 @@ package is targetted in a multi-package project (for example, using
468493
default `dump-logs` mode is to output the contents of the log files that are
469494
warnings.
470495

471-
### The `stack build --[no]-open` flag
496+
### `--[no]-open` flag
472497

473498
Default: Disabled
474499

475500
Set the flag to enable opening the local Haddock documentation in the browser.
476501

477502
## Other flags and options
478503

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-
500-
### The `stack build --[no]-prefetch` flag
504+
### `--[no]-prefetch` flag
501505

502506
Default: Disabled
503507

504508
Set the flag to enable fetching packages necessary for the build immediately.
505509
This can be useful with `stack build --dry-run`.
506510

507-
### The `stack build --tests-allow-stdin` flag
511+
### `--tests-allow-stdin` flag
508512

509513
[:octicons-tag-24: 2.9.3](https://github.com/commercialhaskell/stack/releases/tag/v2.9.3)
510514

@@ -518,11 +522,6 @@ specification and allow the executable to receive input on that channel. If you
518522
pass `--no-tests-allow-stdin` and the executable seeks input on the standard
519523
input channel, an exception will be thown.
520524

521-
### The `stack build --watch-all` flag
522-
523-
Pass the flag to rebuild your project every time any local file changes (from
524-
project packages or from local dependencies). See also the `--file-watch` flag.
525-
526525
## Examples
527526

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

0 commit comments

Comments
 (0)