1dune-build(1) Dune Manual dune-build(1)
2
3
4
6 dune-build - Build the given targets, or all installable targets if
7 none are given.
8
10 dune build [OPTION]... [TARGET]...
11
13 Targets starting with a @ are interpreted as aliases.
14
16 --build-info
17 Show build information.
18
19 -f, --force
20 Force actions associated to aliases to be re-executed even if their
21 dependencies haven't changed.
22
23 --help[=FMT] (default=auto)
24 Show this help in format FMT. The value FMT must be one of `auto',
25 `pager', `groff' or `plain'. With `auto', the format is `pager` or
26 `plain' whenever the TERM env var is `dumb' or undefined.
27
28 --sandbox=VAL (absent DUNE_SANDBOX env)
29 Sandboxing mode to use by default. Some actions require a certain
30 sandboxing mode, so they will ignore this setting. The allowed
31 values are: none, symlink, copy.
32
33 --version
34 Show version information.
35
36 -w, --watch
37 Instead of terminating build after completion, wait continuously
38 for file changes.
39
41 These options are common to all commands.
42
43 --always-show-command-line
44 Always show the full command lines of programs executed by dune
45
46 --auto-promote
47 Automatically promote files. This is similar to running dune
48 promote after the build.
49
50 --build-dir=FILE (absent DUNE_BUILD_DIR env)
51 Specified build directory. _build if unspecified
52
53 --cache=VAL (absent DUNE_CACHE env)
54 Activate binary cache (either `disabled' or `enabled'). Default is
55 `disabled'.
56
57 --cache-check-probability=VAL (absent=0. or
58 DUNE_CACHE_CHECK_PROBABILITY env)
59 Probability cached rules are rerun to check for reproducibility
60
61 --cache-duplication=VAL (absent DUNE_CACHE_DUPLICATION env)
62 Binary cache duplication mode
63
64 --cache-transport=VAL (absent DUNE_CACHE_TRANSPORT env)
65 Binary cache protocol
66
67 --config-file=FILE
68 Load this configuration file instead of the default one.
69
70 --debug-artifact-substitution
71 Print debugging info about artifact substitution
72
73 --debug-backtraces
74 Always print exception backtraces.
75
76 --debug-dependency-path
77 In case of error, print the dependency path from the targets on the
78 command line to the rule that failed.
79
80 --debug-findlib
81 Debug the findlib sub-system.
82
83 --default-target=TARGET (absent=@@default)
84 Set the default target that when none is specified to dune build.
85
86 --diff-command=VAL
87 Shell command to use to diff files. Use - to disable printing the
88 diff.
89
90 --disable-promotion (absent DUNE_DISABLE_PROMOTION env)
91 Disable all promotion rules
92
93 --display=MODE
94 Control the display mode of Dune. See dune-config(5) for more
95 details.
96
97 --ignore-promoted-rules
98 Ignore rules with (mode promote), except ones with (only ...). The
99 variable %{ignoring_promoted_rules} in dune files reflects whether
100 this option was passed or not.
101
102 --instrument-with=BACKENDS (absent DUNE_INSTRUMENT_WITH env)
103 "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
104 list of library names, each one of which must declare an
105 instrumentation backend.
106
107 -j JOBS
108 Run no more than JOBS commands simultaneously.
109
110 --no-buffer
111 Do not buffer the output of commands executed by dune. By default
112 dune buffers the output of subcommands, in order to prevent
113 interleaving when multiple commands are executed in parallel.
114 However, this can be an issue when debugging long running tests.
115 With --no-buffer, commands have direct access to the terminal. Note
116 that as a result their output won't be captured in the log file.
117 You should use this option in conjunction with -j 1, to avoid
118 interleaving. Additionally you should use --verbose as well, to
119 make sure that commands are printed before they are being executed.
120
121 --no-config
122 Do not load the configuration file
123
124 --no-print-directory
125 Suppress "Entering directory" messages
126
127 --only-packages=PACKAGES
128 Ignore stanzas referring to a package that is not in PACKAGES.
129 PACKAGES is a comma-separated list of package names. Note that this
130 has the same effect as deleting the relevant stanzas from dune
131 files. It is mostly meant for releases. During development, it is
132 likely that what you want instead is to build a particular
133 <package>.install target.
134
135 -p PACKAGES, --for-release-of-packages=PACKAGES
136 Shorthand for --release --only-packages PACKAGE. You must use this
137 option in your <package>.opam files, in order to build only what's
138 necessary when your project contains multiple packages as well as
139 getting reproducible builds.
140
141 --profile=VAL (absent DUNE_PROFILE env)
142 Select the build profile, for instance dev or release. The default
143 is dev.
144
145 --promote-install-files
146 Promote the generated <package>.install files to the source tree
147
148 --release
149 Put dune into a reproducible release mode. This is in fact a
150 shorthand for --root . --ignore-promoted-rules --no-config
151 --profile release --always-show-command-line
152 --promote-install-files --default-target @install. You should use
153 this option for release builds. For instance, you must use this
154 option in your <package>.opam files. Except if you already use -p,
155 as -p implies this option.
156
157 --root=DIR
158 Use this directory as workspace root instead of guessing it. Note
159 that this option doesn't change the interpretation of targets given
160 on the command line. It is only intended for scripts.
161
162 --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
163 Store original source location in dune-package metadata
164
165 --terminal-persistence=MODE
166 Changes how the log of build results are displayed to the console
167 between rebuilds while in --watch mode.
168
169 --trace-file=FILE
170 Output trace data in catapult format (compatible with
171 chrome://tracing)
172
173 --verbose
174 Same as --display verbose
175
176 --workspace=FILE (absent DUNE_WORKSPACE env)
177 Use this specific workspace file instead of looking it up.
178
179 -x VAL
180 Cross-compile using this toolchain.
181
183 Use `dune COMMAND --help' for help on a single command.
184
186 These environment variables affect the execution of build:
187
188 DUNE_BUILD_DIR
189 Specified build directory. _build if unspecified
190
191 DUNE_CACHE
192 Activate binary cache (either `disabled' or `enabled'). Default is
193 `disabled'.
194
195 DUNE_CACHE_CHECK_PROBABILITY
196 Probability cached rules are rerun to check for reproducibility
197
198 DUNE_CACHE_DUPLICATION
199 Binary cache duplication mode
200
201 DUNE_CACHE_TRANSPORT
202 Binary cache protocol
203
204 DUNE_DISABLE_PROMOTION
205 Disable all promotion rules
206
207 DUNE_INSTRUMENT_WITH
208 "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
209 list of library names, each one of which must declare an
210 instrumentation backend.
211
212 DUNE_PROFILE
213 Build profile. dev if unspecified or release if -p is set.
214
215 DUNE_SANDBOX
216 Sandboxing mode to use by default. (see --sandbox)
217
218 DUNE_STORE_ORIG_SOURCE_DIR
219 Store original source location in dune-package metadata
220
221 DUNE_WORKSPACE
222 Use this specific workspace file instead of looking it up.
223
225 Check bug reports at https://github.com/ocaml/dune/issues
226
228 1. Build all targets in the current source tree:
229
230 dune build
231
232 2. Build targets in the `./foo/bar' directory:
233
234 dune build ./foo/bar
235
236 3. Build the minimal set of targets required for tooling such as
237 Merlin (useful for quickly detecting errors):
238
239 dune build @check
240
241 4. Run all code formatting tools in-place:
242
243 dune build --auto-promote @fmt
244
245
246
247Dune n/a dune-build(1)