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-backtraces
71 Always print exception backtraces.
72
73 --debug-dependency-path
74 In case of error, print the dependency path from the targets on the
75 command line to the rule that failed.
76
77 --debug-findlib
78 Debug the findlib sub-system.
79
80 --default-target=TARGET (absent=@@default)
81 Set the default target that when none is specified to dune build.
82
83 --diff-command=VAL
84 Shell command to use to diff files. Use - to disable printing the
85 diff.
86
87 --disable-promotion (absent DUNE_DISABLE_PROMOTION env)
88 Disable all promotion rules
89
90 --display=MODE
91 Control the display mode of Dune. See dune-config(5) for more
92 details.
93
94 --ignore-promoted-rules
95 Ignore rules with (mode promote), except ones with (only ...). The
96 variable %{ignoring_promoted_rules} in dune files reflects whether
97 this option was passed or not.
98
99 -j JOBS
100 Run no more than JOBS commands simultaneously.
101
102 --no-buffer
103 Do not buffer the output of commands executed by dune. By default
104 dune buffers the output of subcommands, in order to prevent
105 interleaving when multiple commands are executed in parallel.
106 However, this can be an issue when debugging long running tests.
107 With --no-buffer, commands have direct access to the terminal. Note
108 that as a result their output won't be captured in the log file.
109 You should use this option in conjunction with -j 1, to avoid
110 interleaving. Additionally you should use --verbose as well, to
111 make sure that commands are printed before they are being executed.
112
113 --no-config
114 Do not load the configuration file
115
116 --no-print-directory
117 Suppress "Entering directory" messages
118
119 --only-packages=PACKAGES
120 Ignore stanzas referring to a package that is not in PACKAGES.
121 PACKAGES is a comma-separated list of package names. Note that this
122 has the same effect as deleting the relevant stanzas from dune
123 files. It is mostly meant for releases. During development, it is
124 likely that what you want instead is to build a particular
125 <package>.install target.
126
127 -p PACKAGES, --for-release-of-packages=PACKAGES
128 Shorthand for --release --only-packages PACKAGE. You must use this
129 option in your <package>.opam files, in order to build only what's
130 necessary when your project contains multiple packages as well as
131 getting reproducible builds.
132
133 --profile=VAL (absent DUNE_PROFILE env)
134 Select the build profile, for instance dev or release. The default
135 is dev.
136
137 --promote-install-files
138 Promote the generated <package>.install files to the source tree
139
140 --release
141 Put dune into a reproducible release mode. This is in fact a
142 shorthand for --root . --ignore-promoted-rules --no-config
143 --profile release --always-show-command-line
144 --promote-install-files --default-target @install. You should use
145 this option for release builds. For instance, you must use this
146 option in your <package>.opam files. Except if you already use -p,
147 as -p implies this option.
148
149 --root=DIR
150 Use this directory as workspace root instead of guessing it. Note
151 that this option doesn't change the interpretation of targets given
152 on the command line. It is only intended for scripts.
153
154 --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
155 Store original source location in dune-package metadata
156
157 --terminal-persistence=MODE
158 Changes how the log of build results are displayed to the console
159 between rebuilds while in --watch mode.
160
161 --trace-file=FILE
162 Output trace data in catapult format (compatible with
163 chrome://tracing)
164
165 --verbose
166 Same as --display verbose
167
168 --workspace=FILE (absent DUNE_WORKSPACE env)
169 Use this specific workspace file instead of looking it up.
170
171 -x VAL
172 Cross-compile using this toolchain.
173
175 Use `dune COMMAND --help' for help on a single command.
176
178 These environment variables affect the execution of build:
179
180 DUNE_BUILD_DIR
181 Specified build directory. _build if unspecified
182
183 DUNE_CACHE
184 Activate binary cache (either `disabled' or `enabled'). Default is
185 `disabled'.
186
187 DUNE_CACHE_CHECK_PROBABILITY
188 Probability cached rules are rerun to check for reproducibility
189
190 DUNE_CACHE_DUPLICATION
191 Binary cache duplication mode
192
193 DUNE_CACHE_TRANSPORT
194 Binary cache protocol
195
196 DUNE_DISABLE_PROMOTION
197 Disable all promotion rules
198
199 DUNE_PROFILE
200 Build profile. dev if unspecified or release if -p is set.
201
202 DUNE_SANDBOX
203 Sandboxing mode to use by default. (see --sandbox)
204
205 DUNE_STORE_ORIG_SOURCE_DIR
206 Store original source location in dune-package metadata
207
208 DUNE_WORKSPACE
209 Use this specific workspace file instead of looking it up.
210
212 Check bug reports at https://github.com/ocaml/dune/issues
213
215 1. Build all targets in the current source tree:
216
217 dune build
218
219 2. Build targets in the `./foo/bar' directory:
220
221 dune build ./foo/bar
222
223 3. Build the minimal set of targets required for tooling such as
224 Merlin (useful for quickly detecting errors):
225
226 dune build @check
227
228 4. Run all code formatting tools in-place:
229
230 dune build --auto-promote @fmt
231
232
233
234Dune n/a dune-build(1)