.\" Pipe this output to groff -m man -K utf8 -T utf8 | less -R .\" .mso an.tmac .TH "DUNE-BUILD" 1 "" "Dune n/a" "Dune Manual" .\" Disable hyphenation and ragged-right .nh .ad l .SH NAME .P dune\N'45'build \N'45' Build the given targets, or the default ones if none are given\N'46' .SH SYNOPSIS .P \fBdune build\fR [\fIOPTION\fR]… [\fITARGET\fR]… .SH DESCRIPTION .P Targets starting with a \fB@\fR are interpreted as aliases\N'46' .SH OPTIONS .TP 4 \fB\N'45'\N'45'action\N'45'stderr\N'45'on\N'45'success\fR=\fIVAL\fR Same as \fB\N'45'\N'45'action\N'45'stdout\N'45'on\N'45'success\fR but for standard error instead of standard output\N'46' A good default for large mono\N'45'repositories is \fB\N'45'\N'45'action\N'45'stdout\N'45'on\N'45'success=swallow \N'45'\N'45'action\N'45'stderr\N'45'on\N'45'success=must\N'45'be\N'45'empty\fR\N'46' This ensures that a successful build has a "clean" empty output\N'46' .TP 4 \fB\N'45'\N'45'action\N'45'stdout\N'45'on\N'45'success\fR=\fIVAL\fR Specify how to deal with the standard output of actions when they succeed\N'46' Possible values are: \fBprint\fR to just print it to Dune\N'39's output, \fBswallow\fR to completely ignore it and \fBmust\N'45'be\N'45'empty\fR to enforce that the action printed nothing\N'46' With \fBmust\N'45'be\N'45'empty\fR, Dune will consider that the action failed if it printed something to its standard output\N'46' The default is \fBprint\fR\N'46' .TP 4 \fB\N'45'\N'45'build\N'45'info\fR Show build information\N'46' .TP 4 \fB\N'45'\N'45'display\N'45'separate\N'45'messages\fR Separate error messages with a blank line\N'46' .TP 4 \fB\N'45'\N'45'error\N'45'reporting\fR=\fIVAL\fR (absent=\fBdeterministic\fR) Controls when the build errors are reported\N'46' \fBearly\fR reports errors as soon as they are discovered\N'46' \fBdeterministic\fR reports errors at the end of the build in a deterministic order\N'46' \fBtwice\fR reports each error twice: once as soon as the error is discovered and then again at the end of the build, in a deterministic order\N'46' .TP 4 \fB\N'45'f\fR, \fB\N'45'\N'45'force\fR Force actions associated to aliases to be re\N'45'executed even if their dependencies haven\N'39't changed\N'46' .TP 4 \fB\N'45'\N'45'file\N'45'watcher\fR=\fIVAL\fR (absent=\fBautomatic\fR) Mechanism to detect changes in the source\N'46' Automatic to make dune run an external program to detect changes\N'46' Manual to notify dune that files have changed manually\N'46' .TP 4 \fB\N'45'\N'45'passive\N'45'watch\N'45'mode\fR Similar to [\N'45'\N'45'watch], but only start a build when instructed externally by an RPC\N'46' .TP 4 \fB\N'45'\N'45'sandbox\fR=\fIVAL\fR (absent \fBDUNE_SANDBOX\fR env) Set sandboxing mode\N'46' Some actions require a certain sandboxing mode, so they will ignore this setting\N'46' The allowed values are: none, symlink, copy, hardlink\N'46' .TP 4 \fB\N'45'\N'45'stop\N'45'on\N'45'first\N'45'error\fR Stop the build as soon as an error is encountered\N'46' .TP 4 \fB\N'45'w\fR, \fB\N'45'\N'45'watch\fR Instead of terminating build after completion, wait continuously for file changes\N'46' .TP 4 \fB\N'45'\N'45'wait\N'45'for\N'45'filesystem\N'45'clock\fR Dune digest file contents for better incrementally\N'46' These digests are themselves cached\N'46' In some cases, Dune needs to drop some digest cache entries in order for things to be reliable\N'46' This option makes Dune wait for the file system clock to advance so that it doesn\N'39't need to drop anything\N'46' You should probably not care about this option; it is mostly useful for Dune developers to make Dune tests of the digest cache more reproducible\N'46' .SH COMMON OPTIONS .P These options are common to all commands\N'46' .TP 4 \fB\N'45'\N'45'always\N'45'show\N'45'command\N'45'line\fR Always show the full command lines of programs executed by dune\N'46' .TP 4 \fB\N'45'\N'45'auto\N'45'promote\fR Automatically promote files\N'46' This is similar to running \fBdune promote\fR after the build\N'46' .TP 4 \fB\N'45'\N'45'build\N'45'dir\fR=\fIFILE\fR (absent \fBDUNE_BUILD_DIR\fR env) Specified build directory\N'46' _build if unspecified .TP 4 \fB\N'45'\N'45'cache\fR=\fIVAL\fR (absent \fBDUNE_CACHE\fR env) Enable or disable Dune cache (either \fBenabled\fR or \fBdisabled\fR)\N'46' Default is `disabled\N'39'\N'46' .TP 4 \fB\N'45'\N'45'cache\N'45'check\N'45'probability\fR=\fIVAL\fR (absent \fBDUNE_CACHE_CHECK_PROBABILITY\fR env) Check build reproducibility by re\N'45'executing randomly chosen rules and comparing their results with those stored in Dune cache\N'46' Note: by increasing the probability of such checks you slow down the build\N'46' The default probability is zero, i\N'46'e\N'46' no rules are checked\N'46' .TP 4 \fB\N'45'\N'45'cache\N'45'storage\N'45'mode\fR=\fIVAL\fR (absent \fBDUNE_CACHE_STORAGE_MODE\fR env) Dune cache storage mode (one of \fBauto\fR, \fBhardlink\fR or \fBcopy\fR)\N'46' Default is `auto\N'39'\N'46' .TP 4 \fB\N'45'\N'45'config\N'45'file\fR=\fIFILE\fR Load this configuration file instead of the default one\N'46' .TP 4 \fB\N'45'\N'45'debug\N'45'artifact\N'45'substitution\fR Print debugging info about artifact substitution .TP 4 \fB\N'45'\N'45'debug\N'45'backtraces\fR Always print exception backtraces\N'46' .TP 4 \fB\N'45'\N'45'debug\N'45'cache\fR=\fIVAL\fR Show debug messages on cache misses for the given cache layers\N'46' Value is a comma\N'45'separated list of cache layer names\N'46' All available cache layers: shared,workspace\N'45'local,fs\N'46' .TP 4 \fB\N'45'\N'45'debug\N'45'dependency\N'45'path\fR In case of error, print the dependency path from the targets on the command line to the rule that failed\N'46' .TP 4 \fB\N'45'\N'45'debug\N'45'digests\fR Explain why Dune decides to re\N'45'digest some files .TP 4 \fB\N'45'\N'45'debug\N'45'load\N'45'dir\fR Print debugging info about directory loading .TP 4 \fB\N'45'\N'45'default\N'45'target\fR=\fITARGET\fR (absent=\fB@@default\fR) Set the default target that is used when none is specified to \fBdune build\fR\N'46' .TP 4 \fB\N'45'\N'45'diff\N'45'command\fR=\fIVAL\fR (absent \fBDUNE_DIFF_COMMAND\fR env) Shell command to use to diff files\N'46' Use \N'45' to disable printing the diff\N'46' .TP 4 \fB\N'45'\N'45'disable\N'45'promotion\fR (absent \fBDUNE_DISABLE_PROMOTION\fR env) Disable all promotion rules .TP 4 \fB\N'45'\N'45'display\fR=\fIMODE\fR Control the display mode of Dune\N'46' See \fBdune\N'45'config(5)\fR for more details\N'46' Valid values for this option are progress, verbose, short, quiet or tui\N'46' .TP 4 \fB\N'45'\N'45'dump\N'45'gc\N'45'stats\fR=\fIFILE\fR Dump the garbage collector stats to a file after the build is complete\N'46' .TP 4 \fB\N'45'\N'45'dump\N'45'memo\N'45'graph\fR=\fIFILE\fR Dump the dependency graph to a file after the build is complete\N'46' .TP 4 \fB\N'45'\N'45'dump\N'45'memo\N'45'graph\N'45'format\fR=\fIFORMAT\fR (absent=\fBgexf\fR) Set the file format used by \fB\N'45'\N'45'dump\N'45'memo\N'45'graph\fR .TP 4 \fB\N'45'\N'45'dump\N'45'memo\N'45'graph\N'45'with\N'45'timing\fR Re\N'45'run each cached node in the Memo graph after building and include the run duration in the output of \fB\N'45'\N'45'dump\N'45'memo\N'45'graph\fR\N'46' Since all nodes contain a cached value, each measurement will only account for a single node\N'46' .TP 4 \fB\N'45'\N'45'help\fR[=\fIFMT\fR] (default=\fBauto\fR) Show this help in format \fIFMT\fR\N'46' The value \fIFMT\fR must be one of \fBauto\fR, \fBpager\fR, \fBgroff\fR or \fBplain\fR\N'46' With \fBauto\fR, the format is \fBpager\fR or \fBplain\fR whenever the \fBTERM\fR env var is \fBdumb\fR or undefined\N'46' .TP 4 \fB\N'45'\N'45'ignore\N'45'lock\N'45'dir\fR Ignore dune\N'46'lock/ directory\N'46' .TP 4 \fB\N'45'\N'45'ignore\N'45'promoted\N'45'rules\fR Ignore rules with (mode promote), except ones with (only \N'46'\N'46'\N'46')\N'46' The variable %{ignoring_promoted_rules} in dune files reflects whether this option was passed or not\N'46' .TP 4 \fB\N'45'\N'45'instrument\N'45'with\fR=\fIBACKENDS\fR (absent \fBDUNE_INSTRUMENT_WITH\fR env) Enable instrumentation by \fBBACKENDS\fR\N'46' \fBBACKENDS\fR is a comma\N'45'separated list of library names, each one of which must declare an instrumentation backend\N'46' .TP 4 \fB\N'45'j\fR \fIJOBS\fR Run no more than \fIJOBS\fR commands simultaneously\N'46' .TP 4 \fB\N'45'\N'45'no\N'45'buffer\fR Do not buffer the output of commands executed by dune\N'46' By default dune buffers the output of subcommands, in order to prevent interleaving when multiple commands are executed in parallel\N'46' However, this can be an issue when debugging long running tests\N'46' With \fB\N'45'\N'45'no\N'45'buffer\fR, commands have direct access to the terminal\N'46' Note that as a result their output won\N'39't be captured in the log file\N'46' You should use this option in conjunction with \fB\N'45'j 1\fR, to avoid interleaving\N'46' Additionally you should use \fB\N'45'\N'45'verbose\fR as well, to make sure that commands are printed before they are being executed\N'46' .TP 4 \fB\N'45'\N'45'no\N'45'config\fR Do not load the configuration file .TP 4 \fB\N'45'\N'45'no\N'45'print\N'45'directory\fR Suppress "Entering directory" messages\N'46' .TP 4 \fB\N'45'\N'45'only\N'45'packages\fR=\fIPACKAGES\fR Ignore stanzas referring to a package that is not in \fBPACKAGES\fR\N'46' \fBPACKAGES\fR is a comma\N'45'separated list of package names\N'46' Note that this has the same effect as deleting the relevant stanzas from dune files\N'46' It is mostly meant for releases\N'46' During development, it is likely that what you want instead is to build a particular \fB\N'46'install\fR target\N'46' .TP 4 \fB\N'45'p\fR \fIPACKAGES\fR, \fB\N'45'\N'45'for\N'45'release\N'45'of\N'45'packages\fR=\fIPACKAGES\fR (required) Shorthand for \fB\N'45'\N'45'release \N'45'\N'45'only\N'45'packages PACKAGE\fR\N'46' You must use this option in your \fI\N'46'opam\fR files, in order to build only what\N'39's necessary when your project contains multiple packages as well as getting reproducible builds\N'46' .TP 4 \fB\N'45'\N'45'print\N'45'metrics\fR Print out various performance metrics after every build\N'46' .TP 4 \fB\N'45'\N'45'profile\fR=\fIVAL\fR (absent \fBDUNE_PROFILE\fR env) Select the build profile, for instance \fBdev\fR or \fBrelease\fR\N'46' The default is \fBdev\fR\N'46' .TP 4 \fB\N'45'\N'45'promote\N'45'install\N'45'files\fR[=\fIVAL\fR] (default=\fBtrue\fR) Promote any generated \N'46'install files to the source tree\N'46' .TP 4 \fB\N'45'\N'45'release\fR Put \fBdune\fR into a reproducible \fIrelease\fR mode\N'46' Shorthand for \fB\N'45'\N'45'root \N'46' \N'45'\N'45'ignore\N'45'promoted\N'45'rules \N'45'\N'45'no\N'45'config \N'45'\N'45'profile release \N'45'\N'45'always\N'45'show\N'45'command\N'45'line \N'45'\N'45'promote\N'45'install\N'45'files \N'45'\N'45'require\N'45'dune\N'45'project\N'45'file \N'45'\N'45'ignore\N'45'lock\N'45'dir \N'45'\N'45'default\N'45'target @install\fR\N'46' You should use this option for release builds\N'46' For instance, you must use this option in your \fI\N'46'opam\fR files\N'46' Except if you already use \fB\N'45'p\fR, as \fB\N'45'p\fR implies this option\N'46' .TP 4 \fB\N'45'\N'45'require\N'45'dune\N'45'project\N'45'file\fR[=\fIVAL\fR] (default=\fBtrue\fR) Fail if a dune\N'45'project file is missing\N'46' .TP 4 \fB\N'45'\N'45'root\fR=\fIDIR\fR Use this directory as workspace root instead of guessing it\N'46' Note that this option doesn\N'39't change the interpretation of targets given on the command line\N'46' It is only intended for scripts\N'46' .TP 4 \fB\N'45'\N'45'store\N'45'orig\N'45'source\N'45'dir\fR (absent \fBDUNE_STORE_ORIG_SOURCE_DIR\fR env) Store original source location in dune\N'45'package metadata\N'46' .TP 4 \fB\N'45'\N'45'terminal\N'45'persistence\fR=\fIMODE\fR Change how the log of build results are displayed to the console between rebuilds while in \fB\N'45'\N'45'watch\fR mode\N'46' Supported modes: \fBpreserve\fR, \fBclear\N'45'on\N'45'rebuild\fR, \fBclear\N'45'on\N'45'rebuild\N'45'and\N'45'flush\N'45'history\fR\N'46' .TP 4 \fB\N'45'\N'45'trace\N'45'extended\fR Output extended trace data (requires trace\N'45'file)\N'46' .TP 4 \fB\N'45'\N'45'trace\N'45'file\fR=\fIFILE\fR Output trace data in catapult format (compatible with chrome://tracing)\N'46' .TP 4 \fB\N'45'\N'45'verbose\fR Same as \fB\N'45'\N'45'display verbose\fR .TP 4 \fB\N'45'\N'45'version\fR Show version information\N'46' .TP 4 \fB\N'45'\N'45'watch\N'45'exclusions\fR=\fIREGEX\fR Adds a POSIX regular expression that will exclude matching directories from \fB`dune build \N'45'\N'45'watch`\fR\N'46' The option \fB\N'45'\N'45'watch\N'45'exclusions\fR can be repeated to add multiple exclusions\N'46' Semicolons can be also used as a separator\N'46' If no exclusions are provided, then a standard set of exclusions is used; however, if \fIone or more\fR \fB\N'45'\N'45'watch\N'45'exclusions\fR are used, \fBnone\fR of the standard exclusions are used\N'46' The standard exclusions are: ^_opam /_opam ^_esy /_esy ^\N'92'\N'46'#\N'46'* /\N'92'\N'46'#\N'46'* ~$ ^#[^#]*#$ /#[^#]*#$ ^4913$ /4913$ /\N'46'git /\N'46'hg :/windows .TP 4 \fB\N'45'\N'45'workspace\fR=\fIFILE\fR (absent \fBDUNE_WORKSPACE\fR env) Use this specific workspace file instead of looking it up\N'46' .TP 4 \fB\N'45'x\fR \fIVAL\fR Cross\N'45'compile using this toolchain\N'46' .SH MORE HELP .P Use `\fBdune\fR \fICOMMAND\fR \N'45'\N'45'help\N'39' for help on a single command\N'46' .SH EXIT STATUS .P \fBdune build\fR exits with: .TP 4 0 on success\N'46' .TP 4 1 if an error happened\N'46' .TP 4 130 if it was interrupted by a signal\N'46' .SH ENVIRONMENT .P These environment variables affect the execution of \fBbuild\fR: .TP 4 \fBCLICOLOR\fR If different than \fB0\fR, ANSI colors are supported and should be used when the program isn\N'39't piped\N'46' If equal to \fB0\fR, don\N'39't output ANSI color escape codes .TP 4 \fBCLICOLOR_FORCE\fR If different than \fB0\fR, ANSI colors should be enabled no matter what\N'46' .TP 4 \fBDUNE_BUILD_DIR\fR Specified build directory\N'46' _build if unspecified .TP 4 \fBDUNE_CACHE\fR Enable or disable Dune cache (either \fBenabled\fR or \fBdisabled\fR)\N'46' Default is `disabled\N'39'\N'46' .TP 4 \fBDUNE_CACHE_CHECK_PROBABILITY\fR Check build reproducibility by re\N'45'executing randomly chosen rules and comparing their results with those stored in Dune cache\N'46' Note: by increasing the probability of such checks you slow down the build\N'46' The default probability is zero, i\N'46'e\N'46' no rules are checked\N'46' .TP 4 \fBDUNE_CACHE_ROOT\fR If set, determines the location of the machine\N'45'global shared cache\N'46' .TP 4 \fBDUNE_CACHE_STORAGE_MODE\fR Dune cache storage mode (one of \fBauto\fR, \fBhardlink\fR or \fBcopy\fR)\N'46' Default is `auto\N'39'\N'46' .TP 4 \fBDUNE_DIFF_COMMAND\fR Shell command to use to diff files\N'46' Use \N'45' to disable printing the diff\N'46' .TP 4 \fBDUNE_DISABLE_PROMOTION\fR Disable all promotion rules .TP 4 \fBDUNE_INSTRUMENT_WITH\fR Enable instrumentation by \fBBACKENDS\fR\N'46' \fBBACKENDS\fR is a comma\N'45'separated list of library names, each one of which must declare an instrumentation backend\N'46' .TP 4 \fBDUNE_PROFILE\fR Build profile\N'46' \fBdev\fR if unspecified or \fBrelease\fR if \N'45'p is set\N'46' .TP 4 \fBDUNE_SANDBOX\fR Sandboxing mode to use by default\N'46' (see \N'45'\N'45'sandbox) .TP 4 \fBDUNE_STORE_ORIG_SOURCE_DIR\fR Store original source location in dune\N'45'package metadata\N'46' .TP 4 \fBDUNE_WORKSPACE\fR Use this specific workspace file instead of looking it up\N'46' .SH BUGS .P Check bug reports at https://github\N'46'com/ocaml/dune/issues .SH SEE ALSO .P dune(1) .SH EXAMPLES .TP 4 1\N'46' Build all targets in the current source tree: .P .nf dune build .fi .TP 4 2\N'46' Build targets in the `\N'46'/foo/bar\N'39' directory: .P .nf dune build \N'46'/foo/bar .fi .TP 4 3\N'46' Build the minimal set of targets required for tooling such as Merlin (useful for quickly detecting errors): .P .nf dune build @check .fi .TP 4 4\N'46' Run all code formatting tools in\N'45'place: .P .nf dune build \N'45'\N'45'auto\N'45'promote @fmt .fi