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 (required)
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[=VAL] (default=true)
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. Supported modes: preserve,
168 clear-on-rebuild.
169
170 --trace-file=FILE
171 Output trace data in catapult format (compatible with
172 chrome://tracing)
173
174 --verbose
175 Same as --display verbose
176
177 --workspace=FILE (absent DUNE_WORKSPACE env)
178 Use this specific workspace file instead of looking it up.
179
180 -x VAL
181 Cross-compile using this toolchain.
182
184 Use `dune COMMAND --help' for help on a single command.
185
187 These environment variables affect the execution of build:
188
189 DUNE_BUILD_DIR
190 Specified build directory. _build if unspecified
191
192 DUNE_CACHE
193 Activate binary cache (either `disabled' or `enabled'). Default is
194 `disabled'.
195
196 DUNE_CACHE_CHECK_PROBABILITY
197 Probability cached rules are rerun to check for reproducibility
198
199 DUNE_CACHE_DUPLICATION
200 Binary cache duplication mode
201
202 DUNE_CACHE_TRANSPORT
203 Binary cache protocol
204
205 DUNE_DISABLE_PROMOTION
206 Disable all promotion rules
207
208 DUNE_INSTRUMENT_WITH
209 "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
210 list of library names, each one of which must declare an
211 instrumentation backend.
212
213 DUNE_PROFILE
214 Build profile. dev if unspecified or release if -p is set.
215
216 DUNE_SANDBOX
217 Sandboxing mode to use by default. (see --sandbox)
218
219 DUNE_STORE_ORIG_SOURCE_DIR
220 Store original source location in dune-package metadata
221
222 DUNE_WORKSPACE
223 Use this specific workspace file instead of looking it up.
224
226 Check bug reports at https://github.com/ocaml/dune/issues
227
229 1. Build all targets in the current source tree:
230
231 dune build
232
233 2. Build targets in the `./foo/bar' directory:
234
235 dune build ./foo/bar
236
237 3. Build the minimal set of targets required for tooling such as
238 Merlin (useful for quickly detecting errors):
239
240 dune build @check
241
242 4. Run all code formatting tools in-place:
243
244 dune build --auto-promote @fmt
245
246
247
248Dune n/a DUNE-BUILD(1)