On the behalf of the Dune Team, I’m glad to announce the release of dune 3.20.0
This release contains some important bug fixes. It contains new features for tests, such as the possibility to use an alias and the possibility to declare a timeout for cram tests. This release also provides new possibilities for the watch mode, like the ability to run an executable or promote files while the watch mode is running.
A significant change in this release is how the dune file formatter acts. It will now try to fill the line instead of using the vertical format.
If you encounter a problem with this release, you can report it on the ocaml/dune repository.
Changelog
Fixed
Stop re-running cram tests after promotion when it’s not necessary (#11994, @rgrinberg)
fix: $ dune subst should not fail when adding the version field in opam
files (#11801, fixes #11045, @btjorge)
Kill all processes in the process group after the main process has
terminated; in particular this avoids background processes in cram tests to
stick around after the test finished (#11841, fixes #11820, @Alizter, @Leonidas-from-XIV)
Added
(tests) stanzas now generate aliases with the test name. To run (test (name a)) you can do dune build @runtest-a. (#11558, grants part of #10239, @Alizter)
Inline test libraries now produce aliases runtest-name_of_lib
allowing users to run specific inline tests as dune build @runtest-name_of_lib. (#11109, partially fixes #10239, @Alizter)
feature: $ dune subst use version from dune-project when no version
control repository has been detected (#11801, @btjorge)
Allow dune exec to run concurrently with another instance of dune in watch
mode (#11840, @gridbugs)
Introduce %{os}, %{os_version}, %{os_distribution}, and %{os_family}
percent forms. These have the same values as their opam counterparts.
(#11863, @rgrinberg)
Introduce option (implicit_transitive_deps false-if-hidden-includes-supported)
that is equivalent to (implicit_transitive_deps false) when -H is
supported by the compiler (OCaml >= 5.2) and equivalent to (implicit_transitive_deps true) otherwise. (#11866, fixes #11212, @nojb)
Add dune describe location for printing the path to the executable that
would be run (#11905, @gridbugs)
dune runtest can now understand absolute paths as well as run tests in
specific build contexts (#11936, @Alizter).
Added ‘empty’ alias which contains no targets. (#11556#11952#11955#4161,
grants #4161, @Alizter and @rgrinberg)
Allow dune promote to properly run while a watch mode server is running
(#12010, @ElectreAAS)
Add --alias and --alias-rec flags as an alternative to the @@ and @
syntax in the command line (#5775, fixes #5775, @rgrinberg)
Added a (timeout <float>) field to the (cram) stanza to specify per-test
time limits. Tests exceeding the timeout are terminated with an error.
(#12041, @Alizter)
Changed
Format long lists in s-expressions to fill the line instead of
formatting them in a vertical way (#10860, fixes #10860, @nojb)
Switch from MD5 to BLAKE3 for digesting targets and rules. BLAKE3 is both more
performant and difficult to break than MD5 (#11735, @rgrinberg, @Alizter)
Print a warning when dune build runs over RPC (#11833, @gridbugs)
Stop emitting empty module group wrapper .js file in melange.emit
(#11986, fixes #11986, @anmonteiro)
However, it seems to receive mostly negative feedback.
Because people giving feedback are usually the unhappy ones?
For sure it’s a matter of preference, but I’ve never been a fan of the very vertical formatting of dune. My screen is larger than it is long, and it would be nice to be able to use some of that space.
Allow dune exec to run concurrently with another instance of dune in watch
mode (#11840, @gridbugs)
I really hope it is NOT being reverted. In many cases one item per line is unreadable. While it isn’t the case for multiple items on a line. And there are many good diff tools which can track changes per word instead of per line.
I’m neutral on the feature itself, but it would be really nice if it only kicked in once the dune-version in the project was updated to >=3.20. Otherwise the version of dune being selected is breaking my formatted CI checks in a bunch of projects. I was surprised to see this go in unconditionally.
I guess the root issue is that dune format-dune-file was (from the Dune maintainers’ perspective) thought of as mostly a debugging/internal tool, but Dune users ended up adopting it and using it, even though it did not have a good versioning story (one can specify a precise version for the formatting using a command-line flag, but otherwise the command does not try to automatically use the version of the current Dune project).
The Dune release manager will decide in the next few days whether or not to revert this change in 3.20.1. If that is the case, the change will most likely be reintroduced in 3.21, in combination with the above PR, so that existing uses of the command will not be affected.
One thing I’ve learned from this upgrade, and that I haven’t see mentioned in the issues or PRs yet, is that dune fmt and dune format-dune-file apparently use separate formatting rules. With 3.20 installed, running dune fmt uses the old multi-line behavior, and dune format-dune-file uses the new single-line behavior. So now scripts (often using the former) and editor plugins (often using the latter) are in disagreement.
The consideration for the revert is for the reason mentioned by @avsm. I would say here it is not a question of taste, but not breaking others’ CIs is mandatory. I understand the way it is currently formatted does not satisfy everyone. That’s why our discussions are going toward the decision of reverting the change in 3.20.1 and reintroducing it later in 3.21.0 (to avoid creating breaking change again) as you can see with the PR pointed out by Nicolas above.
FWIW, this should be consistent if you change the dune-lang version to 3.20 in your dune-project file. fmt does take the dune-lang version into account, format-dune-file does not (at the moment and assumes 3.20 rules) and thus they produce different output.
The Dune Team is happy to announce the release of Dune 3.20.1.
This release introduces some minor fixes and reverts the dune file formatter change. As mentioned above, the formatter change will be reintroduced in a next release once it is able to detect the dune project version.
Changelog
Fixed
Fix runtest-js mistakenly depending on byte (fixes #12243, #12242, @vouillon and @Alizter)
Fix the interpretation of paths in dune runtest when running from within a
subdirectory. (#12251, fixes #12250, @Alizter)
Changed
Revert formatting change introduced in 3.20.0 making long lists in
s-expressions fill the line instead of formatting them in a vertical way
(#12245, reverts #10892, @nojb)