Dune 3.15.0

We're happy to announce that Dune 3.15.0 is now available. This feature has many fixes and new features that you can find in the changelog.

There are a few new features that we would like to specially highlight.

Removal of previous limitations in many forms

Prior to Dune 3.15 there were a number of limitations where percent forms like %{env:...} could be used to expand to useful values. In this release, @rgrinberg put some effort to relax a lot of these restrictions where possible.

In the new version some of these limitations have been lifted, so for example {env:...} can be used in install stanzas (#10160).

Likewise there was no consistency where %{cma:...} or %{cmo:...} could be used. With #10169, these forms should work consistently everywhere.

Similarly the variables allowed in enabled_if fields have been expanded in #10250, from just allowing variables that can be computed from the context to now allowing all variables as long as expanding these variables does not introduce dependency cycles.

These relaxed rules can also be combined to enable a library depending on environment variables, e.g. (enabled_if %{env:ENABLE_LIBFOO=false})).

Overlapping names in different contexts

Continuing the theme of conditionally enabling or disabling code to be built, @jchavarri and @rgrinberg's work on #10220 makes it possible to have overlapping names between executable and melange.emit targets. This can be useful when a name is to be shared in different contexts (e.g. one context with native compilation and one emitting code for the browser).

Properly output UTF-8 encoded text when formatting

Dune does not assume an encoding of dune files, however when files were formatted the formatter would err on the safe side and escape bytes outside the ASCII range. This means that UTF-8 characters outside of ASCII would get escaped into decimal escape sequences.

This was especially annoying in places where the user would write natural language texts, which is common when defining Opam packages in dune-project files. For example a discussion of a paper by Paul Erdős, Peter Frankl, Vojtěch Rödl would upon reformatting be turned into Paul Erd\197\145s, Peter Frankl, Vojt\196\155 R\195\182, which does a disservice to these scientists and is hard to read.

Thanks to the work of @moyodiallo in #9728 starting with Dune 3.15 the original encoding will be preserved, so your package descriptions will be more readable.

See full changelog

Added

  • Add link flags to to ocamlmklib for ctypes stubs (#8784, @frejsoya)

  • Remove some unnecessary limitations in the expansions of percent forms in install stanza. For example, the %{env:..} form can be used to select files to be installed. (#10160, @rgrinberg)

  • Allow artifact expansion percent forms (%{cma:..}, %{cmo:..}, etc.) in more contexts. Previously, they would be randomly forbidden in some fields. (#10169, @rgrinberg)

  • Allow %{inline_tests} in more contexts (#10191, @rgrinberg)

  • Remove limitations on percent forms in the (enabled_if ..) field of libraries (#10250, @rgrinberg)

  • Support dialects in dune describe pp (#10283, @emillon)

  • Allow defining executables or melange emit stanzas with the same name in the same folder under different contexts. (#10220, @rgrinberg, @jchavarri)

Fixed

  • coq: Delay Coq rule setup checks so OCaml-only packages can build in hybrid Coq/OCaml projects when coqc is not present. Thanks to @vzaliva for the test case and report (#9845, fixes #9818, @rgrinberg, @ejgallego)

  • Fix conditional source selection with select on bigarray in OCaml 5 (#10011, @moyodiallo)

  • melange: fix inconsistency in virtual library implementation. Concrete modules within a virtual library can now refer to its virtual modules too (#10051, fixes #7104, @anmonteiro)

  • melange: fix a bug that would cause stale import paths to be emitted when moving source files within (include_subdirs ..) (#10286, fixes #9190, @anmonteiro)

  • Dune file formatting: output utf8 if input is correctly encoded (#10113, fixes #9728, @moyodiallo)

  • Fix expanding dependencies and locks specified in the cram stanza. Previously, they would be installed in the context of the cram test, rather than the cram stanza itself (#10165, @rgrinberg)

  • Fix bug with dune exec --watch where the working directory would always be set to the project root rather than the directory where the command was run (#10262, @gridbugs)

  • Regression fix: sign executables that are promoted into the source tree (#10263, fixes #9272, @emillon)

  • Fix crash when decoding dune-package for libraries with (include_subdirs qualified) (#10269, fixes #10264, @emillon)

Changed

  • Remove the --react-to-insignificant-changes option. (#10083, @rgrinberg)