Dune 1.10.0
On behalf of the dune team, I'm pleased to announce the 1.10.0 release of dune. This release is packed with bug fixes, but it also introduces a few interesting features. I'll highlight one important feature that we've introduced and plan to improve in future versions:
Dune allows you to specify package metadata in the dune project file and generate an appropriate opam file. This is advantageous to writing opam files manually as dune will correctly fill in some boilerplate such as the build command:
Here's a snippet from dune's own project file as a demonstration:
(generate_opam_files true) ;; necessary to enbale the generation
(license MIT)
(maintainers "Jane Street Group, LLC <opensource@janestreet.com>")
(authors "Jane Street Group, LLC <opensource@janestreet.com>")
(source (github ocaml/dune))
(documentation "https://dune.readthedocs.io/")
(package
(name dune)
(depends
(ocaml (>= 4.02))
base-unix
base-threads)
(conflicts
(jbuilder (<> "transition"))
(odoc (< 1.3.0))
(dune-release (< 1.3.0)))
(synopsis "Fast, portable and opinionated build system")
(description "<redacted>"))
Generating the opam file is done via $ dune build @check
(the @install
, and @all
aliases will also work).
Later, we plan to have dune do some sanity checks on the depends
field. In the more distant future, we might even skip the generation step altogether by having opam invoke dune to get the generated opam file directly.
See full changelog
-
Restricted the set of variables available for expansion in the destination filename of
install
stanza to simplify implementation and avoid dependency cycles. (#2073, @aalekseyev, @jeremiedimino) -
[menhir] call menhir from context root build_dir (#2067, @ejgallego, review by @jeremiedimino, @rgrinberg)
-
[coq] Add
coq.pp
stanza to help with pre-processing of grammar files (#2054, @ejgallego, review by @rgrinberg) -
Add a new more generic form for the promote mode:
(promote (until-clean) (into <dir>))
(#2068, @jeremiedimino) -
Allow to promote only a subset of the targets via
(promote (only <pred>))
. For instance:(promote (only *.mli))
(#2068, @jeremiedimino) -
Improve the behavior when a strict subset of the targets of a rule is already in the source tree for projects using the dune language < 1.10 (#2068, fixes #2061, @jeremiedimino)
-
With lang dune >= 1.10, rules in standard mode are no longer allowed to produce targets that are present in the source tree. This has been a warning for long enough (#2068, @jeremiedimino)
-
Allow %{...} variables in pps flags (#2076, @mlasson review by @jeremiedimino and @aalekseyev).
-
Add a 'cookies' option to ppx_rewriter/deriver flags in library stanzas. This allow to specify cookie requests from variables expanded at each invocation of the preprocessor. (#2106, @mlasson @jeremiedimino)
-
Add more opam metadata and use it to generate
.opam
files. In particular, apackage
field has been added to specify package specific information. (#2017, #2091, @avsm, @jonludlam, @rgrinberg) -
Clean up the special support for
findlib.dynload
. Before, Dune would simply match on the library name. Now, we only match on the findlib package name when the library doesn't come from Dune. Someone writing a library calledfindlib.dynload
with Dune would have to add(special_builtin_support findlib_dynload)
to trigger the special behavior. (#2115, @jeremiedimino) -
Install the
future_syntax
preprocessor asocaml-syntax-shims.exe
(#2125, @rgrinberg) -
Hide full command on errors and warnings in development and show them in CI. (detected using the
CI
environment variable). Commands for which the invocation might be omitted must output an error prefixed withFile
. Add an--always-show-command-line
option to disable this behavior and always show the full command. (#2120, fixes #1733, @rgrinberg) -
In
dune-workspace
files, add the ability to choose the host context and to create duplicates of the default context with different settings. (#2098, @TheLortex, review by @jeremiedimino, @rgrinberg and @aalekseyev) -
Add support for hg in
dune subst
(#2135, @jeremiedimino) -
Don't build documentation for implementations of virtual libraries (#2141, fixes #2138, @jonludlam)
-
Fix generation of the
-pp
flag in .merlin (#2142, @rgrinberg) -
Make
dune subst
add a(version ...)
field to thedune-project
file (#2148, @jeremiedimino) -
Add the
%{os_type}
variable, which is a short-hand for%{ocaml-config:os_type}
(#1764, @jeremiedimino) -
Allow
enabled_if
fields inlibrary
stanzas, restricted to the%{os_type}
,%{model}
,%{architecture}
,%{system}
variables (#1764, #2164 @jeremiedimino, @rgrinberg) -
Fix
chdir
on external and source paths. Dune will also fail gracefully if the external or source path does not exist (#2165, fixes #2158, @rgrinberg) -
Support the
.cc
extension fro C++ sources (#2195, fixes #83, @rgrinberg) -
Run
ocamlformat
relative to the context root. This improves the locations of errors. (#2196, fixes #1370, @rgrinberg) -
Fix detection of
README
,LICENSE
,CHANGE
, andHISTORY
files. These would be undetected whenever the project was nested in another workspace. (#2194, @rgrinberg) -
Fix generation of
.merlin
whenever there's more than one stanza with the same ppx preprocessing specification (#2209 ,fixes #2206, @rgrinberg) -
Fix generation of
.merlin
in the presence of thecopy_files
stanza and preprocessing specifications of other stanazs. (#2211, fixes #2206, @rgrinberg) -
Run
refmt
from the context's root directory. This improves error messages in case of syntax errors. (#2223, @rgrinberg) -
In .merlin files, don't pass
-dump-ast
to thefuture_syntax
preprocessor. Merlin doesn't seem to like it when binary AST is generated by a-pp
preprocessor. (#2236, @aalekseyev) -
dune install
will verify that all files mentioned in all .install files exist before trying to install anything. This prevents partial installation of packages (#2230, @rgrinberg)