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

NAME

6       dune-build - Build the given targets, or the default ones if none are
7       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       --display-separate-messages
35           Separate error messages with a blank line.
36
37       --error-reporting=VAL (absent=deterministic)
38           Controls when the build errors are reported. early - report errors
39           as soon as they are discovered. deterministic - report errors at
40           the end of the build in a deterministic order. twice - report each
41           error twice: once as soon as the error is discovered and then again
42           at the end of the build, in a deterministic order.
43
44       -f, --force
45           Force actions associated to aliases to be re-executed even if their
46           dependencies haven't changed.
47
48       --file-watcher=VAL (absent=automatic)
49           Mechanism to detect changes in the source. Automatic to make dune
50           run an external program to detect changes. Manual to notify dune
51           that files have changed manually."
52
53       --passive-watch-mode
54           Similar to [--watch], but only start a build when instructed
55           externally by an RPC.
56
57       --react-to-insignificant-changes
58           react to insignificant file system changes; this is only useful for
59           benchmarking dune
60
61       --sandbox=VAL (absent DUNE_SANDBOX env)
62           Sandboxing mode to use by default. Some actions require a certain
63           sandboxing mode, so they will ignore this setting. The allowed
64           values are: none, symlink, copy, hardlink.
65
66       -w, --watch
67           Instead of terminating build after completion, wait continuously
68           for file changes.
69
70       --wait-for-filesystem-clock
71           Dune digest file contents for better incrementally. These digests
72           are themselves cached. In some cases, Dune needs to drop some
73           digest cache entries in order for things to be reliable. This
74           option makes Dune wait for the file system clock to advance so that
75           it doesn't need to drop anything. You should probably not care
76           about this option; it is mostly useful for Dune developers to make
77           Dune tests of the digest cache more reproducible.
78

COMMON OPTIONS

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

MORE HELP

284       Use `dune COMMAND --help' for help on a single command.
285

EXIT STATUS

287       build exits with the following status:
288
289       0   on success.
290
291       1   if an error happened.
292
293       130 if it was interrupted by a signal.
294

ENVIRONMENT

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

BUGS

348       Check bug reports at https://github.com/ocaml/dune/issues
349

SEE ALSO

351       dune(1)
352

EXAMPLES

354       1.  Build all targets in the current source tree:
355
356             dune build
357
358       2.  Build targets in the `./foo/bar' directory:
359
360             dune build ./foo/bar
361
362       3.  Build the minimal set of targets required for tooling such as
363           Merlin (useful for quickly detecting errors):
364
365             dune build @check
366
367       4.  Run all code formatting tools in-place:
368
369             dune build --auto-promote @fmt
370
371
372
373Dune n/a                                                         DUNE-BUILD(1)
Impressum