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 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 ppx preprocessors used by the component
56
57 --public[=PUBLIC_NAME] (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 --version
62 Show version information.
63
64 -w, --watch
65 Instead of terminating build after completion, wait continuously
66 for file changes.
67
69 --always-show-command-line
70 Always show the full command lines of programs executed by dune
71
72 --auto-promote
73 Automatically promote files. This is similar to running dune
74 promote after the build.
75
76 --build-dir=FILE (absent DUNE_BUILD_DIR env)
77 Specified build directory. _build if unspecified
78
79 --config-file=FILE
80 Load this configuration file instead of the default one.
81
82 --debug-backtraces
83 Always print exception backtraces.
84
85 --debug-dependency-path
86 In case of error, print the dependency path from the targets on the
87 command line to the rule that failed.
88
89 --debug-findlib
90 Debug the findlib sub-system.
91
92 --default-target=TARGET (absent=@@default)
93 Set the default target that when none is specified to dune build.
94
95 --dev
96 Same as --profile dev
97
98 --diff-command=VAL
99 Shell command to use to diff files. Use - to disable printing the
100 diff.
101
102 --display=MODE
103 Control the display mode of Dune. See dune-config(5) for more
104 details.
105
106 --ignore-promoted-rules
107 Ignore rules with (mode promote), except ones with (only ...). The
108 variable %{ignoring_promoted_rules} in dune files reflects whether
109 this option was passed or not.
110
111 -j JOBS
112 Run no more than JOBS commands simultaneously.
113
114 --no-buffer
115 Do not buffer the output of commands executed by dune. By default
116 dune buffers the output of subcommands, in order to prevent
117 interleaving when multiple commands are executed in parallel.
118 However, this can be an issue when debugging long running tests.
119 With --no-buffer, commands have direct access to the terminal. Note
120 that as a result their output won't be captured in the log file.
121 You should use this option in conjunction with -j 1, to avoid
122 interleaving. Additionally you should use --verbose as well, to
123 make sure that commands are printed before they are being executed.
124
125 --no-config
126 Do not load the configuration file
127
128 --no-print-directory
129 Suppress "Entering directory" messages
130
131 --only-packages=PACKAGES
132 Ignore stanzas referring to a package that is not in PACKAGES.
133 PACKAGES is a comma-separated list of package names. Note that this
134 has the same effect as deleting the relevant stanzas from jbuild
135 files. It is mostly meant for releases. During development, it is
136 likely that what you want instead is to build a particular
137 <package>.install target.
138
139 -p PACKAGES, --for-release-of-packages=PACKAGES
140 Shorthand for --root . --only-packages PACKAGE
141 --ignore-promoted-rules --no-config --profile release. You must use
142 this option in your <package>.opam files, in order to build only
143 what's necessary when your project contains multiple packages as
144 well as getting reproducible builds.
145
146 --profile=VAL (absent DUNE_PROFILE env)
147 Select the build profile, for instance dev or release. The default
148 is dev.
149
150 --root=DIR
151 Use this directory as workspace root instead of guessing it. Note
152 that this option doesn't change the interpretation of targets given
153 on the command line. It is only intended for scripts.
154
155 --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
156 Store original source location in dune-package metadata
157
158 --trace-file=FILE
159 Output trace data in catapult format (compatible with
160 chrome://tracing)
161
162 --verbose
163 Same as --display verbose
164
165 --workspace=FILE (absent DUNE_WORKSPACE env)
166 Use this specific workspace file instead of looking it up.
167
168 -x VAL
169 Cross-compile using this toolchain.
170
172 These environment variables affect the execution of init:
173
174 DUNE_BUILD_DIR
175 Specified build directory. _build if unspecified
176
177 DUNE_PROFILE
178 Build profile. dev if unspecified or release if -p is set.
179
180 DUNE_STORE_ORIG_SOURCE_DIR
181 Store original source location in dune-package metadata
182
183 DUNE_WORKSPACE
184 Use this specific workspace file instead of looking it up.
185
187 Define an executable component named 'myexe' in a dune file in the
188 current directory:
189
190 dune init exe myexe
191
192 Define a library component named 'mylib' in a dune file in the ./src
193 directory depending on the core and cmdliner libraries, the ppx_let
194 and ppx_inline_test preprocessors, and declared as using inline tests:
195
196 dune init lib mylib src --libs core,cmdliner --ppx ppx_let,ppx_inline_test --inline-tests
197
198 Define a library component named mytest in a dune file in the ./test
199 directory that depends on mylib:
200
201 dune init test myexe test --libs mylib
202
203
204
205Dune n/a dune-init(1)