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

NAME

6       dune-exec - Execute a command in a similar environment as if
7       installation was performed.
8

SYNOPSIS

10       dune exec [OPTION]… PROG [ARGS]…
11

DESCRIPTION

13       dune exec -- COMMAND should behave in the same way as if you do:
14
15         $ dune install
16         $ COMMAND
17
18       In particular if you run dune exec ocaml, you will have access to the
19       libraries defined in the workspace using your usual directives
20       (#require for instance)
21
22       When a leading / is present in the command (absolute path), then the
23       path is interpreted as an absolute path
24
25       When a / is present at any other position (relative path), then the
26       path is interpreted as relative to the build context + current working
27       directory (or the value of --root when ran outside of the project root)
28

OPTIONS

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

COMMON OPTIONS

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

MORE HELP

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

EXIT STATUS

286       exec exits with the following status:
287
288       0   on success.
289
290       123 on indiscriminate errors reported on standard error.
291
292       124 on command line parsing errors.
293
294       125 on unexpected internal errors (bugs).
295

ENVIRONMENT

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

BUGS

341       Check bug reports at https://github.com/ocaml/dune/issues
342

SEE ALSO

344       dune(1)
345

EXAMPLES

347       1.  Run the executable named `my_exec':
348
349             dune exec my_exec
350
351       2.  Run the executable defined in `foo.ml' with the argument `arg':
352
353             dune exec -- ./foo.exe arg
354
355
356
357Dune n/a                                                          DUNE-EXEC(1)
Impressum