1DUNE-INIT(1) Dune Manual DUNE-INIT(1)
2
3
4
6 dune-init - Initialize dune components
7
9 dune init [OPTION]... INIT_KIND NAME [PATH]
10
12 dune init {library,executable,test,project} NAME [PATH] initialize a
13 new dune component of the specified kind, named NAME, with fields
14 determined by the supplied options.
15
16 Any prefix of the component kinds can be supplied, e.g., dune init proj
17 myproject.
18
19 If the optional PATH is provided, the component will be created there.
20 Otherwise, it is created in the current working directory.
21
22 The command can be used to add stanzas to existing dune files as well
23 as for creating new dune files and basic component templates.
24
26 --build-info
27 Show build information.
28
29 -f, --force
30 Force actions associated to aliases to be re-executed even if their
31 dependencies haven't changed.
32
33 --help[=FMT] (default=auto)
34 Show this help in format FMT. The value FMT must be one of `auto',
35 `pager', `groff' or `plain'. With `auto', the format is `pager` or
36 `plain' whenever the TERM env var is `dumb' or undefined.
37
38 --inline-tests
39 Whether to use inline tests. Only applicable for library and
40 project components.
41
42 --kind=PROJECT_KIND
43 The kind of project to initialize. Valid options are e[xecutable]
44 or l[ibrary]. Defaults to executable. Only applicable for project
45 components.
46
47 --libs=LIBRARIES
48 A comma separated list of libraries on which the component depends
49
50 --pkg=PACKAGE_MANAGER
51 Which package manager to use. Valid options are o[pam] or e[sy].
52 Defaults to opam. Only applicable for project components.
53
54 --ppx=PREPROCESSORS
55 A comma separated list of ppx preprocessors used by the component
56
57 --public[=PUBLIC_NAME] (default=<default>)
58 If called with an argument, make the component public under the
59 given PUBLIC_NAME. If supplied without an argument, use NAME.
60
61 --sandbox=VAL (absent DUNE_SANDBOX env)
62 Sandboxing mode to use by default. Some actions require a certain
63 sandboxing mode, so they will ignore this setting. The allowed
64 values are: none, symlink, copy.
65
66 --version
67 Show version information.
68
69 -w, --watch
70 Instead of terminating build after completion, wait continuously
71 for file changes.
72
74 --always-show-command-line
75 Always show the full command lines of programs executed by dune
76
77 --auto-promote
78 Automatically promote files. This is similar to running dune
79 promote after the build.
80
81 --build-dir=FILE (absent DUNE_BUILD_DIR env)
82 Specified build directory. _build if unspecified
83
84 --cache=VAL (absent DUNE_CACHE env)
85 Activate binary cache (either `disabled' or `enabled'). Default is
86 `disabled'.
87
88 --cache-check-probability=VAL (absent=0. or
89 DUNE_CACHE_CHECK_PROBABILITY env)
90 Probability cached rules are rerun to check for reproducibility
91
92 --cache-duplication=VAL (absent DUNE_CACHE_DUPLICATION env)
93 Binary cache duplication mode
94
95 --cache-transport=VAL (absent DUNE_CACHE_TRANSPORT env)
96 Binary cache protocol
97
98 --config-file=FILE
99 Load this configuration file instead of the default one.
100
101 --debug-artifact-substitution
102 Print debugging info about artifact substitution
103
104 --debug-backtraces
105 Always print exception backtraces.
106
107 --debug-dependency-path
108 In case of error, print the dependency path from the targets on the
109 command line to the rule that failed.
110
111 --debug-findlib
112 Debug the findlib sub-system.
113
114 --default-target=TARGET (absent=@@default)
115 Set the default target that when none is specified to dune build.
116
117 --diff-command=VAL
118 Shell command to use to diff files. Use - to disable printing the
119 diff.
120
121 --disable-promotion (absent DUNE_DISABLE_PROMOTION env)
122 Disable all promotion rules
123
124 --display=MODE
125 Control the display mode of Dune. See dune-config(5) for more
126 details.
127
128 --ignore-promoted-rules
129 Ignore rules with (mode promote), except ones with (only ...). The
130 variable %{ignoring_promoted_rules} in dune files reflects whether
131 this option was passed or not.
132
133 --instrument-with=BACKENDS (absent DUNE_INSTRUMENT_WITH env)
134 "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
135 list of library names, each one of which must declare an
136 instrumentation backend.
137
138 -j JOBS
139 Run no more than JOBS commands simultaneously.
140
141 --no-buffer
142 Do not buffer the output of commands executed by dune. By default
143 dune buffers the output of subcommands, in order to prevent
144 interleaving when multiple commands are executed in parallel.
145 However, this can be an issue when debugging long running tests.
146 With --no-buffer, commands have direct access to the terminal. Note
147 that as a result their output won't be captured in the log file.
148 You should use this option in conjunction with -j 1, to avoid
149 interleaving. Additionally you should use --verbose as well, to
150 make sure that commands are printed before they are being executed.
151
152 --no-config
153 Do not load the configuration file
154
155 --no-print-directory
156 Suppress "Entering directory" messages
157
158 --only-packages=PACKAGES
159 Ignore stanzas referring to a package that is not in PACKAGES.
160 PACKAGES is a comma-separated list of package names. Note that this
161 has the same effect as deleting the relevant stanzas from dune
162 files. It is mostly meant for releases. During development, it is
163 likely that what you want instead is to build a particular
164 <package>.install target.
165
166 -p PACKAGES, --for-release-of-packages=PACKAGES (required)
167 Shorthand for --release --only-packages PACKAGE. You must use this
168 option in your <package>.opam files, in order to build only what's
169 necessary when your project contains multiple packages as well as
170 getting reproducible builds.
171
172 --profile=VAL (absent DUNE_PROFILE env)
173 Select the build profile, for instance dev or release. The default
174 is dev.
175
176 --promote-install-files[=VAL] (default=true)
177 Promote the generated <package>.install files to the source tree
178
179 --release
180 Put dune into a reproducible release mode. This is in fact a
181 shorthand for --root . --ignore-promoted-rules --no-config
182 --profile release --always-show-command-line
183 --promote-install-files --default-target @install. You should use
184 this option for release builds. For instance, you must use this
185 option in your <package>.opam files. Except if you already use -p,
186 as -p implies this option.
187
188 --root=DIR
189 Use this directory as workspace root instead of guessing it. Note
190 that this option doesn't change the interpretation of targets given
191 on the command line. It is only intended for scripts.
192
193 --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
194 Store original source location in dune-package metadata
195
196 --terminal-persistence=MODE
197 Changes how the log of build results are displayed to the console
198 between rebuilds while in --watch mode. Supported modes: preserve,
199 clear-on-rebuild.
200
201 --trace-file=FILE
202 Output trace data in catapult format (compatible with
203 chrome://tracing)
204
205 --verbose
206 Same as --display verbose
207
208 --workspace=FILE (absent DUNE_WORKSPACE env)
209 Use this specific workspace file instead of looking it up.
210
211 -x VAL
212 Cross-compile using this toolchain.
213
215 These environment variables affect the execution of init:
216
217 DUNE_BUILD_DIR
218 Specified build directory. _build if unspecified
219
220 DUNE_CACHE
221 Activate binary cache (either `disabled' or `enabled'). Default is
222 `disabled'.
223
224 DUNE_CACHE_CHECK_PROBABILITY
225 Probability cached rules are rerun to check for reproducibility
226
227 DUNE_CACHE_DUPLICATION
228 Binary cache duplication mode
229
230 DUNE_CACHE_TRANSPORT
231 Binary cache protocol
232
233 DUNE_DISABLE_PROMOTION
234 Disable all promotion rules
235
236 DUNE_INSTRUMENT_WITH
237 "Enable instrumentation by BACKENDS. BACKENDS is a comma-separated
238 list of library names, each one of which must declare an
239 instrumentation backend.
240
241 DUNE_PROFILE
242 Build profile. dev if unspecified or release if -p is set.
243
244 DUNE_SANDBOX
245 Sandboxing mode to use by default. (see --sandbox)
246
247 DUNE_STORE_ORIG_SOURCE_DIR
248 Store original source location in dune-package metadata
249
250 DUNE_WORKSPACE
251 Use this specific workspace file instead of looking it up.
252
254 1. Define an executable component named `myexe' in a dune file in the
255 current directory:
256
257 dune init exe myexe
258
259 2. Define a library component named `mylib' in a dune file in the
260 ./src directory depending on the core and cmdliner libraries, the
261 ppx_let and ppx_inline_test preprocessors, and declared as using
262 inline tests":
263
264 dune init lib mylib src --libs core,cmdliner --ppx ppx_let,ppx_inline_test --inline-tests"
265
266 3. Define a library component named `mytest' in a dune file in the
267 ./test directory that depends on `mylib'":
268
269 dune init test myexe test --libs mylib
270
271
272
273Dune n/a DUNE-INIT(1)