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

COMMON OPTIONS

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

MORE HELP

304       Use `dune COMMAND --help' for help on a single command.
305

EXIT STATUS

307       exec exits with the following status:
308
309       0   on success.
310
311       1   if an error happened.
312
313       130 if it was interrupted by a signal.
314

ENVIRONMENT

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

BUGS

360       Check bug reports at https://github.com/ocaml/dune/issues
361

SEE ALSO

363       dune(1)
364

EXAMPLES

366       1.  Run the executable named `my_exec':
367
368             dune exec my_exec
369
370       2.  Run the executable defined in `foo.ml' with the argument `arg':
371
372             dune exec -- ./foo.exe arg
373
374
375
376Dune n/a                                                          DUNE-EXEC(1)
Impressum