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-backtraces
102 Always print exception backtraces.
103
104 --debug-dependency-path
105 In case of error, print the dependency path from the targets on the
106 command line to the rule that failed.
107
108 --debug-findlib
109 Debug the findlib sub-system.
110
111 --default-target=TARGET (absent=@@default)
112 Set the default target that when none is specified to dune build.
113
114 --diff-command=VAL
115 Shell command to use to diff files. Use - to disable printing the
116 diff.
117
118 --disable-promotion (absent DUNE_DISABLE_PROMOTION env)
119 Disable all promotion rules
120
121 --display=MODE
122 Control the display mode of Dune. See dune-config(5) for more
123 details.
124
125 --ignore-promoted-rules
126 Ignore rules with (mode promote), except ones with (only ...). The
127 variable %{ignoring_promoted_rules} in dune files reflects whether
128 this option was passed or not.
129
130 -j JOBS
131 Run no more than JOBS commands simultaneously.
132
133 --no-buffer
134 Do not buffer the output of commands executed by dune. By default
135 dune buffers the output of subcommands, in order to prevent
136 interleaving when multiple commands are executed in parallel.
137 However, this can be an issue when debugging long running tests.
138 With --no-buffer, commands have direct access to the terminal. Note
139 that as a result their output won't be captured in the log file.
140 You should use this option in conjunction with -j 1, to avoid
141 interleaving. Additionally you should use --verbose as well, to
142 make sure that commands are printed before they are being executed.
143
144 --no-config
145 Do not load the configuration file
146
147 --no-print-directory
148 Suppress "Entering directory" messages
149
150 --only-packages=PACKAGES
151 Ignore stanzas referring to a package that is not in PACKAGES.
152 PACKAGES is a comma-separated list of package names. Note that this
153 has the same effect as deleting the relevant stanzas from dune
154 files. It is mostly meant for releases. During development, it is
155 likely that what you want instead is to build a particular
156 <package>.install target.
157
158 -p PACKAGES, --for-release-of-packages=PACKAGES
159 Shorthand for --release --only-packages PACKAGE. You must use this
160 option in your <package>.opam files, in order to build only what's
161 necessary when your project contains multiple packages as well as
162 getting reproducible builds.
163
164 --profile=VAL (absent DUNE_PROFILE env)
165 Select the build profile, for instance dev or release. The default
166 is dev.
167
168 --promote-install-files
169 Promote the generated <package>.install files to the source tree
170
171 --release
172 Put dune into a reproducible release mode. This is in fact a
173 shorthand for --root . --ignore-promoted-rules --no-config
174 --profile release --always-show-command-line
175 --promote-install-files --default-target @install. You should use
176 this option for release builds. For instance, you must use this
177 option in your <package>.opam files. Except if you already use -p,
178 as -p implies this option.
179
180 --root=DIR
181 Use this directory as workspace root instead of guessing it. Note
182 that this option doesn't change the interpretation of targets given
183 on the command line. It is only intended for scripts.
184
185 --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
186 Store original source location in dune-package metadata
187
188 --terminal-persistence=MODE
189 Changes how the log of build results are displayed to the console
190 between rebuilds while in --watch mode.
191
192 --trace-file=FILE
193 Output trace data in catapult format (compatible with
194 chrome://tracing)
195
196 --verbose
197 Same as --display verbose
198
199 --workspace=FILE (absent DUNE_WORKSPACE env)
200 Use this specific workspace file instead of looking it up.
201
202 -x VAL
203 Cross-compile using this toolchain.
204
206 These environment variables affect the execution of init:
207
208 DUNE_BUILD_DIR
209 Specified build directory. _build if unspecified
210
211 DUNE_CACHE
212 Activate binary cache (either `disabled' or `enabled'). Default is
213 `disabled'.
214
215 DUNE_CACHE_CHECK_PROBABILITY
216 Probability cached rules are rerun to check for reproducibility
217
218 DUNE_CACHE_DUPLICATION
219 Binary cache duplication mode
220
221 DUNE_CACHE_TRANSPORT
222 Binary cache protocol
223
224 DUNE_DISABLE_PROMOTION
225 Disable all promotion rules
226
227 DUNE_PROFILE
228 Build profile. dev if unspecified or release if -p is set.
229
230 DUNE_SANDBOX
231 Sandboxing mode to use by default. (see --sandbox)
232
233 DUNE_STORE_ORIG_SOURCE_DIR
234 Store original source location in dune-package metadata
235
236 DUNE_WORKSPACE
237 Use this specific workspace file instead of looking it up.
238
240 1. Define an executable component named `myexe' in a dune file in the
241 current directory:
242
243 dune init exe myexe
244
245 2. Define a library component named `mylib' in a dune file in the
246 ./src directory depending on the core and cmdliner libraries, the
247 ppx_let and ppx_inline_test preprocessors, and declared as using
248 inline tests":
249
250 dune init lib mylib src --libs core,cmdliner --ppx ppx_let,ppx_inline_test --inline-tests"
251
252 3. Define a library component named `mytest' in a dune file in the
253 ./test directory that depends on `mylib'":
254
255 dune init test myexe test --libs mylib
256
257
258
259Dune n/a dune-init(1)