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       --build-info
31           Show build information.
32
33       --context=CONTEXT (absent=default)
34           Run the command in this build context.
35
36       -f, --force
37           Force actions associated to aliases to be re-executed even if their
38           dependencies haven't changed.
39
40       --help[=FMT] (default=auto)
41           Show this help in format FMT. The value FMT must be one of `auto',
42           `pager', `groff' or `plain'. With `auto', the format is `pager` or
43           `plain' whenever the TERM env var is `dumb' or undefined.
44
45       --no-build
46           don't rebuild target before executing
47
48       --sandbox=VAL (absent DUNE_SANDBOX env)
49           Sandboxing mode to use by default. Some actions require a certain
50           sandboxing mode, so they will ignore this setting. The allowed
51           values are: none, symlink, copy.
52
53       --version
54           Show version information.
55
56       -w, --watch
57           Instead of terminating build after completion, wait continuously
58           for file changes.
59

COMMON OPTIONS

61       These options are common to all commands.
62
63       --always-show-command-line
64           Always show the full command lines of programs executed by dune
65
66       --auto-promote
67           Automatically promote files. This is similar to running dune
68           promote after the build.
69
70       --build-dir=FILE (absent DUNE_BUILD_DIR env)
71           Specified build directory. _build if unspecified
72
73       --cache=VAL (absent DUNE_CACHE env)
74           Activate binary cache (either `disabled' or `enabled'). Default is
75           `disabled'.
76
77       --cache-check-probability=VAL (absent=0. or
78       DUNE_CACHE_CHECK_PROBABILITY env)
79           Probability cached rules are rerun to check for reproducibility
80
81       --cache-duplication=VAL (absent DUNE_CACHE_DUPLICATION env)
82           Binary cache duplication mode
83
84       --cache-transport=VAL (absent DUNE_CACHE_TRANSPORT env)
85           Binary cache protocol
86
87       --config-file=FILE
88           Load this configuration file instead of the default one.
89
90       --debug-artifact-substitution
91           Print debugging info about artifact substitution
92
93       --debug-backtraces
94           Always print exception backtraces.
95
96       --debug-dependency-path
97           In case of error, print the dependency path from the targets on the
98           command line to the rule that failed.
99
100       --debug-findlib
101           Debug the findlib sub-system.
102
103       --default-target=TARGET (absent=@@default)
104           Set the default target that when none is specified to dune build.
105
106       --diff-command=VAL
107           Shell command to use to diff files. Use - to disable printing the
108           diff.
109
110       --disable-promotion (absent DUNE_DISABLE_PROMOTION env)
111           Disable all promotion rules
112
113       --display=MODE
114           Control the display mode of Dune. See dune-config(5) for more
115           details.
116
117       --ignore-promoted-rules
118           Ignore rules with (mode promote), except ones with (only ...). The
119           variable %{ignoring_promoted_rules} in dune files reflects whether
120           this option was passed or not.
121
122       --instrument-with=BACKENDS (absent DUNE_INSTRUMENT_WITH env)
123           "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
124           list of library names, each one of which must declare an
125           instrumentation backend.
126
127       -j JOBS
128           Run no more than JOBS commands simultaneously.
129
130       --no-buffer
131           Do not buffer the output of commands executed by dune. By default
132           dune buffers the output of subcommands, in order to prevent
133           interleaving when multiple commands are executed in parallel.
134           However, this can be an issue when debugging long running tests.
135           With --no-buffer, commands have direct access to the terminal. Note
136           that as a result their output won't be captured in the log file.
137           You should use this option in conjunction with -j 1, to avoid
138           interleaving. Additionally you should use --verbose as well, to
139           make sure that commands are printed before they are being executed.
140
141       --no-config
142           Do not load the configuration file
143
144       --no-print-directory
145           Suppress "Entering directory" messages
146
147       --only-packages=PACKAGES
148           Ignore stanzas referring to a package that is not in PACKAGES.
149           PACKAGES is a comma-separated list of package names. Note that this
150           has the same effect as deleting the relevant stanzas from dune
151           files. It is mostly meant for releases. During development, it is
152           likely that what you want instead is to build a particular
153           <package>.install target.
154
155       -p PACKAGES, --for-release-of-packages=PACKAGES (required)
156           Shorthand for --release --only-packages PACKAGE. You must use this
157           option in your <package>.opam files, in order to build only what's
158           necessary when your project contains multiple packages as well as
159           getting reproducible builds.
160
161       --profile=VAL (absent DUNE_PROFILE env)
162           Select the build profile, for instance dev or release. The default
163           is dev.
164
165       --promote-install-files[=VAL] (default=true)
166           Promote the generated <package>.install files to the source tree
167
168       --release
169           Put dune into a reproducible release mode. This is in fact a
170           shorthand for --root . --ignore-promoted-rules --no-config
171           --profile release --always-show-command-line
172           --promote-install-files --default-target @install. You should use
173           this option for release builds. For instance, you must use this
174           option in your <package>.opam files. Except if you already use -p,
175           as -p implies this option.
176
177       --root=DIR
178           Use this directory as workspace root instead of guessing it. Note
179           that this option doesn't change the interpretation of targets given
180           on the command line. It is only intended for scripts.
181
182       --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
183           Store original source location in dune-package metadata
184
185       --terminal-persistence=MODE
186           Changes how the log of build results are displayed to the console
187           between rebuilds while in --watch mode. Supported modes: preserve,
188           clear-on-rebuild.
189
190       --trace-file=FILE
191           Output trace data in catapult format (compatible with
192           chrome://tracing)
193
194       --verbose
195           Same as --display verbose
196
197       --workspace=FILE (absent DUNE_WORKSPACE env)
198           Use this specific workspace file instead of looking it up.
199
200       -x VAL
201           Cross-compile using this toolchain.
202

MORE HELP

204       Use `dune COMMAND --help' for help on a single command.
205

ENVIRONMENT

207       These environment variables affect the execution of exec:
208
209       DUNE_BUILD_DIR
210           Specified build directory. _build if unspecified
211
212       DUNE_CACHE
213           Activate binary cache (either `disabled' or `enabled'). Default is
214           `disabled'.
215
216       DUNE_CACHE_CHECK_PROBABILITY
217           Probability cached rules are rerun to check for reproducibility
218
219       DUNE_CACHE_DUPLICATION
220           Binary cache duplication mode
221
222       DUNE_CACHE_TRANSPORT
223           Binary cache protocol
224
225       DUNE_DISABLE_PROMOTION
226           Disable all promotion rules
227
228       DUNE_INSTRUMENT_WITH
229           "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
230           list of library names, each one of which must declare an
231           instrumentation backend.
232
233       DUNE_PROFILE
234           Build profile. dev if unspecified or release if -p is set.
235
236       DUNE_SANDBOX
237           Sandboxing mode to use by default. (see --sandbox)
238
239       DUNE_STORE_ORIG_SOURCE_DIR
240           Store original source location in dune-package metadata
241
242       DUNE_WORKSPACE
243           Use this specific workspace file instead of looking it up.
244

BUGS

246       Check bug reports at https://github.com/ocaml/dune/issues
247

EXAMPLES

249       1.  Run the executable named `my_exec':
250
251             dune exec my_exec
252
253       2.  Run the executable defined in `foo.ml' with the argument `arg':
254
255             dune exec ./foo.exe -- arg
256
257
258
259Dune n/a                                                          DUNE-EXEC(1)
Impressum