1DUNE-FMT(1)                       Dune Manual                      DUNE-FMT(1)
2
3
4

NAME

6       dune-fmt - Format source code.
7

SYNOPSIS

9       dune fmt [OPTION]…
10

DESCRIPTION

12       dune fmt runs the formatter on the source code. The formatter is
13       automatically selected. ocamlformat is used to format OCaml source code
14       (*.ml and *.mli files) and refmt is used to format Reason source code
15       (*.re and *.rei files).
16

OPTIONS

18       --action-stderr-on-success=VAL
19           Same as --action-stdout-on-success but for the standard output for
20           error messages. A good default for large mono-repositories is
21           --action-stdout-on-success=swallow
22           --action-stderr-on-success=must-be-empty. This ensures that a
23           successful build has a "clean" empty output.
24
25       --action-stdout-on-success=VAL
26           Specify how to deal with the standard output of actions when they
27           succeed. Possible values are: print to just print it to Dune's
28           output, swallow to completely ignore it and must-be-empty to
29           enforce that the action printed nothing. With must-be-empty, Dune
30           will consider that the action failed if it printed something to its
31           standard output. The default is print.
32
33       --build-info
34           Show build information.
35
36       --error-reporting=VAL (absent=deterministic)
37           Controls when the build errors are reported. early - report errors
38           as soon as they are discovered. deterministic - report errors at
39           the end of the build in a deterministic order. twice - report each
40           error twice: once as soon as the error is discovered and then again
41           at the end of the build, in a deterministic order.
42
43       -f, --force
44           Force actions associated to aliases to be re-executed even if their
45           dependencies haven't changed.
46
47       --file-watcher=VAL (absent=automatic)
48           Mechanism to detect changes in the source. Automatic to make dune
49           run an external program to detect changes. Manual to notify dune
50           that files have changed manually."
51
52       --passive-watch-mode
53           Similar to [--watch], but only start a build when instructed
54           externally by an RPC.
55
56       --react-to-insignificant-changes
57           react to insignificant file system changes; this is only useful for
58           benchmarking dune
59
60       --sandbox=VAL (absent DUNE_SANDBOX env)
61           Sandboxing mode to use by default. Some actions require a certain
62           sandboxing mode, so they will ignore this setting. The allowed
63           values are: none, symlink, copy, hardlink.
64
65       -w, --watch
66           Instead of terminating build after completion, wait continuously
67           for file changes.
68
69       --wait-for-filesystem-clock
70           Dune digest file contents for better incrementally. These digests
71           are themselves cached. In some cases, Dune needs to drop some
72           digest cache entries in order for things to be reliable. This
73           option makes Dune wait for the file system clock to advance so that
74           it doesn't need to drop anything. You should probably not care
75           about this option; it is mostly useful for Dune developers to make
76           Dune tests of the digest cache more reproducible.
77

COMMON OPTIONS

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

MORE HELP

265       Use `dune COMMAND --help' for help on a single command.
266

EXIT STATUS

268       fmt exits with the following status:
269
270       0   on success.
271
272       123 on indiscriminate errors reported on standard error.
273
274       124 on command line parsing errors.
275
276       125 on unexpected internal errors (bugs).
277

ENVIRONMENT

279       These environment variables affect the execution of fmt:
280
281       CLICOLOR
282           If different than 0, ANSI colors are supported and should be used
283           when the program isn’t piped. If equal to 0, don’t output ANSI
284           color escape codes
285
286       CLICOLOR_FORCE
287           If different than 0, ANSI colors should be enabled no matter what.
288
289       DUNE_BUILD_DIR
290           Specified build directory. _build if unspecified
291
292       DUNE_CACHE
293           Enable or disable Dune cache (either enabled or disabled). Default
294           is `disabled'.
295
296       DUNE_CACHE_CHECK_PROBABILITY
297           Check build reproducibility by re-executing randomly chosen rules
298           and comparing their results with those stored in Dune cache. Note:
299           by increasing the probability of such checks you slow down the
300           build. The default probability is zero, i.e. no rules are checked.
301
302       DUNE_CACHE_STORAGE_MODE
303           Dune cache storage mode (one of auto, hardlink or copy). Default is
304           `auto'.
305
306       DUNE_DIFF_COMMAND
307           Shell command to use to diff files. Use - to disable printing the
308           diff.
309
310       DUNE_DISABLE_PROMOTION
311           Disable all promotion rules
312
313       DUNE_INSTRUMENT_WITH
314           "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
315           list of library names, each one of which must declare an
316           instrumentation backend.
317
318       DUNE_PROFILE
319           Build profile. dev if unspecified or release if -p is set.
320
321       DUNE_SANDBOX
322           Sandboxing mode to use by default. (see --sandbox)
323
324       DUNE_STORE_ORIG_SOURCE_DIR
325           Store original source location in dune-package metadata
326
327       DUNE_WORKSPACE
328           Use this specific workspace file instead of looking it up.
329

BUGS

331       Check bug reports at https://github.com/ocaml/dune/issues
332

SEE ALSO

334       dune(1)
335
336
337
338Dune n/a                                                           DUNE-FMT(1)
Impressum