.\" Pipe this output to groff -Tutf8 | less .\" .mso an.tmac .TH "dune-init" 1 "" "Dune 2.7.1" "Dune Manual" .\" Disable hyphenation and ragged-right .nh .ad l .SH NAME .P dune\N'45'init \N'45' Initialize dune components .SH SYNOPSIS .P \fBdune init\fR [\fIOPTION\fR]\N'46'\N'46'\N'46' \fIINIT_KIND\fR \fINAME\fR [\fIPATH\fR] .SH DESCRIPTION .P \fBdune init {library,executable,test,project} NAME [PATH]\fR initialize a new dune component of the specified kind, named \fBNAME\fR, with fields determined by the supplied options\N'46' .P Any prefix of the component kinds can be supplied, e\N'46'g\N'46', \fBdune init proj myproject\fR\N'46' .P If the optional \fBPATH\fR is provided, the component will be created there\N'46' Otherwise, it is created in the current working directory\N'46' .P The command can be used to add stanzas to existing dune files as well as for creating new dune files and basic component templates\N'46' .SH OPTIONS .TP 4 \fB\N'45'\N'45'build\N'45'info\fR Show build information\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'help\fR[=\fIFMT\fR] (default=auto) Show this help in format \fIFMT\fR\N'46' The value \fIFMT\fR must be one of `auto\N'39', `pager\N'39', `groff\N'39' or `plain\N'39'\N'46' With `auto\N'39', the format is `pager` or `plain\N'39' whenever the \fBTERM\fR env var is `dumb\N'39' or undefined\N'46' .TP 4 \fB\N'45'\N'45'inline\N'45'tests\fR Whether to use inline tests\N'46' Only applicable for \fBlibrary\fR and \fBproject\fR components\N'46' .TP 4 \fB\N'45'\N'45'kind\fR=\fIPROJECT_KIND\fR The kind of project to initialize\N'46' Valid options are \fBe[xecutable]\fR or \fBl[ibrary]\fR\N'46' Defaults to \fBexecutable\fR\N'46' Only applicable for \fBproject\fR components\N'46' .TP 4 \fB\N'45'\N'45'libs\fR=\fILIBRARIES\fR A comma separated list of libraries on which the component depends .TP 4 \fB\N'45'\N'45'pkg\fR=\fIPACKAGE_MANAGER\fR Which package manager to use\N'46' Valid options are \fBo[pam]\fR or \fBe[sy]\fR\N'46' Defaults to \fBopam\fR\N'46' Only applicable for \fBproject\fR components\N'46' .TP 4 \fB\N'45'\N'45'ppx\fR=\fIPREPROCESSORS\fR A comma separated list of ppx preprocessors used by the component .TP 4 \fB\N'45'\N'45'public\fR[=\fIPUBLIC_NAME\fR] (default=) If called with an argument, make the component public under the given PUBLIC_NAME\N'46' If supplied without an argument, use NAME\N'46' .TP 4 \fB\N'45'\N'45'sandbox\fR=\fIVAL\fR (absent \fBDUNE_SANDBOX\fR env) Sandboxing mode to use by default\N'46' Some actions require a certain sandboxing mode, so they will ignore this setting\N'46' The allowed values are: none, symlink, copy\N'46' .TP 4 \fB\N'45'\N'45'version\fR Show version information\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' .SH COMMON OPTIONS .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 .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) Activate binary cache (either `disabled\N'39' or `enabled\N'39')\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=0\N'46' or \fBDUNE_CACHE_CHECK_PROBABILITY\fR env) Probability cached rules are rerun to check for reproducibility .TP 4 \fB\N'45'\N'45'cache\N'45'duplication\fR=\fIVAL\fR (absent \fBDUNE_CACHE_DUPLICATION\fR env) Binary cache duplication mode .TP 4 \fB\N'45'\N'45'cache\N'45'transport\fR=\fIVAL\fR (absent \fBDUNE_CACHE_TRANSPORT\fR env) Binary cache protocol .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'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'findlib\fR Debug the findlib sub\N'45'system\N'46' .TP 4 \fB\N'45'\N'45'default\N'45'target\fR=\fITARGET\fR (absent=@@default) Set the default target that when none is specified to \fBdune build\fR\N'46' .TP 4 \fB\N'45'\N'45'diff\N'45'command\fR=\fIVAL\fR 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' .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 .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 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'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 Promote the generated \N'46'install files to the source tree .TP 4 \fB\N'45'\N'45'release\fR Put \fBdune\fR into a reproducible \fIrelease\fR mode\N'46' This is in fact a 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'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'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 .TP 4 \fB\N'45'\N'45'terminal\N'45'persistence\fR=\fIMODE\fR Changes how the log of build results are displayed to the console between rebuilds while in \N'45'\N'45'watch mode\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) .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'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 ENVIRONMENT .P These environment variables affect the execution of \fBinit\fR: .TP 4 \fBDUNE_BUILD_DIR\fR Specified build directory\N'46' _build if unspecified .TP 4 \fBDUNE_CACHE\fR Activate binary cache (either `disabled\N'39' or `enabled\N'39')\N'46' Default is `disabled\N'39'\N'46' .TP 4 \fBDUNE_CACHE_CHECK_PROBABILITY\fR Probability cached rules are rerun to check for reproducibility .TP 4 \fBDUNE_CACHE_DUPLICATION\fR Binary cache duplication mode .TP 4 \fBDUNE_CACHE_TRANSPORT\fR Binary cache protocol .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 .TP 4 \fBDUNE_WORKSPACE\fR Use this specific workspace file instead of looking it up\N'46' .SH EXAMPLES .TP 4 1\N'46' Define an executable component named `myexe\N'39' in a dune file in the current directory: .P .nf dune init exe myexe .fi .TP 4 2\N'46' Define a library component named `mylib\N'39' in a dune file in the \N'46'/src directory depending on the core and cmdliner libraries, the ppx_let and ppx_inline_test preprocessors, and declared as using inline tests": .P .nf dune init lib mylib src \N'45'\N'45'libs core,cmdliner \N'45'\N'45'ppx ppx_let,ppx_inline_test \N'45'\N'45'inline\N'45'tests" .fi .TP 4 3\N'46' Define a library component named `mytest\N'39' in a dune file in the \N'46'/test directory that depends on `mylib\N'39'": .P .nf dune init test myexe test \N'45'\N'45'libs mylib .fi