1DUNE-BUILD(1)                     Dune Manual                    DUNE-BUILD(1)
2
3
4

NAME

6       dune-build - Build the given targets, or all installable targets if
7       none are given.
8

SYNOPSIS

10       dune build [OPTION]… [TARGET]…
11

DESCRIPTION

13       Targets starting with a @ are interpreted as aliases.
14

OPTIONS

16       --action-stderr-on-success=VAL
17           Same as --action-stdout-on-success but for the standard output for
18           error messages. A good default for large mono-repositories is
19           --action-stdout-on-success=swallow
20           --action-stderr-on-success=must-be-empty. This ensures that a
21           successful build has a "clean" empty output.
22
23       --action-stdout-on-success=VAL
24           Specify how to deal with the standard output of actions when they
25           succeed. Possible values are: print to just print it to Dune's
26           output, swallow to completely ignore it and must-be-empty to
27           enforce that the action printed nothing. With must-be-empty, Dune
28           will consider that the action failed if it printed something to its
29           standard output. The default is print.
30
31       --build-info
32           Show build information.
33
34       --error-reporting=VAL (absent=deterministic)
35           Controls when the build errors are reported. early - report errors
36           as soon as they are discovered. deterministic - report errors at
37           the end of the build in a deterministic order. twice - report each
38           error twice: once as soon as the error is discovered and then again
39           at the end of the build, in a deterministic order.
40
41       -f, --force
42           Force actions associated to aliases to be re-executed even if their
43           dependencies haven't changed.
44
45       --file-watcher=VAL (absent=automatic)
46           Mechanism to detect changes in the source. Automatic to make dune
47           run an external program to detect changes. Manual to notify dune
48           that files have changed manually."
49
50       --passive-watch-mode
51           Similar to [--watch], but only start a build when instructed
52           externally by an RPC.
53
54       --react-to-insignificant-changes
55           react to insignificant file system changes; this is only useful for
56           benchmarking dune
57
58       --sandbox=VAL (absent DUNE_SANDBOX env)
59           Sandboxing mode to use by default. Some actions require a certain
60           sandboxing mode, so they will ignore this setting. The allowed
61           values are: none, symlink, copy, hardlink.
62
63       -w, --watch
64           Instead of terminating build after completion, wait continuously
65           for file changes.
66
67       --wait-for-filesystem-clock
68           Dune digest file contents for better incrementally. These digests
69           are themselves cached. In some cases, Dune needs to drop some
70           digest cache entries in order for things to be reliable. This
71           option makes Dune wait for the file system clock to advance so that
72           it doesn't need to drop anything. You should probably not care
73           about this option; it is mostly useful for Dune developers to make
74           Dune tests of the digest cache more reproducible.
75

COMMON OPTIONS

77       These options are common to all commands.
78
79       --always-show-command-line
80           Always show the full command lines of programs executed by dune
81
82       --auto-promote
83           Automatically promote files. This is similar to running dune
84           promote after the build.
85
86       --build-dir=FILE (absent DUNE_BUILD_DIR env)
87           Specified build directory. _build if unspecified
88
89       --cache=VAL (absent DUNE_CACHE env)
90           Enable or disable Dune cache (either enabled or disabled). Default
91           is `disabled'.
92
93       --cache-check-probability=VAL (absent DUNE_CACHE_CHECK_PROBABILITY env)
94           Check build reproducibility by re-executing randomly chosen rules
95           and comparing their results with those stored in Dune cache. Note:
96           by increasing the probability of such checks you slow down the
97           build. The default probability is zero, i.e. no rules are checked.
98
99       --cache-storage-mode=VAL (absent DUNE_CACHE_STORAGE_MODE env)
100           Dune cache storage mode (one of auto, hardlink or copy). Default is
101           `auto'.
102
103       --config-file=FILE
104           Load this configuration file instead of the default one.
105
106       --debug-artifact-substitution
107           Print debugging info about artifact substitution
108
109       --debug-backtraces
110           Always print exception backtraces.
111
112       --debug-cache=VAL
113           Show debug messages on cache misses for the given cache layers.
114           Value is a comma-separated list of cache layer names. All available
115           cache layers: shared,workspace-local,fs.
116
117       --debug-dependency-path
118           In case of error, print the dependency path from the targets on the
119           command line to the rule that failed.
120
121       --debug-digests
122           Explain why Dune decides to re-digest some files
123
124       --debug-load-dir
125           Print debugging info about directory loading
126
127       --debug-store-digest-preimage
128           Store digest preimage for all computed digests, so that it's
129           possible to reverse them later, for debugging. The digests are
130           stored in the shared cache (see --cache flag) as values, even if
131           cache is otherwise disabled. This should be used only for
132           debugging, since it's slow and it litters the shared cache.
133
134       --default-target=TARGET (absent=@@default)
135           Set the default target that when none is specified to dune build.
136
137       --diff-command=VAL (absent DUNE_DIFF_COMMAND env)
138           Shell command to use to diff files. Use - to disable printing the
139           diff.
140
141       --disable-promotion (absent DUNE_DISABLE_PROMOTION env)
142           Disable all promotion rules
143
144       --display=MODE
145           Control the display mode of Dune. See dune-config(5) for more
146           details. Valid values for this option are One of progress, verbose,
147           short or quiet
148
149       --dump-memo-graph=FILE
150           Dumps the dependency graph to a file after the build is complete
151
152       --dump-memo-graph-format=FORMAT (absent=gexf)
153           File format to be used when dumping dependency graph
154
155       --dump-memo-graph-with-timing
156           With --dump-memo-graph, will re-run each cached node in the Memo
157           graph after building and include the runtime in the output. Since
158           all nodes contain a cached value, this will measure just the
159           runtime of each node
160
161       --help[=FMT] (default=auto)
162           Show this help in format FMT. The value FMT must be one of auto,
163           pager, groff or plain. With auto, the format is pager or plain
164           whenever the TERM env var is dumb or undefined.
165
166       --ignore-promoted-rules
167           Ignore rules with (mode promote), except ones with (only ...). The
168           variable %{ignoring_promoted_rules} in dune files reflects whether
169           this option was passed or not.
170
171       --instrument-with=BACKENDS (absent DUNE_INSTRUMENT_WITH env)
172           "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
173           list of library names, each one of which must declare an
174           instrumentation backend.
175
176       -j JOBS
177           Run no more than JOBS commands simultaneously.
178
179       --no-buffer
180           Do not buffer the output of commands executed by dune. By default
181           dune buffers the output of subcommands, in order to prevent
182           interleaving when multiple commands are executed in parallel.
183           However, this can be an issue when debugging long running tests.
184           With --no-buffer, commands have direct access to the terminal. Note
185           that as a result their output won't be captured in the log file.
186           You should use this option in conjunction with -j 1, to avoid
187           interleaving. Additionally you should use --verbose as well, to
188           make sure that commands are printed before they are being executed.
189
190       --no-config
191           Do not load the configuration file
192
193       --no-print-directory
194           Suppress "Entering directory" messages
195
196       --only-packages=PACKAGES
197           Ignore stanzas referring to a package that is not in PACKAGES.
198           PACKAGES is a comma-separated list of package names. Note that this
199           has the same effect as deleting the relevant stanzas from dune
200           files. It is mostly meant for releases. During development, it is
201           likely that what you want instead is to build a particular
202           <package>.install target.
203
204       -p PACKAGES, --for-release-of-packages=PACKAGES (required)
205           Shorthand for --release --only-packages PACKAGE. You must use this
206           option in your <package>.opam files, in order to build only what's
207           necessary when your project contains multiple packages as well as
208           getting reproducible builds.
209
210       --print-metrics
211           Print out various performance metrics after every build
212
213       --profile=VAL (absent DUNE_PROFILE env)
214           Select the build profile, for instance dev or release. The default
215           is dev.
216
217       --promote-install-files[=VAL] (default=true)
218           Promote the generated <package>.install files to the source tree
219
220       --release
221           Put dune into a reproducible release mode. This is in fact a
222           shorthand for --root . --ignore-promoted-rules --no-config
223           --profile release --always-show-command-line
224           --promote-install-files --default-target @install
225           --require-dune-project-file. You should use this option for release
226           builds. For instance, you must use this option in your
227           <package>.opam files. Except if you already use -p, as -p implies
228           this option.
229
230       --require-dune-project-file[=VAL] (default=true)
231           Fail if a dune-project file is missing.
232
233       --root=DIR
234           Use this directory as workspace root instead of guessing it. Note
235           that this option doesn't change the interpretation of targets given
236           on the command line. It is only intended for scripts.
237
238       --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
239           Store original source location in dune-package metadata
240
241       --terminal-persistence=MODE
242           Changes how the log of build results are displayed to the console
243           between rebuilds while in --watch mode. Supported modes: preserve,
244           clear-on-rebuild, clear-on-rebuild-and-flush-history.
245
246       --trace-file=FILE
247           Output trace data in catapult format (compatible with
248           chrome://tracing)
249
250       --verbose
251           Same as --display verbose
252
253       --version
254           Show version information.
255
256       --workspace=FILE (absent DUNE_WORKSPACE env)
257           Use this specific workspace file instead of looking it up.
258
259       -x VAL
260           Cross-compile using this toolchain.
261

MORE HELP

263       Use `dune COMMAND --help' for help on a single command.
264

EXIT STATUS

266       build exits with the following status:
267
268       0   on success.
269
270       123 on indiscriminate errors reported on standard error.
271
272       124 on command line parsing errors.
273
274       125 on unexpected internal errors (bugs).
275

ENVIRONMENT

277       These environment variables affect the execution of build:
278
279       CLICOLOR
280           If different than 0, ANSI colors are supported and should be used
281           when the program isn’t piped. If equal to 0, don’t output ANSI
282           color escape codes
283
284       CLICOLOR_FORCE
285           If different than 0, ANSI colors should be enabled no matter what.
286
287       DUNE_BUILD_DIR
288           Specified build directory. _build if unspecified
289
290       DUNE_CACHE
291           Enable or disable Dune cache (either enabled or disabled). Default
292           is `disabled'.
293
294       DUNE_CACHE_CHECK_PROBABILITY
295           Check build reproducibility by re-executing randomly chosen rules
296           and comparing their results with those stored in Dune cache. Note:
297           by increasing the probability of such checks you slow down the
298           build. The default probability is zero, i.e. no rules are checked.
299
300       DUNE_CACHE_STORAGE_MODE
301           Dune cache storage mode (one of auto, hardlink or copy). Default is
302           `auto'.
303
304       DUNE_DIFF_COMMAND
305           Shell command to use to diff files. Use - to disable printing the
306           diff.
307
308       DUNE_DISABLE_PROMOTION
309           Disable all promotion rules
310
311       DUNE_INSTRUMENT_WITH
312           "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
313           list of library names, each one of which must declare an
314           instrumentation backend.
315
316       DUNE_PROFILE
317           Build profile. dev if unspecified or release if -p is set.
318
319       DUNE_SANDBOX
320           Sandboxing mode to use by default. (see --sandbox)
321
322       DUNE_STORE_ORIG_SOURCE_DIR
323           Store original source location in dune-package metadata
324
325       DUNE_WORKSPACE
326           Use this specific workspace file instead of looking it up.
327

BUGS

329       Check bug reports at https://github.com/ocaml/dune/issues
330

SEE ALSO

332       dune(1)
333

EXAMPLES

335       1.  Build all targets in the current source tree:
336
337             dune build
338
339       2.  Build targets in the `./foo/bar' directory:
340
341             dune build ./foo/bar
342
343       3.  Build the minimal set of targets required for tooling such as
344           Merlin (useful for quickly detecting errors):
345
346             dune build @check
347
348       4.  Run all code formatting tools in-place:
349
350             dune build --auto-promote @fmt
351
352
353
354Dune n/a                                                         DUNE-BUILD(1)
Impressum