OCaml Changelog

RSS

Official stable release announcements and updates from the OCaml compiler, OCaml infrastructure and the OCaml Platform Tools.

Dune 3.25.0

The Dune team is pleased to announce the release of dune 3.25.0.

Highlights of this release include:

Breaking changes

  • Actions no longer see the shared install staging area (_build/install/<context>/{bin,lib,lib/stublibs}) on PATH, OCAMLPATH and CAML_LD_LIBRARY_PATH. An action's environment only contains the packages it declares with (deps (package <pkg>)) (and their library closure, see below). Actions that rely on packages being visible (such as tests that #require the package under test from an mdx block, steps that run ocamlfind, a nested dune build, or load a bytecode stub library) must now declare the package dependency explicitly. ocaml/dune#14373, ocaml/dune#16617.

  • The : character is now rejected in context names, to ensure they remain portable path components. ocaml/dune#16085.

  • Generated files are now read-only even with Dune language versions before 2.4, regardless of whether the shared cache is enabled. Executable permissions are preserved. ocaml/dune#16388

  • In dune-project, (warnings (duplicate_deps ..)) requires a dune lang version of 3.22, instead of 3.18.1. ocaml/dune#5696.

  • (env (env-vars ...)) in a (context ...) stanza of dune-workspace now takes precedence over the root env stanza, as documented. This affects commands such as dune exec; rules already used the documented order. ocaml/dune#16290.

Features

  • Added command, subcommand, and flag completion in the command line. Supported shells are bash, zsh, pwsh, and fish. See dune completion [shell] --help. ocaml/dune#14779, ocaml/dune#15334.

  • Tab completion for dune promote now lists pending promotion files. ocaml/dune#5338.

  • Add build time information to watch mode. ocaml/dune#15384.

  • Display build duration and average process parallelism in the status line for batch builds. ocaml/dune#15564.

  • Add (flags ...) to the ocamllex and ocamlyacc stanzas to pass custom options to parser generators. ocaml/dune#15907.

  • Starting with Dune language 3.25, restrict sandboxed actions on Linux systems with Landlock ABI 3 or newer from writing outside their sandbox, temporary directory, action-trace directory, and /dev. Set DUNE_CONFIG__LANDLOCK=disabled to opt out. ocaml/dune#15858.

Fixes

  • $ dune rpc build invocations no longer queue. All build requests are built in parallel. Watch servers started by $ dune exec --watch can now also handle forwarded build and runtest requests. ocaml/dune#14954. dune rpc build also now exits with the proper code on completion. ocaml/dune#15341.

  • Portable lock directories now select one package version across all requested platforms, and fail when no common version exists. ocaml/dune#15982.


See the full changelog for all new features and fixes, and for attribution to the contributors who made it all possible. Thank you, contributors!

If you encounter a problem with this release, please report it in our issue tracker.

See full changelog

Fixed

  • Fix crashes when expanding module artifact pforms (%{cmi:...} etc.) with (include_subdirs qualified). Qualified modules can now be referenced by dotted logical paths such as %{cmi:Sub_a.Foo}. (#14498, #16214, fixes #14496, @Alizter, @anmonteiro)
  • dune show targets now accepts build-only directories such as _build/default/.simple.objs. (#14664, fixes #13782, @Alizter)
  • Reword the error raised when %{target} is used in a rule that omits the (target ...) (or (targets ...)) field, so it points at the missing field instead of mentioning "inferred rules". (#14668, fixes #12439, @Alizter)
  • Fix watch mode on Windows by creating the file-watcher sync directory before using it, avoiding open(_build/.sync\0): No such file or directory when an RPC client requests a build. (#14678, fixes #14632, @rgrinberg)
  • Add file watcher trace events for the Mac and Windows backends (#14722, @rgrinberg)
  • Fix decoding coalesced MacOS file notification events. (#14725, @rgrinberg)
  • Handle directory invalidations correctly in watch mode on MacOS (#14756, @rgrinberg)
  • Update ctime when restoring from the shared cache in copy mode. This prevents the trimmer from deleting the file. (#14777, @rgrinberg)
  • Allow the use of all the available variables in the (enabled_if) field in (executable ...) and (install ...) stanzas, similar to other stanzas like (library ...). (#14860, fixes #14789, @punchagan)
  • Linux: dune will now wait for the process group to be dead after the group leader is dead. This tightens dune's policy for what constitutes a successful action. Actions for which dune cannot be clean up the process group will now fail. (@rgrinberg, #14868)
  • Fix caching of package sources with symlinks by resolving symlinks after fetching the sources, similar to the directory symlinks resolution introduced in #13792 (#14871, fixes #14509, @punchagan)
  • Fixed wrong suggestion for duplicate entries in conflicts field (#14956, fixes #14903, @Leonidas-from-XIV)
  • Fix building Dune on Solaris/illumos by handling its wait4 semantics and retrying interrupted reads when spawning processes. (#14980, fixes #14182, @jperkin)
  • Fix dune-rpc-lwt clients so disconnecting shuts down socket output without invalidating pending input reads, avoiding EBADF errors. (#14983, fixes #7624, @rgrinberg)
  • Dune now restores dependency cutoffs concurrently when they were originally computed in parallel, instead of recomputing them one at a time. The cutoffs_that_reduce_concurrency_in_watch_mode setting, which existed to avoid this serialisation, is no longer needed and has been removed. (#15012, @snowleopard)
  • Validate project module names before creating the project directory in dune init project, so aborted initializations no longer leave empty directories behind. (#15014, fixes #9963, @rgrinberg)
  • Fix cram test output sanitization when the project path contains a space. Absolute paths are now rewritten to $TESTCASE_ROOT even when the path contains spaces, and lines with multiple paths have every path sanitized. (#15017, fixes #14943, @yussypu)
  • Improve the error message for private libraries that cannot be dependencies of public libraries by mentioning the (package ...) field as an alternative to giving the private library a public name (#15070, fixes #10230, @rgrinberg).
  • Clarify the module conflict error shown when a module is used in multiple stanzas. The message now explains implicit module ownership and lists all relevant stanza kinds (#15072, fixes #6598, @rgrinberg).
  • Emit relative artifact references in installed dune-package files when using an absolute external DUNE_BUILD_DIR, avoiding build-directory-dependent archive and module paths (#15077, fixes #11774, @rgrinberg).
  • Simplify away (when false _) expressions (encoded Nils) that previously survived inside concat and when forms, producing cleaner generated lock directories. (#15092, fixes #15090, @chizy7)
  • Drop (when false _) arguments from run actions in generated lock directories instead of keeping them as no-op entries that were re-encoded as (when false ""). (#15128, fixes #15099, @chizy7)
  • Make dune-configurator pass --personality to pkgconf only for version 1.7.0 and later. (#15142, fixes #11536, @dra27)
  • dune utop now accepts an absolute path to a workspace directory instead of crashing with an internal error. (#15272, fixes #15108, @chizy7)
  • Fix watch-mode status lines after source changes interrupt a build. Dune now shows the restart status while cancelling the current build and resumes the normal progress counter when the next build starts. (#15289, fixes #11134, @rgrinberg)
  • Short-circuit AND and OR expressions in blang. This makes their evaluation lazy by default. (#15291, @Sudha247)
  • Fix the %{ppx:ppx1+..+ppxn} form. Previously, it was just broken and pointed at the wrong binary (#15361, @rgrinberg)
  • Remove ppx runtime dependencies from the list of dependencies provided via the root_module field. If such a runtime dependency is needed, it should be written in the libraries field. (#15419, @rgrinberg)
  • Avoid rebuilding js_of_ocaml library archives on every invocation for interface-only and empty libraries. (#15427, @anmonteiro)
  • Do not crash when ~/.config/dune is a file instead of a directory. Just pretend it doesn't exist (#15475, fixes #15406, @rgrinberg)
  • Dune will now terminate all launched sub-processes even if it received SIGKILL itself (#15483, @rgrinberg)
  • Account for ctime in stat based digest cache (#15495, @rgrinberg)
  • $ dune install --dry-run now checks for non empty directories as part of its validation (#15501, @rgrinberg)
  • Fix a target-less rule attached to multiple aliases ((rule (aliases a b) ...)) leaking unrelated contributions between those aliases. Building one alias no longer pulls in actions or dependencies that were added only to another of the rule's aliases. (#15581, @NatKarmios)
  • Make dune pkg enabled query a running Dune RPC server, so it observes transient server-side --pkg enabled and --pkg disabled settings without trying to acquire the build lock (#15589, fixes #15587, @Alizter)
  • Make generated MDX executables inherit link_flags from env stanzas. (#15614, fixes #15613, @Alizter)
  • Return Unix errors from Fs_io.read_file rather than raising them. (#15641, @rgrinberg)
  • Correct filesystem trace metrics for file writes and directory scans. (#15686, @rgrinberg)
  • Preserve runtime-event ring IDs in Dune traces so consumers can distinguish interleaved event streams. (#15687, @rgrinberg)
  • BREAKING CHANGE: in dune-project, (warnings (duplicate_deps ..)) requires a dune lang version of 3.22, instead of 3.18 (#15696, @v-gb).
  • Preserve spaces in unquoted filenames when applying Git patches instead of truncating paths at the first space (#15781, @rgrinberg)
  • Respect enabled_if on install stanzas when adding their files and directories to the @all alias. (#15895, fixes #15825, @aryemans)
  • Fix Melange emission with installed libraries whose .cmj and .cmi files are stored in the melange object directory (#15949, fixes #14820, @anmonteiro)
  • Reject package dependencies in named dependency bindings while decoding dependency fields, including for disabled stanzas. (#15966, @rgrinberg)
  • Fix Merlin definition lookup for libraries with private modules (#15977, fixes #4892, @anmonteiro)
  • Fix a crash when generating install rules for a Melange-only implementation of an installed virtual library (#16033, @anmonteiro)
  • Prevent build cancellation from crashing Dune when macOS reports EPERM while signaling a process group (#16059, fixes #16053, @rgrinberg)
  • Fix dune pkg outdated so it fails early with a clear user message if it is run when package management is not enabled. (#16065, @shonfeder)
  • Fix watch mode builds remaining stale after the file watcher event queue overflows (#16068, fixes #16052, @rgrinberg)
  • Reject Windows path separators in validated filename components (#16076, @rgrinberg)
  • Preserve output following malformed ANSI escape sequences and erase-line controls (#16116, @rgrinberg).
  • Resolve relative paths passed to dune ocaml top-module from the directory where Dune was started, allowing use from workspace subdirectories. (#16135, @rgrinberg)
  • Allow dune ocaml top to accept absolute directory paths inside the workspace. (#16142, @rgrinberg)
  • Allow Dune promotion commands to accept absolute source paths inside the workspace. (#16143, @rgrinberg)
  • Allow dune describe workspace to accept absolute directory filters inside the workspace. (#16144, @rgrinberg)
  • Reject empty module_systems fields in melange.emit stanzas instead of silently producing no JavaScript files (#16162, @anmonteiro)
  • Sandbox PPX lint actions starting with Dune language 3.25 so linters cannot observe undeclared build targets. (#16176, @rgrinberg)
  • Prevent diagnostic source locations at compact-position field boundaries from being truncated (#16180, @rgrinberg)
  • Sandbox ocaml-mdx deps when using MDX extension 0.6 so dependency discovery cannot observe undeclared workspace inputs. (#16183, @rgrinberg)
  • Fix missing Odoc generation of OxCaml parameter implementations (#16200, @art-w)
  • Make Dune_rpc_lwt.V1.Action_plugin.read_directory_with_glob return an empty listing for absent directories (#16207, fixes #4445, @rgrinberg)
  • Fix compiling Melange implementations of installed virtual libraries, both with and without binary annotations, including transitive private module dependencies (#16211, #16212, #16272, @anmonteiro)
  • Run Ctypes stub generation in a sandbox and honor its declared dependencies. (#16223, @rgrinberg)
  • Fix @opam failing to promote a generated opam file after it is deleted (#16234, fixes #16233, @Alizter)
  • Rebuild generated Ctypes helpers when headers from Ctypes' implicit include directories change (#16243, @rgrinberg)
  • Collect action-provided trace events when an action fails instead of dropping them during result validation. (#16250, @rgrinberg)
  • Report the usual program-not-found error when a dynamic-run executable is missing instead of failing with an assertion. (#16251, @rgrinberg)
  • Prevent rules with duplicate lock declarations from deadlocking by acquiring each lock only once. (#16252, @rgrinberg)
  • Prevent concurrent action children from closing shared redirections before their siblings use them (#16257, @rgrinberg)
  • Resolve relative paths in forwarded build, runtest, and exec commands from the client's directory instead of the RPC server's directory (#16267, @rgrinberg)
  • (env (env-vars ...)) in a (context ...) stanza of dune-workspace now takes precedence over the root env stanza, as documented. This affects commands such as dune exec; rules already used the documented order. (#16290, @punchagan)
  • Fix a crash when an opam filter is not a boolean (#16313, @art-w)
  • Correct module paths for generated interfaces of nested qualified module groups. (#16322, @anmonteiro)
  • Resolve %{cmi:...}, %{cmt:...}, and %{cmti:...} against Melange module sets when no OCaml module is selected, while preferring OCaml for modules selected in both modes. (#16339, @anmonteiro)
  • Reject . and .. as melange.emit targets instead of raising an internal error (#16371, @anmonteiro)
  • Validate custom toplevel names as filenames, reporting an error for empty names and avoiding crashes for names containing paths (#16373, @anmonteiro)
  • Fix Menhir type inference with package-managed relocatable compilers on macOS by making the compiler standard library available in the sandbox (#16374, fixes #15642, @Alizter, @shonfeder)
  • Reject invalid Menhir merge_into names during parsing to prevent internal errors (#16387, @anmonteiro)
  • Reject conflicting module sources in unqualified directory groups, including generated sources, instead of silently discarding one (#16414, @anmonteiro)
  • fix copying of directory targets on windows (#16434, @kentookura)
  • Track local module dependencies used by Menhir's type inference so generated parsers and dependent modules build and rebuild correctly (#16447, fixes #14450, @anmonteiro)
  • Fix Menhir type inference for qualified module group interfaces while keeping dependency lookup in terms of logical module names (#16464, #16489, #16497, fixes #8989, @anmonteiro)
  • Fix intermittent crashes on Windows caused by unstable file descriptor hashing (#16476, fixes #16459, @Alizter)
  • Explain that forwarded build requests require a watch-mode Dune server instead of reporting an internal RPC error. (#16486, fixes #16219, @Alizter)
  • (deps (package ...)) now tracks installed files of lock-built packages and their package dependencies, rebuilding actions when they change. (#16507, @Alizter)
  • Share Rocq plugin layout dependencies between discovery and compilation rules, reducing repeated dependency processing in unchanged builds. (#16622, @Alizter)
  • Support directory dependencies in hardlink sandboxes by linking their files rather than the directories themselves (#16675, @Alizter).
  • Fix recursive copy actions rejecting symbolic links, including file links created by symlink sandboxes (#16686, @rgrinberg).
  • Fix copy sandbox failures caused by overlapping directory and file dependencies (#16806, fixes #16547, @Alizter)
  • Fix Menhir inference producing invalid module paths for types imported from other modules (#16952, @anmonteiro)

Added

  • Add (dirs ...) to (include_subdirs (mode qualified) ...), allowing qualified source directories to be renamed in the module path, including when bootstrapping. Mappings can use variables, including reads from generated files outside the qualified group (#13691, #16418, #16420, fixes #7605, @anmonteiro).
  • Add opt-in action runners via --action-runner, and add --sandbox-actions to run eligible process-spawning actions in a bubblewrap-wrapped worker. (#14240, @rgrinberg)
  • Add platform support for DragonFly BSD (#14774, fixes same issue with lev as seen on NetBSD in #14484, @mneumann).
  • Added command, subcommand, and flag completion in the command line. Supported shells are bash, zsh, and pwsh. See dune completion [shell] --help. (#14779, @ElectreAAS)
  • Add %{git-sha} variable that expands to the short git SHA of the current HEAD commit, or the empty string when git is unavailable or the workspace is not inside a git repository (#14810, @toots).
  • Add a ?static optional argumentin Configurator.V1.Pkg_config.get to instruct pkg-config to get static linking options. (#14947, @raphael-proust)
  • Only generate Melange rule for multi-mode libraries if melc is installed (#15021, @anmonteiro)
  • Add Configurator.V1.Pkg_config.query_variable to query package variables through pkg-config --variable (#15078, fixes #3332, @rgrinberg).
  • Add env_vars as an alias for the env-vars field in env stanzas (#15187, fixes #11424, @rgrinberg).
  • Add @rocqproject alias to generate all `_RocqProject files (#15221, @rlepigre-skylabs-ai).
  • Tab completion for dune promote now lists pending promotion files. (#15338, fixes #7254, @Alizter).
  • Add build time information to watch mode (#15384, @rgrinberg)
  • Added the missing dune tools exec utop and dune tools exec odoc options. (#15388, @Leonidas-from-XIV)
  • Display build parallelism in watch mode. (#15390, @rgrinberg)
  • Add process counts, system cpu, user cpu, and wall clock cpu times to trace events (#15401, @rgrinberg)
  • Support --sandbox-actions on macOS using sandbox-exec. (#15500, @rgrinberg)
  • Add fish to the shells supported by dune completion, enabling command, subcommand, and flag completion in the fish shell (#15515, fixes #15334, @chizy7)
  • Display build duration and average process parallelism in the status line for batch builds. (#15564, @rgrinberg)
  • Add a --split-public-names flag to dune describe workspace and dune describe external-lib-deps. When enabled, the name/names fields report only private names and a new public_name/public_names field reports the public names. (#15582, @natkarmios)
  • Add a --include-empty flag to dune describe external-lib-deps to also print libraries that have no internal or external dependencies (#15585, @NatKarmios)
  • Support qualified module references in fields such as per_module when using (include_subdirs qualified) (#15633, fixes #15578, @anmonteiro)
  • Display the current build run at the end of watch-mode status lines. (#15673, @rgrinberg)
  • Record per-build Memo compute, restore, and cycle-detection metrics in Dune traces. (#15698, @rgrinberg)
  • Record discovered, validated, and failed rule counts in Dune traces. (#15701, @rgrinberg)
  • Add %{melange.emit:...} to reference a Melange output directory and depend on its emitted files (#15751, @anmonteiro)
  • Add (flags ...) to the ocamllex and ocamlyacc stanzas to pass custom options to parser generators. (#15907, @rgrinberg)
  • Added an opt-in sat trace category emitting a sat/solve event with the SAT solver's stats (variables, clauses, decisions, conflicts) and duration. Enable with DUNE_TRACE=+sat. (#15923, @Alizter)
  • Add dune ocaml inferred-mli to infer an interface with a module's build configuration and register it for promotion. (#16111, fixes #12727, @rgrinberg)
  • Add --no-actions and --only-actions to dune trace cat to filter events collected from actions. (#16245, @rgrinberg)

Changed

  • BREAKING CHANGE: Actions no longer see the shared install staging area (_build/install/<context>/{bin,lib,lib/stublibs}) on PATH, OCAMLPATH and CAML_LD_LIBRARY_PATH. An action's environment only contains the packages it declares with (deps (package <pkg>)) (and their library closure, see below). Actions that rely on packages being visible (such as tests that #require the package under test from an mdx block, steps that run ocamlfind, a nested dune build, or load a bytecode stub library) must now declare the package dependency explicitly. (#14373, #16617, @Alizter)
  • (package <pkg>) now also includes the packages owning the library closures of libraries in workspace and installed packages. Installed packages reached through those closures also work with Dune language versions older than 2.9. (#14373, #16362, #16529, @Alizter, @anmonteiro)
  • Extract the structural-hash accumulator into a new Stdune.Hash module and route Stdune.Tuple.T2.hash, Stdune.Tuple.T3.hash, Stdune.List.hash, Stdune.Result.hash, and Resolve.error_hash through it. Hashing these structural shapes no longer allocates per call. (#14542, @robinbb)
  • Remove (using melange 0.1) in Dune 3.25 in favor of version 1.0 of the extension. (#14574, @anmonteiro)
  • $ dune rpc build invocations no longer queue. All build requests are built in parallel. Watch servers started by $ dune exec --watch can now also handle forwarded build and runtest requests (#14954, @rgrinberg)
  • Report rule build progress as the number of rules built against the total number of live rules, rather than rules executed against rules discovered during the current run. This affects both the status line and the progress reported over RPC. (#14985, @snowleopard, @pwhite)
  • With --error-reporting=twice, print an ==== Error Summary ==== separator before the deterministic list of errors reported at the end of the build. The separator is omitted when there are no errors to report. (#15016, fixes #14757, @yussypu)
  • Enable fuzzy patch application by default for Dune. This is similar to OPAM's behaviour, and this makes it easier for packages like OxCaml to build. (#15146, fixes #15145, @Sudha247)
  • Odoc rules are now sandboxed (#15190, @rgrinberg)
  • In watch mode, $ dune rpc build requests now complete as soon as their requested build finishes, instead of waiting for unrelated concurrent RPC build requests in the same build iteration. (#15191, fixes #13788, @rgrinberg)
  • Cleanup all build processes spawned by dune before starting a fresh build on Linux. (#15239, #15274, @rgrinberg)
  • Show partial output timed out cram tests (#15269, @rgrinberg)
  • In watch mode, $ dune rpc build now exits with status 1 when the requested build fails. (#15341, @rgrinberg)
  • Debounce file change events in watch mode (#15344, @rgrinberg)
  • Align dune's C compiler vendor detection with the OCaml compiler's own identifiers (msvc, icc, mingw, clang, gcc, xlc, sunc), so more C compilers are recognized without emitting a spurious warning. (#15423, fixes #14870, @chizy7)
  • Never use $ lsof for counting file descriptors, as it is not allowed to reap processes outside of the scheduler. We have better mechanisms on MacOS and Linux for counting file descriptors. So this is only an issue on other Unices. (#15477, @rgrinberg)
  • dune describe workspace now reports an origin field for every module, indicating whether its source was written by hand (source), generated by a rule stanza (dune, with the generating dune file), produced by ocamllex, ocamlyacc, or menhir, or synthesised by dune itself for wrapping (wrapper). Generated modules point at the responsible file. The --with-origin-deps and --with-origin-deps-expanded flags additionally report the dependencies of a rule-generated module, as declared and expanded to concrete files respectively. (#15478, @nat-karmios)
  • Numbers with unit now allow dropping the unit if the number is zero ("0"). For example, dune cache trim --trimmed-size 0 and dune cache trim --trimmed-size 0TiB are now both accepted and equivalent. (#15498, @reynir)
  • Run artifact substitution in background workers. (#15559, @anmonteiro)
  • dune describe now reports the public name of an executable (from public_name/public_names) instead of its private name when one is available, falling back to the private name otherwise. (#15582, @natkarmios)
  • Calculate status-line build parallelism from process CPU time rather than wall-clock action time; Windows continues to use wall-clock time. (#15685, @rgrinberg)
  • Use sha256 instead of md5 for source archives that lack a checksum (#15824, @shunueda)
  • Starting with Dune language 3.25, restrict sandboxed actions on Linux systems with Landlock ABI 3 or newer from writing outside their sandbox, temporary directory, action-trace directory, and /dev. Set DUNE_CONFIG__LANDLOCK=disabled to opt out. (#15858, @rgrinberg)
  • dune pkg lock now fails without writing a lock directory when any platform requested by solve_for_platforms cannot be solved, instead of producing a partial lock directory containing only the successful platforms. (#15981, @Alizter)
  • Portable lock directories now select one package version across all requested platforms, and fail when no common version exists. (#15982, fixes #13645, fixes #13647, @Alizter)
  • BREAKING CHANGE: Reject : in context names so they remain portable path components (#16085, @rgrinberg)
  • Keep .t suffixes in cram test names, including aliases and applies_to, starting with Dune language 3.25 (#16146, @rgrinberg)
  • Sandbox ocaml-mdx dune-gen when using MDX extension 0.6, available from Dune 3.25. (#16177, @rgrinberg)
  • Sandbox pkg-config queries starting with Dune language 3.25 so they cannot observe undeclared workspace inputs. (#16178, @rgrinberg)
  • Remove the experimental OCamlFDO integration, including the (fdo ...) workspace field (#16198, @rgrinberg)
  • BREAKING CHANGE: Generated files are now read-only even with Dune language versions before 2.4, regardless of whether the shared cache is enabled. Executable permissions are preserved. (#16388, @rgrinberg)
  • Make newly written shared-cache metadata files read-only to guard against accidental modification. (#16393, @rgrinberg)

Dune 3.25.0

CHANGES:

Fixed

  • Fix crashes when expanding module artifact pforms (%{cmi:...} etc.) with
    (include_subdirs qualified). Qualified modules can now be referenced by
    dotted logical paths such as %{cmi:Sub_a.Foo}.
    (#14498, #16214, fixes #14496, @Alizter, @anmonteiro)

  • dune show targets now accepts build-only directories such as
    _build/default/.simple.objs. (#14664, fixes #13782, @Alizter)

  • Reword the error raised when %{target} is used in a rule that omits the
    (target ...) (or (targets ...)) field, so it points at the missing
    field instead of mentioning "inferred rules". (#14668, fixes #12439,
    @Alizter)

  • Fix watch mode on Windows by creating the file-watcher sync directory before
    using it, avoiding open(_build/.sync\0): No such file or directory when an
    RPC client requests a build. (#14678, fixes #14632, @rgrinberg)

  • Add file watcher trace events for the Mac and Windows backends (#14722, @rgrinberg)

  • Fix decoding coalesced MacOS file notification events. (#14725, @rgrinberg)

  • Handle directory invalidations correctly in watch mode on MacOS (#14756, @rgrinberg)

  • Update ctime when restoring from the shared cache in copy mode. This prevents
    the trimmer from deleting the file. (#14777, @rgrinberg)

  • Allow the use of all the available variables in the (enabled_if) field in
    (executable ...) and (install ...) stanzas, similar to other stanzas like
    (library ...). (#14860, fixes #14789, @punchagan)

  • Linux: dune will now wait for the process group to be dead after the group
    leader is dead. This tightens dune's policy for what constitutes
    a successful action. Actions for which dune cannot be clean up the process
    group will now fail. (@rgrinberg, #14868)

  • Fix caching of package sources with symlinks by resolving symlinks after
    fetching the sources, similar to the directory symlinks resolution introduced
    in #13792 (#14871, fixes #14509, @punchagan)

  • Fixed wrong suggestion for duplicate entries in conflicts field (#14956,
    fixes #14903, @Leonidas-from-XIV)

  • Fix building Dune on Solaris/illumos by handling its wait4 semantics
    and retrying interrupted reads when spawning processes. (#14980, fixes #14182,
    @jperkin)

  • Fix dune-rpc-lwt clients so disconnecting shuts down socket output
    without invalidating pending input reads, avoiding EBADF errors. (#14983,
    fixes #7624, @rgrinberg)

  • Dune now restores dependency cutoffs concurrently when they were originally
    computed in parallel, instead of recomputing them one at a time. The
    cutoffs_that_reduce_concurrency_in_watch_mode setting, which existed to
    avoid this serialisation, is no longer needed and has been removed.
    (#15012, @snowleopard)

  • Validate project module names before creating the project directory in
    dune init project, so aborted initializations no longer leave empty
    directories behind. (#15014, fixes #9963, @rgrinberg)

  • Fix cram test output sanitization when the project path contains a space.
    Absolute paths are now rewritten to $TESTCASE_ROOT even when the path
    contains spaces, and lines with multiple paths have every path sanitized.
    (#15017, fixes #14943, @yussypu)

  • Improve the error message for private libraries that cannot be dependencies of
    public libraries by mentioning the (package ...) field as an alternative to
    giving the private library a public name (#15070, fixes #10230, @rgrinberg).

  • Clarify the module conflict error shown when a module is used in multiple
    stanzas. The message now explains implicit module ownership and lists all
    relevant stanza kinds (#15072, fixes #6598, @rgrinberg).

  • Emit relative artifact references in installed dune-package files when using
    an absolute external DUNE_BUILD_DIR, avoiding build-directory-dependent
    archive and module paths (#15077, fixes #11774, @rgrinberg).

  • Simplify away (when false _) expressions (encoded Nils) that previously
    survived inside concat and when forms, producing cleaner generated lock
    directories. (#15092, fixes #15090, @chizy7)

  • Drop (when false _) arguments from run actions in generated lock
    directories instead of keeping them as no-op entries that were re-encoded as
    (when false ""). (#15128, fixes #15099, @chizy7)

  • Make dune-configurator pass --personality to pkgconf only for
    version 1.7.0 and later. (#15142, fixes #11536, @dra27)

  • dune utop now accepts an absolute path to a workspace directory instead of
    crashing with an internal error. (#15272, fixes #15108, @chizy7)

  • Fix watch-mode status lines after source changes interrupt a build. Dune now
    shows the restart status while cancelling the current build and resumes the
    normal progress counter when the next build starts. (#15289, fixes #11134,
    @rgrinberg)

  • Short-circuit AND and OR expressions in blang. This makes their evaluation
    lazy by default.
    (#15291, @Sudha247)

  • Fix the %{ppx:ppx1+..+ppxn} form. Previously, it was just broken
    and pointed at the wrong binary (#15361, @rgrinberg)

  • Remove ppx runtime dependencies from the list of dependencies provided via
    the root_module field. If such a runtime dependency is needed, it should be
    written in the libraries field. (#15419, @rgrinberg)

  • Avoid rebuilding js_of_ocaml library archives on every invocation for
    interface-only and empty libraries. (#15427, @anmonteiro)

  • Do not crash when ~/.config/dune is a file instead of a directory. Just
    pretend it doesn't exist (#15475, fixes #15406, @rgrinberg)

  • Dune will now terminate all launched sub-processes even if it received
    SIGKILL itself (#15483, @rgrinberg)

  • Account for ctime in stat based digest cache (#15495, @rgrinberg)

  • $ dune install --dry-run now checks for non empty directories as part of its
    validation (#15501, @rgrinberg)

  • Fix a target-less rule attached to multiple aliases ((rule (aliases a b) ...)) leaking unrelated contributions between those aliases. Building one
    alias no longer pulls in actions or dependencies that were added only to
    another of the rule's aliases. (#15581, @NatKarmios)

  • Make dune pkg enabled query a running Dune RPC server, so it observes
    transient server-side --pkg enabled and --pkg disabled settings without
    trying to acquire the build lock (#15589, fixes #15587, @Alizter)

  • Make generated MDX executables inherit link_flags from env stanzas.
    (#15614, fixes #15613, @Alizter)

  • Return Unix errors from Fs_io.read_file rather than raising them. (#15641,
    @rgrinberg)

  • Correct filesystem trace metrics for file writes and directory scans.
    (#15686, @rgrinberg)

  • Preserve runtime-event ring IDs in Dune traces so consumers can distinguish
    interleaved event streams. (#15687, @rgrinberg)

  • BREAKING CHANGE: in dune-project, (warnings (duplicate_deps ..)) requires
    a dune lang version of 3.22, instead of 3.18 (#15696, @v-gb).

  • Preserve spaces in unquoted filenames when applying Git patches instead of
    truncating paths at the first space (#15781, @rgrinberg)

  • Respect enabled_if on install stanzas when adding their files and
    directories to the @all alias. (#15895, fixes #15825, @aryemans)

  • Fix Melange emission with installed libraries whose .cmj and .cmi files
    are stored in the melange object directory (#15949, fixes #14820,
    @anmonteiro)

  • Reject package dependencies in named dependency bindings while decoding
    dependency fields, including for disabled stanzas. (#15966, @rgrinberg)

  • Fix Merlin definition lookup for libraries with private modules
    (#15977, fixes #4892, @anmonteiro)

  • Fix a crash when generating install rules for a Melange-only implementation
    of an installed virtual library (#16033, @anmonteiro)

  • Prevent build cancellation from crashing Dune when macOS reports EPERM
    while signaling a process group (#16059, fixes #16053, @rgrinberg)

  • Fix dune pkg outdated so it fails early with a clear user message if it is
    run when package management is not enabled. (#16065, @shonfeder)

  • Fix watch mode builds remaining stale after the file watcher event queue
    overflows (#16068, fixes #16052, @rgrinberg)

  • Reject Windows path separators in validated filename components (#16076,
    @rgrinberg)

  • Preserve output following malformed ANSI escape sequences and erase-line
    controls (#16116, @rgrinberg).

  • Resolve relative paths passed to dune ocaml top-module from the directory
    where Dune was started, allowing use from workspace subdirectories. (#16135,
    @rgrinberg)

  • Allow dune ocaml top to accept absolute directory paths inside the
    workspace. (#16142, @rgrinberg)

  • Allow Dune promotion commands to accept absolute source paths inside the
    workspace. (#16143, @rgrinberg)

  • Allow dune describe workspace to accept absolute directory filters inside
    the workspace. (#16144, @rgrinberg)

  • Reject empty module_systems fields in melange.emit stanzas instead of
    silently producing no JavaScript files (#16162, @anmonteiro)

  • Sandbox PPX lint actions starting with Dune language 3.25 so linters cannot
    observe undeclared build targets. (#16176, @rgrinberg)

  • Prevent diagnostic source locations at compact-position field boundaries from
    being truncated (#16180, @rgrinberg)

  • Sandbox ocaml-mdx deps when using MDX extension 0.6 so dependency
    discovery cannot observe undeclared workspace inputs. (#16183, @rgrinberg)

  • Fix missing Odoc generation of OxCaml parameter implementations (#16200, @art-w)

  • Make Dune_rpc_lwt.V1.Action_plugin.read_directory_with_glob return an empty listing
    for absent directories (#16207, fixes #4445, @rgrinberg)

  • Fix compiling Melange implementations of installed virtual libraries, both
    with and without binary annotations, including transitive private module
    dependencies (#16211, #16212, #16272, @anmonteiro)

  • Run Ctypes stub generation in a sandbox and honor its declared dependencies.
    (#16223, @rgrinberg)

  • Fix @opam failing to promote a generated opam file after it is deleted
    (#16234, fixes #16233, @Alizter)

  • Rebuild generated Ctypes helpers when headers from Ctypes' implicit include
    directories change (#16243, @rgrinberg)

  • Collect action-provided trace events when an action fails instead of dropping
    them during result validation. (#16250, @rgrinberg)

  • Report the usual program-not-found error when a dynamic-run executable is
    missing instead of failing with an assertion. (#16251, @rgrinberg)

  • Prevent rules with duplicate lock declarations from deadlocking by acquiring
    each lock only once. (#16252, @rgrinberg)

  • Prevent concurrent action children from closing shared redirections before
    their siblings use them (#16257, @rgrinberg)

  • Resolve relative paths in forwarded build, runtest, and exec commands from
    the client's directory instead of the RPC server's directory (#16267,
    @rgrinberg)

  • (env (env-vars ...)) in a (context ...) stanza of dune-workspace now
    takes precedence over the root env stanza, as documented. This affects
    commands such as dune exec; rules already used the documented order.
    (#16290, @punchagan)

  • Fix a crash when an opam filter is not a boolean (#16313, @art-w)

  • Correct module paths for generated interfaces of nested qualified module
    groups. (#16322, @anmonteiro)

  • Resolve %{cmi:...}, %{cmt:...}, and %{cmti:...} against Melange
    module sets when no OCaml module is selected, while preferring OCaml for
    modules selected in both modes. (#16339, @anmonteiro)

  • Reject . and .. as melange.emit targets instead of raising an internal
    error (#16371, @anmonteiro)

  • Validate custom toplevel names as filenames, reporting an error for empty
    names and avoiding crashes for names containing paths (#16373, @anmonteiro)

  • Fix Menhir type inference with package-managed relocatable compilers on macOS
    by making the compiler standard library available in the sandbox (#16374,
    fixes #15642, @Alizter, @shonfeder)

  • Reject invalid Menhir merge_into names during parsing to prevent internal
    errors (#16387, @anmonteiro)

  • Reject conflicting module sources in unqualified directory groups,
    including generated sources, instead of silently discarding one
    (#16414, @anmonteiro)

  • fix copying of directory targets on windows (#16434, @kentookura)

  • Track local module dependencies used by Menhir's type inference so generated
    parsers and dependent modules build and rebuild correctly
    (#16447, fixes #14450, @anmonteiro)

  • Fix Menhir type inference for qualified module group interfaces while keeping
    dependency lookup in terms of logical module names (#16464, #16489, #16497,
    fixes #8989, @anmonteiro)

  • Fix intermittent crashes on Windows caused by unstable file descriptor
    hashing (#16476, fixes #16459, @Alizter)

  • Explain that forwarded build requests require a watch-mode Dune server instead
    of reporting an internal RPC error. (#16486, fixes #16219, @Alizter)

  • (deps (package ...)) now tracks installed files of lock-built packages
    and their package dependencies, rebuilding actions when they change.
    (#16507, @Alizter)

  • Share Rocq plugin layout dependencies between discovery and compilation
    rules, reducing repeated dependency processing in unchanged builds.
    (#16622, @Alizter)

  • Support directory dependencies in hardlink sandboxes by linking their files
    rather than the directories themselves (#16675, @Alizter).

  • Fix recursive copy actions rejecting symbolic links, including file links
    created by symlink sandboxes (#16686, @rgrinberg).

  • Fix copy sandbox failures caused by overlapping directory and file
    dependencies (#16806, fixes #16547, @Alizter)

  • Fix Menhir inference producing invalid module paths for types imported from
    other modules (#16952, @anmonteiro)

Added

  • Add (dirs ...) to (include_subdirs (mode qualified) ...), allowing
    qualified source directories to be renamed in the module path, including
    when bootstrapping. Mappings can use variables, including reads from generated
    files outside the qualified group (#13691, #16418, #16420, fixes #7605,
    @anmonteiro).

  • Add opt-in action runners via --action-runner, and add
    --sandbox-actions to run eligible process-spawning actions in a
    bubblewrap-wrapped worker. (#14240, @rgrinberg)

  • Add platform support for DragonFly BSD (#14774, fixes same issue with lev
    as seen on NetBSD in #14484, @mneumann).

  • Added command, subcommand, and flag completion in the command line.
    Supported shells are bash, zsh, and pwsh.
    See dune completion [shell] --help.
    (#14779, @ElectreAAS)

  • Add %{git-sha} variable that expands to the short git SHA of the current
    HEAD commit, or the empty string when git is unavailable or the workspace is
    not inside a git repository (#14810, @toots).

  • Add a ?static optional argumentin Configurator.V1.Pkg_config.get to instruct pkg-config to get static linking options. (#14947, @raphael-proust)

  • Only generate Melange rule for multi-mode libraries if melc is installed
    (#15021, @anmonteiro)

  • Add Configurator.V1.Pkg_config.query_variable to query package variables
    through pkg-config --variable (#15078, fixes #3332, @rgrinberg).

  • Add env_vars as an alias for the env-vars field in env stanzas
    (#15187, fixes #11424, @rgrinberg).

  • Add @rocqproject alias to generate all `_RocqProject files
    (#15221, @rlepigre-skylabs-ai).

  • Tab completion for dune promote now lists pending promotion files.
    (#15338, fixes #7254, @Alizter).

  • Add build time information to watch mode (#15384, @rgrinberg)

  • Added the missing dune tools exec utop and dune tools exec odoc options.
    (#15388, @Leonidas-from-XIV)

  • Display build parallelism in watch mode. (#15390, @rgrinberg)

  • Add process counts, system cpu, user cpu, and wall clock cpu times to trace
    events (#15401, @rgrinberg)

  • Support --sandbox-actions on macOS using sandbox-exec. (#15500,
    @rgrinberg)

  • Add fish to the shells supported by dune completion, enabling
    command, subcommand, and flag completion in the fish shell (#15515,
    fixes #15334, @chizy7)

  • Display build duration and average process parallelism in the status line for
    batch builds. (#15564, @rgrinberg)

  • Add a --split-public-names flag to dune describe workspace and dune describe external-lib-deps. When enabled, the name/names fields report
    only private names and a new public_name/public_names field reports the
    public names. (#15582, @NatKarmios)

  • Add a --include-empty flag to dune describe external-lib-deps to also
    print libraries that have no internal or external dependencies (#15585,
    @NatKarmios)

  • Support qualified module references in fields such as per_module when using
    (include_subdirs qualified) (#15633, fixes #15578, @anmonteiro)

  • Display the current build run at the end of watch-mode status lines.
    (#15673, @rgrinberg)

  • Record per-build Memo compute, restore, and cycle-detection metrics in Dune
    traces. (#15698, @rgrinberg)

  • Record discovered, validated, and failed rule counts in Dune traces.
    (#15701, @rgrinberg)

  • Add %{melange.emit:...} to reference a Melange output directory and
    depend on its emitted files (#15751, @anmonteiro)

  • Add (flags ...) to the ocamllex and ocamlyacc stanzas to pass custom
    options to parser generators. (#15907, @rgrinberg)

  • Added an opt-in sat trace category emitting a sat/solve event with
    the SAT solver's stats (variables, clauses, decisions, conflicts) and
    duration. Enable with DUNE_TRACE=+sat. (#15923, @Alizter)

  • Add dune ocaml inferred-mli to infer an interface with a module's build
    configuration and register it for promotion. (#16111, fixes #12727,
    @rgrinberg)

  • Add --no-actions and --only-actions to dune trace cat to filter
    events collected from actions. (#16245, @rgrinberg)

Changed

  • BREAKING CHANGE: Actions no longer see the shared install staging area
    (_build/install/<context>/{bin,lib,lib/stublibs}) on PATH, OCAMLPATH and
    CAML_LD_LIBRARY_PATH. An action's environment only contains the packages it
    declares with (deps (package <pkg>)) (and their library closure, see below).
    Actions that rely on packages being visible (such as tests that #require the
    package under test from an mdx block, steps that run ocamlfind, a nested dune
    build, or load a bytecode stub library) must now declare the package
    dependency explicitly.
    (#14373, #16617, @Alizter)

  • (package <pkg>) now also includes the packages owning the library closures
    of libraries in workspace and installed packages. Installed packages reached
    through those closures also work with Dune language versions older than 2.9.
    (#14373, #16362, #16529, @Alizter, @anmonteiro)

  • Extract the structural-hash accumulator into a new Stdune.Hash
    module and route Stdune.Tuple.T2.hash, Stdune.Tuple.T3.hash,
    Stdune.List.hash, Stdune.Result.hash, and Resolve.error_hash
    through it. Hashing these structural shapes no longer allocates per
    call.
    (#14542, @robinbb)

  • Remove (using melange 0.1) in Dune 3.25 in favor of version 1.0 of the
    extension. (#14574, @anmonteiro)

  • $ dune rpc build invocations no longer queue. All build requests are built
    in parallel. Watch servers started by $ dune exec --watch can now also
    handle forwarded build and runtest requests (#14954, @rgrinberg)

  • Report rule build progress as the number of rules built against the total
    number of live rules, rather than rules executed against rules discovered
    during the current run. This affects both the status line and the progress
    reported over RPC. (#14985, @snowleopard, @pWhite)

  • With --error-reporting=twice, print an ==== Error Summary ==== separator
    before the deterministic list of errors reported at the end of the build. The
    separator is omitted when there are no errors to report.
    (#15016, fixes #14757, @yussypu)

  • Enable fuzzy patch application by default for Dune. This is similar to OPAM's
    behaviour, and this makes it easier for packages like OxCaml to build.
    (#15146, fixes #15145, @Sudha247)

  • Odoc rules are now sandboxed (#15190, @rgrinberg)

  • In watch mode, $ dune rpc build requests now complete as soon as their
    requested build finishes, instead of waiting for unrelated concurrent RPC build
    requests in the same build iteration. (#15191, fixes #13788, @rgrinberg)

  • Cleanup all build processes spawned by dune before starting a fresh build on
    Linux. (#15239, #15274, @rgrinberg)

  • Show partial output timed out cram tests (#15269, @rgrinberg)

  • In watch mode, $ dune rpc build now exits with status 1 when the
    requested build fails. (#15341, @rgrinberg)

  • Debounce file change events in watch mode (#15344, @rgrinberg)

  • Align dune's C compiler vendor detection with the OCaml compiler's own
    identifiers (msvc, icc, mingw, clang, gcc, xlc, sunc), so more C
    compilers are recognized without emitting a spurious warning. (#15423,
    fixes #14870, @chizy7)

  • Never use $ lsof for counting file descriptors, as it is not allowed
    to reap processes outside of the scheduler. We have better mechanisms
    on MacOS and Linux for counting file descriptors. So this is only an
    issue on other Unices. (#15477, @rgrinberg)

  • dune describe workspace now reports an origin field for every module,
    indicating whether its source was written by hand (source), generated by a
    rule stanza (dune, with the generating dune file), produced by ocamllex,
    ocamlyacc, or menhir, or synthesised by dune itself for wrapping
    (wrapper). Generated modules point at the responsible file. The
    --with-origin-deps and --with-origin-deps-expanded flags additionally
    report the dependencies of a rule-generated module, as declared and expanded
    to concrete files respectively.
    (#15478, @nat-karmios)

  • Numbers with unit now allow dropping the unit if the number is zero ("0").
    For example, dune cache trim --trimmed-size 0 and dune cache trim --trimmed-size 0TiB are now both accepted and equivalent. (#15498, @reynir)

  • Run artifact substitution in background workers. (#15559, @anmonteiro)

  • dune describe now reports the public name of an executable (from
    public_name/public_names) instead of its private name when one is
    available, falling back to the private name otherwise. (#15582, @NatKarmios)

  • Calculate status-line build parallelism from process CPU time rather than
    wall-clock action time; Windows continues to use wall-clock time.
    (#15685, @rgrinberg)

  • Use sha256 instead of md5 for source archives that lack a checksum
    (#15824, @shunueda)

  • Starting with Dune language 3.25, restrict sandboxed actions on Linux
    systems with Landlock ABI 3 or newer from writing outside their sandbox,
    temporary directory, action-trace directory, and /dev. Set
    DUNE_CONFIG__LANDLOCK=disabled to opt out. (#15858, @rgrinberg)

  • dune pkg lock now fails without writing a lock directory when any platform
    requested by solve_for_platforms cannot be solved, instead of producing a
    partial lock directory containing only the successful platforms. (#15981,
    @Alizter)

  • Portable lock directories now select one package version across all requested
    platforms, and fail when no common version exists. (#15982, fixes #13645,
    fixes #13647, @Alizter)

  • BREAKING CHANGE: Reject : in context names so they remain portable path
    components (#16085, @rgrinberg)

  • Keep .t suffixes in cram test names, including aliases and applies_to,
    starting with Dune language 3.25 (#16146, @rgrinberg)

  • Sandbox ocaml-mdx dune-gen when using MDX extension 0.6, available from
    Dune 3.25. (#16177, @rgrinberg)

  • Sandbox pkg-config queries starting with Dune language 3.25 so they cannot
    observe undeclared workspace inputs. (#16178, @rgrinberg)

  • Remove the experimental OCamlFDO integration, including the (fdo ...)
    workspace field (#16198, @rgrinberg)

  • BREAKING CHANGE: Generated files are now read-only even with Dune language
    versions before 2.4, regardless of whether the shared cache is enabled.
    Executable permissions are preserved. (#16388, @rgrinberg)

  • Make newly written shared-cache metadata files read-only to guard against
    accidental modification. (#16393, @rgrinberg)

Dune 3.24.2

CHANGES:

Fixed

  • Add the implicit unix dependency required by MDX 2.6 and later to
    generated MDX test executables (#15592, @avsm)

  • Rescan the RPC registry when its directory mtime changes, allowing clients
    that poll before Dune registers to discover the new instance (#15634, fixes
    #15630, @rgrinberg)

Dune 3.24.1

The Dune team is pleased to announce the release of dune 3.24.1.

This patch release includes bug fixes and a change to Melange sandboxing defaults. See the full changelog for all the changes and for attribution to the contributors who made it all possible. Thank you, contributors!

If you encounter a problem with this release, please report it in our issue tracker.

See full changelog

Fixed

  • Fix an internal error (modules_and_obj_dir: failed lookup) when generating js_of_ocaml archive rules for a dune file that defines two libraries with the same name distinguished by mutually exclusive enabled_if clauses, as ocaml-re does for ppx_expect_common (#14904, fixes #14775, @vouillon)
  • Fix passing environment variables to formatter actions (#15386, @anmonteiro)
  • Fix missing source dependency in the sandbox when preprocessing Melange sources (#15395, @anmonteiro)
  • Treat OCaml compiler packages version 5.5 or newer as relocatable so their installations do not use the toolchain cache (#15444, fixes #15443, @Alizter)
  • Fix build_runtime_flags given in a js_of_ocaml/wasm_of_ocaml field of an executable being silently ignored in separate compilation mode: such executables were given the workspace-shared standalone runtime, which is built with the default flags. Executables customizing build_runtime_flags now get their own standalone runtime again. (#15455, @hhugo)
  • Use installed filenames for local package binaries in %{bin:...} PATH layouts on Windows (#15518, fixes #15512, @Alizter)

Changed

  • Revert sandboxing Melange rules by default in the (library ..) and (melange.emit ..) stanzas. In Melange libraries with many modules, sandbox creation / destruction dominates build time and adds significant overhead to build time (#15418, @anmonteiro)

Dune 3.24.0

The Dune team is pleased to announce the release of dune 3.24.0.

Highlights include the following

  • Dune package management now uses the relocatable compiler by default, for all supported compiler versions. This brings a massive speedup to workspace setup in the many cases where built compiler versions can be reused. (ocaml/dune#14357, @Alizter)
  • Directory targets are now generally available (ocaml/dune#14579), allowing tools to produce entire directory trees as targets. See the documentation on directory targets for details.
  • Path handling has been refined, improving the consistency of paths across platforms (ocaml/dune#14278 and ocaml/dune#14278) and using a more consistent and disciplined location for %{bin:NAME} variable expansions (ocaml/dune#14432).
  • Path-valued percent forms (%{bin:...}, %{dep:...}, %{path:...}, and friends) now expand same-directory paths with a leading ./, so that shells like bash in (bash ...) and (system ...) actions execute them directly instead of looking them up in PATH (ocaml/dune#15156). This is a breaking change for configurations that were handling paths naively, and neglected to normalize the representation before using it test fixtures or for constructing other strings.
  • The deprecated lang coq has been removed, as scheduled, superseded by lang rocq. See ocaml/dune#12788 for details.

See the full changelog for all new features and fixes, and for attribution to the contributors who made it all possible. Thank you, contributors!

If you encounter a problem with this release, please report it in our issue tracker.

See full changelog

Fixed

  • Fix promotion failure when a target changes from a directory to a file between builds, causing "Is a directory" errors. (#14371, fixes #5647, fixes #6575, @Alizter)
  • Make dune build @doc pick up an odoc installed via dune tools install odoc even without DUNE_CONFIG__LOCK_DEV_TOOL=enabled, mirroring how dune fmt consumes a locked ocamlformat (#14426, fixes #14235, @mt-caret)
  • Reject (package ...) inside a named dependency binding ((deps (:name (package foo)))). Previously this was silently accepted but %{name} would resolve to an empty path list. (#14499, @Alizter)
  • Fix incorrect dependency in the .cmxs build for libraries with mode-dependent foreign stubs: the rule depended on the byte stubs archive instead of the native one, so parallel builds could fail to find -l<lib>_stubs_native. (#14500, fixes #12964, @Alizter)
  • Fix dune build failing with "No rule found" when lock_dir paths in dune-workspace contain a subdirectory (e.g. (path sub/dune.lock)). (#14524, fixes #14523, @Alizter)
  • Artifact substitution repairs executable bit if it's not set correctly in the workspace (#14556, @rgrinberg)
  • Ignore EINVAL when accepting sockets on MacOS (#14612, fixes #12660, @rgrinberg)
  • Validate profile names. Profile names must be non-empty and can only contain letters, digits, _ and -. The name _ is reserved as a wildcard in (env ...) stanzas. (#14657, fixes #14630, @rlepigre)

Added

  • Add %{pkg:<package>:<section>:<path>} pform for resolving package install files. Works with workspace packages, lock-file packages, and installed packages. (#14200, fixes #14193, fixes #3378, @Alizter)
  • Enable the relocatable compiler by default for package management (#14357, fixes #14012, @Alizter)
  • Add changed source files to the build-start trace event for watch-mode restarts, showing the paths that triggered the rebuild (#14396, @rgrinberg)
  • Add dune's rusage information in start/finish build trace events (#14402, @rgrinberg)
  • Add a status message for RPC clients that manage to connect (#14424, @rgrinberg)
  • Allow blang expressions in the runtest_alias field in the cram stanza (#14425, @rgrinberg)
  • Extend the stat based cache to cache the contents of directories and not just source files (#14469, @rgrinberg).
  • Show the number of connected RPC clients in the watch mode status line (#14489, @rgrinberg)
  • Promote directory targets from experimental to generally available in 3.24 (#14579, @rgrinberg)

Changed

  • Use / as directory separator when appending local paths to external paths, making path construction consistent across platforms. (#14278, @Alizter)
  • On Windows, normalise process paths to \ before passing them to CreateProcessW so that programs which scan argv[0] (notably cmd.exe) do not misparse mixed separators. (#14278, @Alizter)
  • %{bin:NAME} now resolves to the build artifact path rather than the install staging path. Rules with %{bin:NAME} deps additionally get a per-rule .binaries directory prepended to the action's PATH, containing correctly-named symlinks for each declared bin pform dep. (#14432, fixes #3324, @Alizter)
  • Replace the Rocq language field (stdlib ...) with the presence-only field (no_corelib) in Rocq language 0.14. (#14452, fixes #14358, @Durbatuluk1701)
  • Throttle sandbox creation to 250 concurrent sandboxes. (#14464, @rgrinberg)
  • The package solver now uses cached revision store lookups for improved performance. (#14494, fixes #12637, @Alizter, @rgrinberg)
  • Remove the deprecated (lang coq) Coq Build Language. Use the Rocq Build Language ((using rocq <version>)) instead. Projects that still declare (using coq <version>) now get an error pointing them at Rocq. (#14525, fixes #12788, @Alizter)
  • Path-valued pforms (%{bin:...}, %{dep:...}, %{path:...}, and friends) now expand same-directory paths with a leading ./, so that shells like bash in (bash ...) and (system ...) actions execute them directly instead of looking them up in PATH. (#15156, fixes #15147, @Alizter)

Dune 3.23.1

The Dune team is pleased to announce the release of dune 3.23.1.

This is a patch release consisting of bug fixes. See the full changelog for all the changes and for attribution to the contributors who made it all possible. Thank you, contributors!

If you encounter a problem with this release, please report it in our issue tracker.

See full changelog

Fixed

  • Fix the menhir opam dependency injection introduced in 3.23. Dune now only fills in the lower bound {>= "20180523"} on an existing user-declared menhir dependency; it no longer adds menhir as a new dependency to packages that did not declare it themselves. (#14434, fixes #14428, @robinbb)
  • Gate the dune version-bound deduplication in generated opam files (introduced in 3.23) on (lang dune 3.23). Projects at earlier lang versions get the prior And [...] shape β€” e.g. {>= "3.17" & >= "3.20"} β€” restoring 3.22 behaviour and avoiding a silent change to opam output on dune-binary upgrade. (#14436, @robinbb)
  • Preserve library order when building a shared jsoo standalone runtime. (#14438, @vouillon)
  • Fix the fallback to the secondary compiler, allowing recovering of support for packages with upper bounds on OCaml less than 4.14. Packages depending on dune 3.23.1 or later and with an upper bound on the OCaml compiler that is less than 4.14, will now be able to use the latest dune, but dune will be built with the secondary compiler at version 4.14. (#14443, @Alizter)
  • Fix the bootstrap on NetBSD by including <sys/wait.h> in lev_stubs.c, matching the existing FreeBSD/OpenBSD guard. (#14512, fixes #14484, @0-wiz-0)

Dune 3.23.0

The Dune team is pleased to announce the release of dune 3.23.0.

Along with many other fixes and improvements, some highlights include:

  • Add support for c_library_flags in foreign_stubs (#13484, @madroach)
  • Many improvements to the promotion and diffing functionality, by @rgrinberg.
  • As part of the previous, a breaking change to the promotion logic has been introduced: Dune does not automatically promote generated opam files, which must now be manually promoted with dune promote. You can trigger building .opam files with the @install, @runtest, and @opam aliases. In release mode, .opam files aren't generated at all and whatever is in the source is used (ocaml/dune#14108, @rgrinberg).
  • User rules and inline test runners are now sandboxed by default (ocaml/dune#13805 and ocaml/dune#14257, @rgrinberg).
  • The minimum OCaml version required to build dune is now 4.14.

See the full changelog for all new features and fixes, and for attribution to the contributors who made it all possible. Thank you, contributors!

If you encounter a problem with this release, please report it in our issue tracker.

See full changelog

Fixed

  • Auto-inject "menhir" {>= "20180523"} into generated opam files when the menhir extension is used. Dune's menhir rules rely on --infer-write-query and --infer-read-reply, which require at least this version; without the lower bound, builds fail with older menhir installations. (#10707, @robinbb)
  • Fix --display=quiet not suppressing "Entering directory" and "Leaving directory" messages when using --root. These messages are now deferred until there is actual output, so silent builds produce no noise. (#12974, fixes #12854, @Alizter)
  • Fix an internal error when a module is shared between a rocq.theory and rocq.extraction stanza. The error now includes a hint pointing to the conflicting stanza. (#13733, @Durbatuluk1701)
  • Fix cookies defined on ppx_rewriter being lost when that rewriter was used as a dependency of another ppx_rewriter. (#13737, fixes #3426, @Alizter)
  • Improve opam file generation for packages that set (dir ..). Such packages will now have a test target that is limited to this directory. (#13778, @rgrinberg)
  • Stop duplicating dune diagnostics to subscribers over RPC (#13816, @rgrinberg)
  • Fix dependency cycle when using the package with a library conditionally enabled via enabled_if. (#13833, @toots)
  • Fix underspecification of dependencies in the sandbox for modules with interfaces. (#13842, @anmonteiro)
  • Honor sandbox settings specified inside (:include ..) expressions in the deps field (#13898, @rgrinberg)
  • Fix dune pkg lock failing when a pin stanza contains a file:// URL with a relative path outside the workspace (#13915, fixes #10254, @shunueda)
  • Use all stat attributes to detect patch back source tree changes (#13986, @rgrinberg)
  • Use device and inode number for invalidating cached digests (#13991, @rgrinberg)
  • Stop trying to set SO_REUSEADDR on unix sockets when setting up dune rpc (#14056, @rgrinberg)
  • Fix autolocking to correctly detect changes to (depends) in watch mode (#14066, fixes #13234, @Alizter)
  • Fix incremental builds for libraries using (wrapped (transition ...)). The compat shim modules were never recompiled when the inner module's interface changed, causing "inconsistent assumptions" errors. (#14090, fixes #14089, @Alizter)
  • Fix Rocq configuration detection to use rocq c --config subcommand instead of rocq --config (#14093, fixes #13774, @Durbatuluk1701)
  • Bump dune rpc's request pending request limit 10 to 100 (#14094, @rginberg)
  • Invalidate stale cached digests in all build commands (#14126, @rgrinberg)
  • Fix root_module generating duplicate module definitions when a findlib sub-package shares a directory with its parent (e.g., logs.lwt alongside logs). (#14135, fixes #6148, @robinbb)
  • Fix dune subst prepending a duplicate version: field to opam files that already contain one, instead of replacing it in place. (#14136, fixes #878, @robinbb)
  • Fix @ocaml-index alias being generated for all contexts, causing build errors in multi-context workspaces where some libraries are disabled in non-default contexts. The alias is now only generated for the merlin context. (#14137, fixes #12007, @robinbb)
  • Remove the warning about the deprecation of the coq stanza for dune lang before 3.21 since it has been introduced in this version (#14187, @bobot)
  • $ dune init now generates projects with correct .opam files (#14192, @rgrinberg)
  • Send SIGTERM before SIGKILL when cancelling child processes in watch mode, giving cleanup handlers a chance to run before escalating. (#14224, #14170, fixes #2445, @robinbb)
  • Correctly specify dependencies for generate_runner in inline tests (#14276, @rgrinberg)
  • Fix duplicate dune version bounds in generated opam files. When users declare (dune (>= X.Y)) matching or exceeding the (lang dune X.Y) version, the generated opam depends no longer contains redundant constraints like {>= "2.7" & >= "2.7"}. (#3916, #11106, @robinbb)
  • Fix inline tests not being executed for byte-only libraries. When a library has (modes byte), the inline test runner is now linked in byte mode so the library's test code is included. (#9757, @robinbb)

Added

  • Add support for c_library_flags in foreign_stubs (#13484, @madroach)
  • Move the management of Jsoo config details out of dune (#13613, @vouillon)
  • Js_of_ocaml: share standalone runtimes (#13621, @vouillon)
  • Allow multiple (dirs ..) stanzas in the same Dune file. Starting with (lang dune 3.23), Dune takes the union of the specified directories (#13734, fixes #6249, @anmonteiro)
  • Sandboxed rules are now allowed to produce diff promotions when (corrections produce) is set on the rules. Whenever such an action produces foo.corrected, it will be automatically registered as a promotion for foo (#13813, @rgrinberg)
  • $ dune clean now accepts arguments to only remove certain targets from the _build directory (#13875, @rgrinberg)
  • $ dune promote now promotes all paths that are a prefix of the path provided. For example, $ dune promote foo will promote foo, foo/bar, foo/bar/baz (but not foobar). (#13876, @rgrinberg)
  • Allow for the diff action to diff entire directories (#13880, fixes #3567, @rgrinberg)
  • A hint is now emitted when trying to build a target inside a directory that was excluded by a (dirs ...) stanza (#13919, @mefyl).
  • Add --debug-backtraces to $ dune {promote,trace,cache} (#13933, @rgrinberg)
  • Actions are now able to observe their project directory via DUNE_PROJECT_ROOT (#13934, @rgrinberg)
  • Support hardlink sandboxing on Windows. (#13987, addresses part of #4362, @Alizter)
  • rocq.extraction: Add extracted_files field in (rocq 0.13), replacing extracted_modules, supporting extraction to languages other than OCaml (#13997, @Durbatuluk1701).
  • Infer source directories as dependencies when they're as reference directories in diff actions.
  • Add trace events for build start/stop/restarts (#14163, #14166, @rgrinberg)
  • Generate compile_commands.json for C/C++ foreign stubs when building @check with (lang dune 3.23). This enables clangd, ccls, and other tools that consume compilation databases. (#14185, fixes #3531, @Alizter)
  • Add trace events for accepting clients and shutting down RPC (#14232, @rgrinberg)
  • Back up the default trace file as trace.csexp.old before each build, preserving the previous trace for comparison. This does not apply when --trace-file is used. (#14269, @Alizter)

Changed

  • Dune digests target files and directories in background threads (#13341, @rgrinbreg)
  • Dyn.pp now prints valid OCaml literals for more constructors:
    • Char is quoted (e.g., 'a')
    • Int32/Int64/Nativeint include literal suffixes (l/L/n)
    • Float handles infinity, neg_infinity, and nan (#13394, grants #13378, @Alizter)
  • Bump the minimal OCaml version required to build Dune from 4.08 to 4.14. (#13533, @Alizter)
  • Starting from 3.23, user rules are sandboxed by default (#13805, @rgrinberg)
  • Dune will no longer stat paths in the _build directory. This was done as protection from user rules accidentally touching things in the _build directory. This is forbidden, and dune offers rule sandboxing to prevent this (#13875, @rgrinberg)
  • Improve mtime precision by no longer approximating them with floats (#13962, @rgrinberg).
  • Remove --makefile (or -m) in $ dune rules. The sexp output is the only supported way of reflecting dune rules (#14069, @rgrinberg)
  • Do not automatically promote files. Now, opam files must be manually promoted with $ dune promote. Their generation is triggered by @install, @runtest, and @opam. In release mode, .opam files aren't generated at all and whatever is in the source is used (#14108, @rgrinberg)
  • Inline test runner generation is now sandboxed (#14257, @rgrinberg)

Dune 3.22.2

The Dune team is pleased to announce the release of dune 3.22.2.

This is a patch release consisting of bug fixes. See the full changelog for all the changes and for attribution to the contributors who made it all possible. Thank you, contributors!

If you encounter a problem with this release, please report it in our issue tracker.

See full changelog

Fixed

  • Revert the change in behavior of --diff-command back to 3.21. Non-existent files are now passed to this command instead of being replaced with /dev/null (#14098, fixes 13891, @rgrinberg)

Dune 3.22.1

The Dune team is pleased to announce the release of dune 3.22.1.

This is a patch release consisting of bug fixes. See the full changelog for all the changes and for attribution to the contributors who made it all possible. Thank you, contributors!

If you encounter a problem with this release, please report it in our issue tracker.

See full changelog

Fixed

  • Restore compatibility with Windows 7 (#13905, @nojb)

  • dune test now runs tests in the default context only. When there is a single context, it is treated as the default. This fixes a crash when the workspace has no context named "default". (#13930, fixes #13904, @Alizter)

  • Fix dune trace cat --chrome-trace to adhere to the Chrome Trace Event Format by providing timestamps and durations at microsecond granularity (#13911, fixes #13906, @Alizter)

Dune 3.22.0

The Dune team is pleased to announce the release of dune 3.22.0.

In addition to many fixes and small improvements, notable highlights of this release include:

  • Fixes to the dune cache on Windows, thanks to @Nevor in ocaml/dune#13713.
  • New tracing functionality, to inspect and diagnose the build processes thanks to @rgrinberg across many PRs. See the documentation.
  • Addition of the dune-action-trace library, to instrument trace emission, thanks to @rgrinberg.
  • Support for generating odoc documentation in markdown via the @doc-markdown build alias thanks to @davesnx ocaml/dune#12581.
  • Full support for OxCaml's parameterised libraries, thanks to @art-w and @maiste. To learn more, see the docs.

See the full changelog for all new features and fixes, and for attribution to the contributors who made it all possible. Thank you, contributors!

If you encounter a problem with this release, please report it in our issue tracker.

You can comment on this announcement on the OCaml discuss forums.

See full changelog

Fixed

  • Dyn.to_string now uses a smarter way to convert floats. This ensures that floats are printed with enough precision to round-trip and are valid OCaml lexemes. (#12982, fixes #12980, @Alizter)

  • Fix dune install --prefix failing with relative paths outside the workspace like ../foo (#12993, fixes #12241, @benodiwal)

  • Place the default trace file inside the build directory at the workspace root, rather than relative to the current directory. (#13735, @vouillon)

  • Fixed interpreting relative paths in %{bin:..} and %{bin-available:..}. These are now interpreted correctly, relative to the dune file they're in. (#13712, fixes #9564, @anmonteiro)

  • Delete sandboxes with broken permissions (#13511, @rgrinberg)

  • Fix compiling Menhir parsers that refer to sibling modules within a subdirectory of (include_subdirs qualified). (#13118, fixes #11119, @anmonteiro)

  • Fixed the dependency specification of C stubs, which could result in C stubs not getting rebuilt when needed (which could in turn lead to segmentation faults and other hard-to-track bugs). (#13652, fixes #13651, @nojb)

  • Fix the Dune cache on Windows by correctly handling renames onto read-only files. Before this change, the Dune cache would be filled but the stored artifacts would not generally be usable by Dune. (#13713, @Nevor)

  • Fix rpc not transferring promotion warnings to the client (#12604, fixes #12578, @ElectreAAS)

  • Fix issue where dune exec -w was unable to kill running programs on rebuild. (#12360, fixes #12323, @Alizter)

  • Resolve context and workspace binaries introduced by the respective (env (binaries ..)) stanzas. (#12952, fixes #6220, @anmonteiro)

  • Fix diff promotions originating from sandboxed rules. Previously, they would be completely ignored as the sandbox with the promoted file would be destroyed if the promotion fired (#13520, @rgrinberg)

  • Fix failure to digest installed directory targets, allowing them to be used as dependencies to other rules. (#13045, @anmonteiro)

  • Fix handling of (select ..) field when used with (include_subdirs ..). (select <path> from ..) modules now parse path as a relative path starting from the module group root (#13175, fixes #4383, #12450, @anmonteiro)

  • Fix dune trying to kill processes that were already reaped due to race conditions (#13245, @rgrinberg)

  • Add O_CLOEXEC to all files used for stdin/stdout/stderr (#13385, @rgrinberg)

  • Fix $ dune promote dir/foo when dir does not exist (#13493, @rgrinberg)

  • Fix (select ..) field evaluation when a transitive library has optional dependencies (fixes #13299, #13389, @anmonteiro)

  • Fix sandboxed builds of library stanzas that set (stdlib (modules_before_stdlib ..)) (#13624, @anmonteiro)

  • Dune cache: use of hard links under Windows. (#13714, @Nevor)

  • Fixed non-build caches not following $DUNE_CACHE_ROOT and instead only relying on $XDG_CACHE_HOME. This means the normal build cache moves: $DUNE_CACHE_ROOT -> $DUNE_CACHE_ROOT/db (no changes if that variable was unset). Affected users can prevent a full cache invalidation by moving previous contents: cd $DUNE_CACHE_ROOT; mkdir db; mv <contents of directory> db. (#11612, fixes #11584, @ElectreAAS)

  • $ dune promotion list writes output to stdout rather than stderr (#13462)

  • Improve handling of empty files in the diff action. These are now correctly distinguished from empty files. (#13696, @rgrinberg)

  • Pass /dev/null to --diff-command instead of non-existent files (#13696, @rgrinberg)

  • Fix failure when multiple rocq.extraction stanzas existing in a directory (#13531, fixes #8042, @rlepigre-skylabs-ai)

  • Print $ dune promotion show output to stdout rather than stderr (#13481, @rgrinberg)

  • Fix deadlock in the memo library in the presence of dependency cycles (#13625, @anmonteiro)

  • Fix promotions that modify a directory into a file (#13516, fixes #4067, @rgrinberg)

  • Fix installation of implementations of virtual libraries. This failed when the implementation had no private modules, but the virtual library did (#10635, @rgrinberg)

  • Respect the (dir ..) field on packages when setting up cram tests (#13581, @rgrinberg)

Added

  • Add support for generating .cms files using oxcaml and adding .cms or .cmt files as compilation dependencies (#13397, @spiessimon)

  • Add trace events for custom actions (#13265, @rgrinberg)

  • Allow enabling extensions with (using ..) in dune-workspace files (#13395, @spiessimon)

  • Add sandbox extraction trace event (#13544, @rgrinberg)

  • Add the initial cwd to the first config event (#13026, @rgrinberg)

  • Dune dune produces trace events in DUNE_ACTION_TRACE_DIR if this variable is set. (#13302, @rgrinberg)

  • Add file watching events to the trace file (#13038, @rgrinberg)

  • Introduce the $ dune trace cat subcommand to view the trace file. (#13055, @rgrinberg)

  • Add diagnostic events to the trace. (#13041, @rgrinberg)

  • Add DUNE_JOBS environment variable for controlling concurrency of Dune from environment. The INSIDE_DUNE variable also now no longer controls concurrency (#12800, @Alizter)

  • Support for Rocq expected output tests (#13632, @rlepigre-skylabs-ai)

  • Add rusage information to completed processes in the trace (@rgrinberg, #13241)

  • Add process start events to the trace (#13261, rgrinberg)

  • Generate odoc documentation in markdown using the @doc-markdown alias (#12581, @davesnx)

  • Add timing information for every command executed by cram (#13092, @rgrinberg)

  • Add the workspace root to the config trace event (#12922, @rgrinberg)

  • Introduce the dune-action-trace library. This public library is to be used by custom actions to emit trace events while executed as part of a dune build. The trace events emitted through this library will be incorporated into dune's own trace (#13348, @rgrinberg)

  • Add dune-find-dominating to dune.el, a command to find the dominating dune file. (#12696, @arvidj)

  • Add a --no-recursive flag to $ dune describe workspace (#13590, @rgrinberg)

  • Trace events for files written directly by dune (#13618, @rgrinberg)

  • Allow expansion of special forms like (:include ..) and %{read-lines:..} in the modules specification for the ocamllex, ocamlyacc and menhir stanzas. (#13105, #13135, #13157, @anmonteiro)

  • Add a trace event for snapshotting the sandbox (#13541, @rgrinberg)

  • Add signal send and receive events to the trace (#13193, @rgrinberg)

  • Emit final trace event before exiting. (#13018, @rgrinberg)

  • dune runtest can now run individual test executables from (tests) stanzas and inline tests from (library (inline_tests)) stanzas by providing their source files as arguments. (#13064, fixes #870, @Alizter)

  • Add a shell field to the cram stanza. This field allows customizing the shell to be bash rather than sh (#13083, @haochenx)

Changed

  • Start sandboxing the execution of tests defined with the test and tests stanzas (#13510, #13617, @rgrinberg)

  • Disabled cram tests can now be run explicitly with dune runtest disabled.t. The enabled_if field now only controls whether a test is included in the @runtest alias. (#13081, @Alizter)

  • Process categories in trace events are moved to their own field in args (#13024, @rgrinberg)

  • Sandbox running ocamllex and ocamlyacc actions. (#13098, @anmonteiro)

  • Sandboxing mdx test actions is now the default starting from 0.5 (#13504, @rgrinberg)

  • Start sandboxing Melange rules by default in the (library ..) and (melange.emit ..) stanzas (#13619, @anmonteiro)

  • Introduce a promotion trace event and remove the corresponding verbose log message. (#12949, #13444, @rgrinberg)

  • Change dune's trace format to emit canonical s-expressions. This improves performance and is better aligned with dune's usage of the format elsewhere. $ dune trace cat can also emit the trace in --chrome-trace for perfetto, or --sexp for regular s-expressions for interactive usage. (#13059, @rgrinberg)

  • Move all logging statements to the trace file. All log statements now contain structured payloads (#13015, fixes #12904, @rgrinberg)

  • Add a target resolution event to replace the equivalent log message (#12955, @rgrinberg)

Dune 3.21.1

The Dune team announces the release of dune 3.21.1.

This is a small patch release consisting of a few bug fixes. See the full changelog for all the changes.

If you encounter a problem with this release, please report it in our issue tracker. You can also leave comments on the discuss announcement.

See full changelog

Fixed

  • Fix build issues on NetBSD and OpenBSD via update of vendored ocaml-lmdb (#13074, @Alizter)
  • Fix melange.emit not respecting the package mask via -p <PKG> (#13522, @anmonteiro)

Changed

  • Stop starting RPC server with $ dune promote (#13428, @rgrinberg)

Dune 3.21.0

The Dune team is pleased to announce the release of dune 3.21.0.

This is a large release, including dozens of fixes, improvements, and additions, thanks to many contributors. See the full changelog for all changes and contributors.

If you encounter a problem with this release, please report it in our issue tracker.

See full changelog

Fixed

  • Fix include_subdirs qualified incorrectly picking the furthest module instead of the closest when resolving module name ambiguities. (#12587, @ElectreAAS and @Alizter)

  • Fix: include the module alias in the transitive dependency closure with (include_subdirs qualified). (#12299, @anmonteiro)

  • Improve error messages for invalid version formats containing non-ASCII characters. Previously, non-ASCII characters in version strings (e.g., (lang dune Γ¨) or (using menhir Ο€3.14)) would fail with a generic "Invalid file" error. Now they display a clear message: "Invalid atom: contains non-ASCII character(s). Atoms must only contain ASCII characters." The fix is implemented at the lexer level, providing consistent error handling across all s-expression parsing. (#12844, fixes #12836, @benodiwal)

  • Pass private modules with -H when this is available (#12666, @rgrinberg)

  • Allow multiple modules in (modules_flags ...), in coq.theory (#12733, @rlepigre)

  • Improve error message for invalid version formats in both (lang dune ...) and (using extension ...) declarations. Changes "Atom of the form NNN.NNN expected" to "Invalid version. Version must be two numbers separated by a dot." (#12833, @benodiwal)

  • Fix crash when running dune build @check on a library with virtual modules. (#12644, fixes #12636, @Alizter)

  • Provide a more informative error message when (pkg enabled) is put in dune-project instead of dune-workspace. (#12802, fixes #12801, @benodiwal)

  • Improve error message when invalid version strings are used in dune-project files. Non-ASCII characters and malformed versions now show a helpful hint with an example of the correct format. (#12794, fixes #12751, @benodiwal)

  • Stop hiding the root_module from the include path (#12239, @rgrinberg)

  • Allow $ dune init to work on absolute paths (#12601, fixes #7806, @rgrinberg)

  • (include_subdirs qualified): Add missing alias dependency to module group. (#12530, @anmonteiro)

  • Add Melange compilation to the @all alias in libraries (#12628, @anmonteiro)

  • Fix greedy version location in lang declarations. Previously, error locations for invalid lang versions would span multiple bytes for multi-byte UTF-8 characters, causing carets to appear misaligned and seemingly include the closing parenthesis. Now, error locations for ASCII strings show the full length (e.g., "Ali" shows ^^^), while non-ASCII strings show only the first byte (e.g., "Γ¨" shows ^) to avoid multi-byte character display issues. (#12869, fixes #12806, @benodiwal)

  • melange support: don't emit empty JavaScript modules for generated module aliases. (#12464, @anmonteiro)

Added

  • (Experimental): Introduce the library_parameter stanza. It allows users to declare a parameter when using the OxCaml compiler. (#11963, implements #12084, @maiste)
  • Added the ability to scroll horizontally in TUI. (#12386, @Alizter)
  • Feature: Include shell command that was executed when a cram test has occurred in the error message (#12307, @rgrinberg)
  • support expanding variables in (promote (into ..)) (#12832, fixes #12742, @anmonteiro)
  • Add support for %{cmt:...} and %{cmti:...} variables to reference compiled annotation files (.cmt and .cmti) containing typed abstract syntax trees with location and type information. (#12634, grants #12633, @Alizter)
  • Add $ dune describe tests to describe the tests in the workspace (@Gromototo, #12545, fixes #12030)
  • Add argv, the process environment, and the dune version to the config event in the trace (#12909, @rgrinberg)
  • Allow dune runtest to properly run while a watch mode server is running. (#12473, grants #8114, @gridbugs and @ElectreAAS)
  • Use copy-on-write (COW) when copying files on filesystems that support it (Btrfs, ZFS, XFS, etc), under Linux. (#12074, fixes #12071, @nojb)
  • Add support for Tangled ATproto-based code repositories (#12197, @avsm)
  • Add support for instantiating OxCaml parameterised libraries. (#12561, @art-w)
  • Add a (conflict_markers error|ignore) option to the cram stanza. When (conflict_markers error) is set, the cram test will fail in the presence of conflict markers. Git, diff3 and jujutsu conflict markers are detected. (#12538, #12617, #12655, fixes #12512, @rgrinberg, @Alizter)
  • Introduce a %{ppx:lib1+..+libn} stanza to make it possible to refer to ppx executables built by dune. This is useful for writing tests (#12711, @rgrinberg)
  • Introduce a (dir ..) field on packages defined in the dune-project. This field allows to associate a directory with a particular package. This makes dune automatically filter out all stanzas in this directory and its descendants with --only-packages. All users are recommended to switch to using this field. (#12614, fixes #3255, @rgrinberg)
  • Add support for DUNE_ROOT environment variable, similar to the existing --root CLI parameter. (fixes #12399 @sir4ur0n)
  • Introduce an unused-libs alias to detect unused libraries. (#12623, fixes #650, @rgrinberg)
  • Add --files flag to dune describe opam-files to print only the names of the opam files line by line. (#9793, @reynir and @Alizter)
  • dune exec now accepts absolute paths inside the workspace. (#12094, @Alizter)
  • Add coqdoc_header and coqdoc_footer fields to the coq field of the env stanza, and to the coq.theory stanza, allowing to configure a custom header or footer respectively in the HTML output of coqdoc. (#11131, @rlepigre)
  • Allow dune fmt to properly run while a watch mode server is running. Note that the --preview flag is not supported in this mode. (#12064, @ElectreAAS)
  • Support for generating _CoqProject files for coq.theory stanzas. (#11752, @rlepigre)
  • Added (files) stanza, similar to (dirs) to control which files are visible to Dune on a per-directory basis. (#12879, @nojb)
  • Add support for %{ocaml-config:ox} (#12236, @jonludlam)
  • Introduce dune promotion show command to display the contents of corrected files that are ready for promotion. This allows users to preview changes before running dune promote. The command accepts file arguments to show specific files, or displays all promotable files when called without arguments. (#12669, fixes #3883, @MixiMaxiMouse)
  • New (lang rocq) build mode for Rocq 9.0 and later. This new mode is very similar to the existing (lang coq), except that it doesn't need the coq* compatibility wrappers. As of today (lang rocq) doesn't support yet composed builds with Rocq itself, this will be added later. (lang coq) is deprecated, development is frozen, and will be removed at some point in the future. (#12035, @ejgallego, @lysxia, fixes #11572)

Changed

  • Don't run ocamldep to compute false dependencies on the root_module (#12227, @rgrinberg)
  • dune format-dune-file now uses the syntax version of the Dune project that contains the file being formatted (if any) instead of using the latest version available, which remains the default if there is no Dune project in scope. (#11865, @nojb)
  • Persistent DB and process events have been slightly modified. Persistent DB events have more concise names and job events always include full information. (#12867, @rgrinberg)
  • Removed the --trace-extended flag. Its functionality is always enabled when tracing is active (#12908, @rgrinberg)
  • The test/dune file generated by dune init proj now depends on the project library. (#12791, @shonfeder)
  • Starting with version 3.21 of the Dune language, Dune no longer changes the default set of compiler warnings. For users that would like to keep the old behaviour, the variable %{dune-warnings} can be used in an (env) stanza in a top-level Dune file: (env (dev (flags :standard %{dune-warnings}))). (#12766, @nojb)
  • Fix: stop generating cmt files for cinaps binaries (#12530, @rgrinberg)

Dune 3.20.2

The Dune Team is happy to announce the release of Dune 3.20.2.

This release introduces some minor fixes and restores the build on Cygwin.

See full changelog

Fixed

  • Fix jsoo separate compilation with modules_without_implementation. Regression introduced in #10767. (#12320, fixes #12306 @hhugo)

  • Fix runtest-js mistakenly using wrong dependencies (#12324, @vouillon)

  • Remove empty .cram.test.t directory during the running of a cram test. (#12329, fixes #12321, @Alizter)

  • Fix Cygwin bootstrap (#12325, fixes #12316, @Alizter)

Dune 3.20.1

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.

See full 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)

Dune 3.20.0

The Dune Team is happy 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.

See full 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 #11956, 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 (#12043, 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 (#10892, 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 (#11987, fixes #11986, @anmonteiro)

Dune 3.19.1

The Dune Team is happy to announce the release of Dune 3.19.1.

This patch release contains a fix reverting some regressions on how dune exec handles processes. It restores the previous behaviour.

See full changelog

Fixed

  • Revert changes in dune exec behaviour introduced in 3.19.0. (#11879, fixes #11870, #11867 and #11881, @Alizter)

Dune 3.19.0

The Dune Team is happy to announce the release of Dune 3.19.0.

This release contains some important fixes along with some improvements for the foreign_library stanza. It introduces support for concurrent builds through the RPC server.

See full changelog

Fixed

  • Fixed a bug that was causing cram tests attached to multiple aliases to be run multiple times. (#11547, @Alizter)

  • Fix: pass pkg-config (extra) args in all pkgconfig invocations. A missing --personality flag would result in pkgconf not finding libraries in some contexts. (#11619, @MisterDA)

  • Fix: Evaluate enabled_if when computing the stubs for stanzas such as foreign_library (#11707, @Alizter, @rgrinberg)

  • Fix $ dune describe pp for libraries in the presence of (include_subdirs unqualified) (#11729, fixes #10999, @rgrinberg)

  • Fix $ dune subst in sub directories of a git repository (#11760, fixes #11045, @Richard-Degenne)

  • Fix a crash involving Path.drop_prefix when using Melange on Windows (#11767, @nojb)

Added

  • Added detection and warning for common typos in package dependency constraints (#11600, fixes #11575, @kemsguy7)

  • Added (extra_objects) field to (foreign_library) stanza with (:include) support. (#11683, @Alizter)

Changed

  • Allow build RPC messages to be handled by dune's RPC server in eager watch mode (#11622, @gridbugs)

  • Allow concurrent build with RPC server (#11712, @gridbugs)

Dune 3.18.2

The Dune Team is happy to announce the release of Dune 3.18.2.

This release contains a bug fix to fix a compatibility issue with ocaml.5.4.0.

See full changelog

Fixed

  • fix compatibility with ocaml.5.4.0 by avoiding shadowing sigwinch (@nojb, #11639)

Dune 3.18.1

The Dune Team is happy to announce the release of Dune 3.18.1!

This release contains a bug fix for pkg-config that prevents it from finding some libraries in specific contexts.

See full changelog

Fixed

  • fix: pass pkg-config (extra) args in all pkgconfig invocations. A missing --personality flag would result in pkgconf not finding libraries in some contexts. (#11619, @MisterDA)

Dune 3.18.0

The Dune Team is happy to announce the release of Dune 3.18.0!

This release contains changes to support the new x-maintenance-intent field by default. It also contains some changes regarding the cache about how it handles file permissions. It introduces a new (format-dune-file ...) stanza with the intention to formalize the dune format-dune-file command as an inside rule. Finally, it includes various bug fixes for Dune.

See full changelog

Fixed

  • Support HaikuOS: don't call execve since it's not allowed if other pthreads have been created. The fact that Haiku can't call execve from other threads than the principal thread of a process (a team in haiku jargon), is a discrepancy to POSIX and hence there is a bug about it. (@Sylvain78, #10953)

  • Fix flag ordering in generated Merlin configurations (#11503, @voodoos, fixes ocaml/merlin#1900, reported by @vouillon)

Added

  • Add (format-dune-file <src> <dst>) action. It provides a replacement to dune format-dune-file command. (#11166, @nojb)

  • Allow the --prefix flag when configuring dune with ocaml configure.ml. This allows to set the prefix just like $ dune install --prefix. (#11172, @rgrinberg)

  • Allow arguments starting with + in preprocessing definitions (starting with (lang dune 3.18)). (@amonteiro, #11234)

  • Support for opam (maintenance_intent ...) in dune-project (#11274, @art-w)

  • Validate opam maintenance_intent (#11308, @art-w)

  • Support not in package dependencies constraints (#11404, @art-w, reported by @hannesm)

Changed

  • Warn when failing to discover root due to reads failing. The previous behavior was to abort. (@KoviRobi, #11173)

  • Use shorter path for inline-tests artifacts. (@hhugo, #11307)

  • Allow dash in dune init project name (#11402, @art-w, reported by @saroupille)

  • On Windows, under heavy load, file delete operations can sometimes fail due to AV programs, etc. Guard against it by retrying the operation up to 30x with a 1s waiting gap (#11437, fixes #11425, @MSoegtropIMC)

  • Cache: we now only store the executable permission bit for files (#11541, fixes #11533, @ElectreAAS)

  • Display negative error codes on Windows in hex which is the more customary way to display NTSTATUS codes (#11504, @MisterDA)

Dune 3.17.2

The Dune team is happy to announce the release of Dune 3.17.2!

This patch release includes some bug fixes. It brings some fixes for Melange and Wasm_of_ocaml. It also fixes a bug that prevents the experimental feature, package management, to build with ocaml.5.3.0.

See full changelog

Fixed

  • Fix a crash in the Melange rules that would prevent compiling public library implementations of virtual libraries. (@anmonteiro, #11248)
  • Pass melange.emit's compile_flags to the JS emission phase. (@anmonteiro, #11252)
  • Disallow private implementations of public virtual libs in melange mode. (@anmonteiro, #11253)
  • Wasm_of_ocaml: fix the execution of tests in a sandbox. (#11304, @vouillon)

Dune 3.17.1

The Dune team is happy to announce the release of Dune 3.17.1!

This patch release includes some bug fixes. To reduce computing time, it does not build .cmxs files anymore when the (no_dynlink) stanza is used instead. This behavior also corrects the semantic of the (no_dynlink) stanza which was building but not installing .cmxs files. It does not try to build and install them anymore.

See full changelog

Fixed

  • When a library declares (no_dynlink), then the .cmxs file for it is no longer built. (#11176, @nojb)

  • Fix bug that could result in corrupted file copies by Dune, for example when using the copy_files# stanza or the copy# action. (@nojb, #11194, fixes #11193)

  • Remove useless error message when running $ dune subst in empty projects. (@rgrinberg, #11204, fixes #11200)

Dune 3.17.0

We're happy to announce the release of Dune 3.17.0.

Among the list of chances, this release enables the Dune cache by default for known-safe operations, adds support for Wasm_of_ocaml, adds support for the -H compiler flag introduced in OCaml 5.2 and allows specifying code hosting services like Codeberg or Gitlab organizations.

See full changelog

Fixed

  • Show the context name for errors happening in non-default contexts. (#10414, fixes #10378, @jchavarri)

  • Correctly declare dependencies of indexes so that they are rebuilt when needed. (#10623, @voodoos)

  • Don't depend on coq-stdlib being installed when expanding variables of the coq.version family (#10631, fixes #10629, @gares)

  • Error out if no files are found when using copy_files. (#10649, @jchavarri)

  • Re_export dune-section private library in the dune-site library stanza, in order to avoid failure when generating and building sites modules with implicit_transitive_deps = false. (#10650, fixes #9661, @MA0100)

  • Expect test fixes: support multiple modes and fix dependencies when there is a custom runner (#10671, @vouillon)

  • In a (library) stanza with (extra_objects) and (foreign_stubs), avoid double linking the extra object files in the final executable. (#10783, fixes #10785, @nojb)

  • Map (re_export) library dependencies to the exports field in META files, and vice-versa. This field was proposed in to https://discuss.ocaml.org/t/proposal-a-new-exports-field-in-findlib-meta-files/13947. The field is included in Dune-generated META files only when the Dune lang version is >= 3.17. (#10831, fixes #10830, @nojb)

  • Fix staged pps preprocessors on Windows (which were not working at all previously) (#10869, fixes #10867, @nojb)

  • Fix dune describe when an executable is disabled with enabled_if. (#10881, fixes #10779, @moyodiallo)

  • Fix an issue where C stubs would be rebuilt whenever the stderr of Dune was redirected. (#10883, fixes #10882, @nojb)

  • Fix the URL opened by the command dune ocaml doc. (#10897, @gridbugs)

  • Fix the file referred to in the error/warning message displayed due to the dune configuration version not supporting a particular configuration stanza in use. (#10923, @H-ANSEN)

  • Fix enabled_if when it uses env variable. (#10936, fixes #10905, @moyodiallo)

  • Fix exec -w for relative paths with --root argument (#10982, @gridbugs)

  • Do not ignore the (locks ..) field in the test and tests stanza (#11081, @rgrinberg)

  • Tolerate files without extension when generating merlin rules. (#11128, @anmonteiro)

Added

  • Make Merlin/OCaml-LSP aware of "hidden" dependencies used by (implicit_transitive_deps false) via the -H compiler flag. (#10535, @voodoos)

  • Add support for the -H flag (introduced in OCaml compiler 5.2) in dune (requires lang versions 3.17). This adaptation gives the correct semantics for (implicit_transitive_deps false). (#10644, fixes #9333, ocsigen/tyxml#274, #2733, #4963, @MA0100)

  • Add support for specifying Gitlab organization repositories in source stanzas (#10766, fixes #6723, @H-ANSEN)

  • New option to control jsoo sourcemap generation in env and executable stanza (#10777, fixes #10673, @hhugo)

  • One can now control jsoo compilation_mode inside an executable stanza (#10777, fixes #10673, @hhugo)

  • Add support for specifying default values of the authors, maintainers, and license stanzas of the dune-project file via the dune config file. Default values are set using the (project_defaults) stanza (#10835, @H-ANSEN)

  • Add names to source tree events in performance traces (#10884, @jchavarri)

  • Add codeberg as an option for defining project sources in dune-project files. For example, (source (codeberg user/repo)). (#10904, @nlordell)

  • dune runtest can now run individual tests with dune runtest mytest.t (#11041, @Alizter).

  • Wasm_of_ocaml support (#11093, @vouillon)

  • Add a coqdep_flags field to the coq field of the env stanza, and to the coq.theory stanza, allowing to configure coqdep flags. (#11094, @rlepigre)

Changed

  • Remove all remnants of the experimental patch-back-source-tree. (#10771, @rgrinberg)

  • Change the preset value for author and maintainer fields in the dune-project file to encourage including emails. (#10848, @punchagan)

  • Tweak the preset value for tags in the dune-project file to hint at topics not having a special meaning. (#10849, @punchagan)

  • Change some colors to improve readability in light-mode terminals (#10890, @gridbugs)

  • Forward the linkall flag to jsoo in whole program compilation as well (#10935, @hhugo)

  • Configurator uses pkgconf as pkg-config implementation when available and forwards it the target of ocamlc -config. (#10937, @pirbo)

  • Enable Dune cache by default. Add a new Dune cache setting enabled-except-user-rules, which enables the Dune cache, but excludes user-written rules from it. This is a conservative choice that can avoid breaking rules whose dependencies are not correctly specified. This is the current default. (#10944, #10710, @nojb, @ElectreAAS)

  • Do not add dune dependency in dune-project when creating projects with dune init proj. The Dune dependency is implicitely added when generating opam files (#11129, @Leonidas-from-XIV)

Dune 3.16.1

We're happy to announce the release of Dune 3.16.1.

This is a patch release that fixes an issue with OCaml.5.3.0 and C++ flags.

See full changelog

Fixed

  • Call the C++ compiler with -std=gnu++11 when using OCaml >= 5.0 (#10962, @kit-ty-kate)

    Added

Dune 3.16.0

We're happy to announce the release of Dune 3.16.0.

Among the list of chances, this release contains improvements to Melange support and a way to look for references in a whole project using Merlin and OCaml LSP.

See full changelog

Added

  • Allow libraries with the same (name ..) in projects as long as they don't conflict during resolution (via enabled_if). (#10307, @anmonteiro, @jchavarri)

  • dune describe pp now finds the exact module and the stanza it belongs to, instead of guessing the name of the preprocessed file. (#10321, @anmonteiro)

  • Print the result of dune describe pp with the respective dialect printer. (#10322, @anmonteiro)

  • Add new flag --context to dune ocaml-merlin, which allows to select a Dune context when requesting Merlin config. Add dune describe contexts subcommand. Introduce a field generate_merlin_rules for contexts declared in the workspace, that allows to optionally produce Merlin rules for other contexts besides the one selected for Merlin (#10324, @jchavarri)

  • Melange: add include paths for private library .cmj files during JS emission. (#10416, @anmonteiro)

  • dune ocaml-merlin: communicate additional directives SOURCE_ROOT, UNIT_NAME (the actual name with wrapping) and INDEX with the paths to the index(es). (#10422, @voodoos)

  • Add a new alias @ocaml-index that uses the ocaml-index binary to generate indexes that can be read by tools such as Merlin to provide project-wide references search. (#10422, @voodoos)

  • Merlin: add optional (merlin_reader CMD) construct to (dialect) stanza to configure a Merlin reader (#8567, @andreypopp)

Changed

  • Melange: treat private libraries with (package ..) as public libraries, fixing an issue where import paths were wrongly emitted. (#10415, @anmonteiro)

  • Install .glob files for Coq theories too (#10602, @ejgallego)

Fixed

  • Don't try to document nonexistent libraries in doc-new target (#10319, fixes #10056, @jonludlam)

  • Make dune-site's load_all function look for META files so that it doesn't fail on empty directories in the plugin directory (#10458, fixes #10457, @shym)

  • Fix incorrect warning for libraries defined inside nonexistant directories using (subdir ..) and used by executables using dune-build-info (#10525, @rgrinberg)

  • Don't try to take build lock when running coq top --no-build (#10547, fixes #7671, @lzy0505)

  • Make sure to truncate Dune's lock file after locking and unlocking so that users cannot observe incorrect PID's (#10575, @rgrinberg)

  • MDX: link MDX binary with byte_complete. This fixes (libraries) with foreign archives on Linux. (#10586, fixes #10582, @anmonteiro)

  • Virtual libraries: fix an issue where linking an executable involving several virtual libries would cause an error. (#10581, fixes #10460, @rgrinberg)

Dune 3.15.3

We just released version 3.15.3 with some bug fixes.

See full changelog

Fixed

  • Fix interpretation of exists_if predicate in META files of installed libraries containing more than one element. (#10564, fixes #10563, @dbuenzli, @nojb)

  • Fix TSAN warning in wait4 stubs (#10554, fixes #10553, @emillon)

Dune 3.15.2

We just released version 3.15.2 with some bug fixes.

This one is particularly important for Coq users since it fixes a bug introduced in 3.13.0 that made incremental builds very slow.

See full changelog

Fixed

  • If no directory targets are defined, then do not evaluate enabled_if (#10442, @rgrinberg)

  • Fix a bug where Coq projects were being rebuilt from scratch each time the dependency graph changed. (#10446, fixes #10149, @alizter)

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)

Dune 3.14.2

We're happy to announce that Dune 3.14.2 is now available.

Note that due to a regression that was detected before publishing to opam version 3.14.1 should not be used. The fix for the regression is part of this release.

This feature brings some small bugfixes around the handling of Coq as well as solves an issue where Dune is running on Windows in a path that contains Unicode characters. This affected e.g. users with diacritics or non-latin script in their name when running Dune within their home directory.

See full changelog

Fixed

  • When a directory is changed to a file, correctly remove it in subsequent dune build runs. (#9327, fix #6575, @emillon)

  • Fix a problem with the doc-new target where transitive dependencies were missed during compile. This leads to missing expansions in the output docs. (#9955, @jonludlam)

  • coq: fix performance regression in coqdep unescaping (#10115, fixes #10088, @ejgallego, thanks to Dan Christensen for the report)

  • coq: memoize coqdep parsing, this will reduce build times for Coq users, in particular for those with many .v files (#10116, @ejgallego, see also #10088)

  • on Windows, use an unicode-aware version of CreateProcess to avoid crashes when paths contains non-ascii characters. (#10212, fixes #10180, @emillon)

  • fix compilation on non-glibc systems due to signal.h not being pulled in spawn stubs. (#10256, @emillon)

Dune 3.14.0

We're happy to announce that Dune 3.14.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.

Dynamic dune files with (dynamic_include)

It is common for some parts of a build to be dynamic: for example a source file can be generated, or some parts of the configuration like C flags can be generated from a Dune rule. But until now it was not possible to generate rules dynamically.

For example, one might want to do it is to set up one rule per input file. This is a common pattern in test suites and is easy to do with Make. But Dune does not have a concept of parameterized rules, so it is necessary to set up one rule per input file.

The pattern to do this with Dune is to:

  • Write a generator that lists the input files and emits Dune stanzas (as text);
  • Add a rule that makes a dune.inc file using this generator;
  • Add (include dune.inc) in the main dune file,

However, this requires checking in the generated dune.inc file in the repository. Another drawback is that when modifying the list of input files, it is necessary to run tests twice: one to update dune.inc, one to run the new test.

This release of Dune adds a new (dynamic_include) stanza that lifts these restrictions: dune.inc does not have to be part of the source tree, it can be generated transparently. This comes with some restrictions: some stanzas can not be generated, in particular the ones that define public libraries. And due to how rule loading works, the generated stanza needs to be defined in a different directory.

Still, this should be useful for many users that rely on the generate-include-commit pattern described above.

Sherlodoc integration

Sherlodoc is a search engine for OCaml documentation, which supports search by name, documentation and fuzzy type search (similar to Hoogle in the Haskell world). It can be obtained from opam using opam install sherlodoc.

When it is available, Dune commands that produce HTML documentation, such as dune build @doc and dune build @doc-new, will include a search bar in the generated output.

See full changelog

Added

  • Introduce a (dynamic_include ..) stanza. This is like (include foo) but allows foo to be the target of a rule. Currently, there are some limitations on the stanzas that can be generated. For example, public executables, libraries are currently forbidden. (#9913, @rgrinberg)

  • Introduce $ dune promotion list to print the list of available promotions. (#9705, @moyodiallo)

  • If Sherlodoc is installed, add a search bar in generated HTML docs (#9772, @EmileTrotignon)

  • Add only_sources field to copy_files stanza (#9827, fixes #9709, @jchavarri)

  • The (foreign_library) stanza now supports the (enabled_if) field. (#9914, @nojb)

Fixed

  • Fix $ dune install -p incorrectly recognizing packages that are supposed to be filtered (#9879, fixes #4814, @rgrinberg)

  • subst: correctly handle opam files in opam/ subdirectory (#9895, fixes #9862, @emillon)

  • Odoc private rules are not set up if a library is not available due to enabled_if (#9897, @rgrinberg and @jchavarri)

Changed

  • When dune language 3.14 is enabled, resolve the binary in (run %{bin:..} ..) from where the binary is built. (#9708, @rgrinberg)

  • boot: remove single-command bootstrap. This was an alternative bootstrap strategy that was used in certain conditions. Removal makes the bootstrap a bit slower on Linux when only a single core is available, but bootstrap is now reproducible in all cases. (#9735, fixes #9507, @emillon)

Dune 3.13.1

We just released version 3.13.1 with some bugfixes.

See full changelog
  • Fix performance regression for incremental builds (#9769, fixes #9738, @rgrinberg)

  • Fix dune ocaml top-module to correctly handle absolute paths. (#8249, fixes #7370, @Alizter)

  • subst: ignore broken symlinks when looking at source files (#9810, fixes #9593, @emillon)

  • subst: do not fail on 32-bit systems when large files are encountered. Just log a warning in this case. (#9811, fixes #9538, @emillon)

  • boot: sort directory entries in readdir. This makes the dune binary reproducible in terms of filesystem order. (#9861, fixes #9794, @emillon)

Dune 3.13.0

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

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

Generate Conflicts File for Menhir Grammars (#9512, @nojb)

When menhir is used to generate code from .mly files, there are sometimes issues with the grammar itself, such as shift-reduce conflicts.

Menhir has an option to generate a "conflicts" file using its --explain flag, but until now this was not exposed by Dune. Starting from this version, this file will be generated automatically to help developers debug their grammars.

Cached Directory Targets (#9535, @rleshchinskiy)

Dune's global cache is a way to save the result of intermediate build results, even across projects. Previously, it would only work with file targets. With this change, it now supports Dune's experimental directory targets.

Dynamic Module List (#9578, @nojb)

In several places in the Dune language, it is possible to pass a list of modules. For example in a (library) stanza, if for some reason the default of picking all the source files in the current directory is not the right thing to do, it is possible to pass (module A B C) to only attach these modules to the library.

An important limitation has been that the list of modules needed to be static: written as is in the dune file. This limitation has now been lifted and it is possible to use (:include) or %{read-lines:file} in this field and similar ones.

LexiFi's use case is a system of static plug-ins: a program is extended by selecting which modules are linked to the application core. This list of modules can now be emitted by a generator that reads a configuration file.

Previously, this required using OCaml syntax for the dune file, which has several issues, including incompatibility with features like (include_subdirs) and poor performance because Dune does not know the dependencies of the generator and needs to re-run the build more times than necessary.

See full changelog

Added

  • Add command dune cache clear to completely delete all traces of the Dune cache. (#8975, @nojb)

  • Allow to disable Coq 0.8 deprecation warning (#9439, @ejgallego)

  • Allow OCAMLFIND_TOOLCHAIN to be set per context in the workspace file through the env stanza. (#9449, @rgrinberg)

  • Menhir: generate .conflicts file by default. Add new field to the (menhir) stanza to control the generation of this file: (explain <blang expression>). Introduce (menhir (flags ...) (explain ...)) field in the (env) stanza, delete (menhir_flags) field. All changes are guarded under a new version of the Menhir extension, 3.0. (#9512, @nojb)

  • Directory targets can now be cached. (#9535, @rleshchinskiy)

  • It is now possible to use special forms such as (:include) and variables %{read-lines:} in (modules) and similar fields. Note that the dependencies introduced in this way (i.e., the files being read) must live in a different directory than the stanza making use of them. (#9578, @nojb)

  • Remove warning 30 from default set for projects where dune lang is at least 3.13 (#9568, @gasche)

  • Add coqdoc_flags field to coq field of env stanza, allowing the setting of workspace-wide defaults for coqdoc_flags. (#9280, fixes #9139, @Alizter)

  • ctypes: fix an error where (ctypes) with no (function_description) would cause an error trying refer to a nonexistent _stubs.a dependency (#9302, fix #9300, @emillon)

Changed

  • Check that package names in (depends) and related fields in dune-project are well-formed. (#9472, fixes #9270, @ElectreAAS)

Fixed

  • Do not ignore (formatting ..) settings in context or workspace files (#8447, @rgrinberg)

  • Fixed a bug where Dune was incorrectly parsing the output of coqdep when it was escaped, as is the case on Windows. (#9231, fixes #9218, @Alizter)

  • Copying mode for sandboxes will now follow symbolic links (#9282, @rgrinberg)

  • Forbid the empty (binaries ..) field in the env stanza in the workspace file unless language version is at least 3.2. (#9309, @rgrinberg)

  • [Coq] Fix bug in computation of flags when composed with boot theories. (#9347, fixes #7909, @ejgallego)

  • Fixed a bug where the (select) field of the (libraries) field of the (test) stanza wasn't working properly. (#9387, fixes #9365, @Alizter)

  • Fix handling of the PATH argument to dune init proj NAME PATH. An intermediate directory called NAME is no longer created if PATH is supplied, so dune init proj my_project . will now initialize a project in the current working directory. (#9447, fixes #9209, @shonfeder)

  • Experimental doc rules: Correctly handle the case when a package depends upon its own sublibraries (#9461, fixes #9456, @jonludlam)

  • Resolve various public binaries to their build location, rather than to where they're copied in the _build/install directory (#9496, fixes #7908, @rgrinberg).

  • Correctly ignore warning flags in vendored projects (#9515, @rgrinberg)

  • Use watch exclusions in watch mode on MacOS (#9643, fixes #9517, @PoorlyDefinedBehaviour)

  • Fix Merlin configuration for (include_subdirs qualified) modules (#9659, fixes #8297, @rgrinberg)

  • Fix handling of enabled_if in binary install stanzas. Previously, we'd ignore the result of enabled_if when evaluating %{bin:..} (#9707, @rgrinberg)

Dune 3.12.2

We just released version 3.12.2 with 2 bugfixes.

See full changelog

Fixed

  • Fix version check in runtest_alias for cram stanza (#9454, @emillon)

  • Fix stack overflow when a (run) action can not be parsed. (#9530, fixes #9529, @gridbugs)

Dune 3.12.1

We're pleased to announce the release of Dune 3.12!

Note that due to a mistake during the release process, version 3.12.0 was not published to opam and should not be used.

This version contains many fixes but we would like to highlight the following features:

  • dune ocaml doc is a new command that will build the docs of your package, and open them in a web browser directly.
  • a new set of odoc rules will build documentation for the whole switch. It can be invoked by dune build @doc-new. Note that this is still experimental.
  • Dune can now be built and installed on Haiku.
See full changelog

Added

  • Introduce $ dune ocaml doc to open and browse documentation. (#7262, fixes #6831, @EmileTrotignon)

  • dune cache trim now accepts binary byte units: KiB, MiB, etc. (#8618, @Alizter)

  • Introduce the runtest_alias field to the cram stanza. This allows removing default runtest alias from tests. (@rgrinberg, #8887)

  • Display cache location in Dune log (#8974, @nojb)

  • Dune can now be built and installed on Haiku (#8795, fix #8551, @Alizter)

  • Mark installed directories in dune-package files. This fixes (package) dependencies against packages that contain such directories. (#8953, fixes #8915, @emillon)

  • Introduce new experimental odoc rules (#8803, @jonjudlam)

Changed

  • dune-build-info: when version="" is found in a META file, we now return None as a version string (#9177, @emillon)

  • No longer force colors for OCaml 4.03 and 4.04 (#8778, @rgrinberg)

  • Dependencies in the copying sandbox are now writeable (#8920, @rgrinberg)

  • Rules that only use internal dune actions (write-file, echo, etc.) can now be sandboxed. (#9041, fixes #8854, @rgrinberg)

  • Add test_ prefix to default test name in dune init project (#9257, fixes #9131, @9sako6)

Fixed

  • Do not ignore libraries named bigarray when they are defined in conjunction with OCaml 5.0 (#8902, fixes #8901, @rgrinberg)

  • Correctly ignore bigarray on recent versions of OCaml (#9076, @rgrinberg)

  • Absent packages shouldn't prevent all rules from being loaded (#8948, fixes #8630, @rgrinberg)

  • Correctly determine the stanza of menhir modules when (include_subdirs qualified) is enabled (@rgrinberg, #8949, fixes #7610)

  • Re-run actions whenever (expand_aliases_in_sandbox) changes (#8990, @rgrinberg)

  • Do not re-run rules when their location changes (#9052, @rgrinberg)

  • [coq rules] Be more tolerant when coqc --print-version / --config don't work properly, and fallback to a reasonable default. This fixes problems when building Coq projects with (stdlib no) and likely other cases. (#8966, fix #8958, @Alizter, reported by Lasse Blaauwbroek)

  • Dune will now run at a lower framerate of 15 fps rather than 60 when INSIDE_EMACS. (#8812, @Alizter)

Dune 3.11.1

Following the release of Dune 3.11.0 a few days ago, we've just released version 3.11.1 with a couple of bug fixes:

  • Fix the dune rpc status command that was incorrectly showing that there were no RPC servers running on Windows.
  • Fix a bogus error when no inline test was declared in a library using (inline_tests).
See full changelog

Fixed

  • Fix dune rpc commands on Windows (#8806, fixes #8799, @nojb)

  • Fix inline_tests when the partition list is empty (#8849, fixes #8848, @hhugo)

Dune 3.11.0

We're pleased to announce the release of Dune 3.11!

Here are some highlights from this release.

Dune Terminal User Interface (TUI)

The biggest highlight in this release is the introduction of the new Terminal User Interface (TUI) display mode.

You can now run dune build --display tui to open a TUI. We recommend using it in conjunction with Dune watch mode (dune build -w --display tui).

From the TUI, you will be able to navigate messages from Dune build, scroll through them, or click to minimize them. Press ? to show the help screen.

Installing Source Directories

Another exciting feature in this release is the new (source_trees ..) field added to the (install ..) stanzas to add every files in a directory to the installation. For instance, to add your manual to the installation, you can use:

(install
 (section doc)
 (source_trees manual))

Let us know what you think about these features, and don't hesistate to open issues on Dune's bug tracker if you encounter any issue.

See full changelog

Added

  • enabled_if now supports arch_sixtyfour variable (#8023, fixes #7997, @Alizter)

  • Experimental: Added a $ dune monitor command that can connect to a running dune build in watch mode and display the errors and progress. (#8152, @Alizter)

  • The progress RPC procedure now has an extra field for the In_progress constructor for the number of failed jobs. (#8212, @Alizter)

  • Add a --preview flag to dune fmt which causes it to print out the changes it would make without applying them (#8289, @gridbugs)

  • Introduce (source_trees ..) to the install stanza to allow installing entire source trees. (#8349, @rgrinberg)

  • Add --stop-on-first-error option to dune build which will terminate the build when the first error is encountered. (#8400, @pmwhite and @Alizter)

  • Dune now displays the number of errors when waiting for changes in watch mode. (#8408, fixes #6889, @Alizter)

  • Add with_prefix keyword for changing the prefix of the destination of installed files matched by globs. (#8416, @gridbugs)

  • Added experimental --display tui option for Dune that opens an interactive Terminal User Interface (TUI) when Dune is running. Press '?' to open up a help screen when running for more information. (#8429, @Alizter and @rgrinberg)

  • Add a warnings field to dune-project files as a unified mechanism to enable or disable dune warnings (@rgrinberg, 8448)

  • dune exec: support syntax like %{bin:program}. This can appear anywhere in the command line, so things like dune exec time %{bin:program} now work. (#6035, #8474, fixes #2691, @emillon, @Leonidas-from-XIV)

  • Add a new alias @doc-json to build odoc documentation in JSON format. This output can be consumed by external tools. (#8178, @emillon)

Changed and Fixed

  • Use posix_spawn instead of fork on MacOS. This gives us a performance boost and allows us to re-enable thread. (#8090, @rgrinberg)

  • Modules that were declared in (modules_without_implementation), (private_modules) or (virtual_modules) but not declared in (modules) will raise an error. (#7674, @Alizter)

  • No longer emit linkopts(javascript) in META files (#8168, @hhugo)

  • RPC message styles are now serialised meaning that RPC diagnostics keep their ANSI styling. (#8516, fixes #6921, @Alizter)

  • Truncate output from actions that produce too much output (@tov, #8351)

  • Allow libraries to shadow OCaml built-in libraries. Previously, built-in libraries would always take precedence. (@rgrinberg, #8558)

  • dune utop no longer links utop in "custom" mode, which should make this command considerably faster. (#8631, fixes #6894, @nojb)

  • Ensure that package names in dune-project are valid opam package names. (#8331, @emillon)

  • init: check that module names are valid (#8644, fixes #8252, @emillon)

  • dune init: parse --public as a public name (#8603, fixes #7108, @emillon)

  • Stop signing source files with substitutions. Sign only binaries instead (#8361, fixes #8360, @anmonteiro)

  • Make copy sandbox support directory targets. (#8705, fixes #7724, @emillon)

Deprecated and Removed

  • Deprecate install destination paths beginning with ".." to prevent packages escaping their designated installation directories. (#8350, @gridbugs)

  • Remove warning against .dune files generated by pre Dune 2.0 (#8611, @rgrinberg)

  • Remove versions 0.1 and 0.2 of the experimental ctypes extension. (#8293, @emillon)

Dune 3.9.3

The fix to sendfile in 3.9.2 was not quite enough so here is the last part of the fix. It brings compatibility with filesystems where sendfile is not available, in particular when ecryptfs is used.

See full changelog

Fixes

  • Fix flushing when using sendfile fallback (#8288, fixes #8284, @alan-j-hu)

Dune 3.10.0

We're happy to announce the release of Dune 3.10.0. It comes with some internal fixes as well as some interesting features:

  • some changes in dune describe that will allow a better implementation of opam-dune-lint to check the consistency between library and package dependencies
  • more commands made available under dune show for a more consistent command line interface
See full changelog

Added

  • Add dune show rules as alias of the dune rules command. (#8000, @Alizter)

  • Add dune show installed-libraries as an alias of the dune installed-libraries command. (#8135, @Alizter)

  • Add dune build --dump-gc-stats FILE argument to dump garbage collection stats to a named file. (#8072, @Alizter)

  • Add dune describe package-entries to print all package entries (#7480, @moyodiallo)

Fixed

  • Fix %{deps} to expand properly in (cat ...) when containing 2 or more items. (#8196, @Alizter)

  • Fix the severity of error messages sent over RPC which was missing. (#8193, @Alizter)

  • Fix bug with ppx and Reason syntax due to missing dependency in sandboxed action (#7932, fixes #7930, @Alizter)

Changed

  • Improve dune describe external-lib-deps by adding the internal dependencies for more information. (#7478, @moyodiallo)

  • Re-enable background file digests on Windows. The files are now open in a way that prevents race condition around deletion. (#8262, fixes #8268, @emillon)

Dune 3.9.2

This bugfix-only release contains two platform-specific changes: one fixes the Dune cache on Windows, and the other one completes the fix on Linux when sendfile is not available. This makes Dune available where user directories are encrypted using ecryptfs for example.

See full changelog

Fixes

  • Disable background digests on Windows. This prevents an issue where unremovable files would make Dune crash when the shared cache is enabled. (#8243, fixes #8228, @emillon)

  • Fix permission errors when sendfile is not available (#8234, fixes #8210, @emillon)

Dune 3.9.1

In Dune 3.9.0, we added a feature that offloads some computations to background threads. Unfortunately, this has a bad interaction on macOS, where we fork processes to implement the RPC server and watch mode.

We marked Dune 3.9.0 unavailable on macOS, and released 3.9.1 with some mitigations: we don't offload these computations on macOS, and we only fork when necessary.

The plan for the next release is to stop forking processes on macOS.

See full changelog

Fixes

  • Disable background operations and threaded console on macOS and other Unixes where we rely on fork. (#8100, #8121, fixes #8083, @rgrinberg, @emillon)

  • Initialize async I/O thread lazily. (#8122, @emillon)

Dune 3.9.0

The Dune team is thrilled to announce the release of Dune 3.9.0. This version ships with a host of new features and improvements, including:

  • New dune show Command: This command enables you to display various pieces of information. For instance, you can use dune show pp to display the preprocessed output of a file or dune show aliases [DIR] to list the aliases available in DIR. Read more about the command on its manpage using dune show --help.
  • Improved Dialect Support: We have rolled out several fixes related to dialect support. These changes make it easier to work with Dream's .eml files.
  • Introduction of (build_if) Toggle in (test) Stanza: This new field facilitates the packaging of non-portable tests and benchmarks. If you have tests that don't build on a specific platform, you can now tell Dune not to build them on other Platforms with the build_if field.

Enjoy the new features and improvements incorporated into this version!

See full changelog

Added

  • Include the time it takes to read/write state files when --trace-file is enabled (#7960, @rgrinberg)

  • Include source tree scans in the traces produced by --trace-file (#7937, @rgrinberg)

  • Add --all option to dune rpc status to show all Dune RPC servers running. (#8011, fix #7902, @Alizter)

  • Add additional metadata to the traces provided by --trace-file whenever --trace-extended is passed (#7778, @rleshchinskiy)

  • $ dune describe is now a command group, so arguments to subcommands must be passed after subcommand itself. (#7919, @Alizter)

  • Add dune show command group which is an alias of dune describe. (#7946, @Alizter)

  • Add dune show env command and make dune printenv an alias of it. (#7985, @Alizter)

  • Add commands dune show targets and dune show aliases that display all the available targets and aliases in a given directory respectively. (#7770, grants #265, @Alizter)

  • Extensions used in (dialect) can contain periods (e.g., cppo.ml). (#7782, fixes #7777, @nojb)

  • The interface and implementation fields of a (dialect) are now optional (#7757, @gpetiot)

  • Add (build_if) to the (test) stanza. When it evaluates to false, the executable is not built. (#7899, fixes #6938, @emillon)

  • Allow (include_subdirs qualified) to be used when libraries define a (modules ...) field (#7797, fixes #7597, @anmonteiro)

  • Allow multiple globs in library's (stdlib (internal_modules ..)) (@anmonteiro, #7878)

Changed

  • Do not rerun OCaml syntax files on every iteration of the watch mode. This is too memory consuming. (#7894, fix #6900, @rgrinberg)

  • Attach melange rules to the default alias (#7926, @haochenx)

  • Compute digests and manage sandboxes in background threads (#7947, @rgrinberg)

Fixed

  • Validate file extension for $ dune ocaml top-module. (#8005, fixes #8004, @3Rafal)

  • Cinaps: The promotion rules for cinaps would only offer one file at a time no matter how many promotions were available. Now we offer all the promotions at once (#7901, @rgrinberg)

  • Add necessary parentheses in generated opam constraints (#7682, fixes #3431, @Lucccyo)

Removed

  • Remove some compatibility code for old version of dune that generated .merlin files. Now dune will never remove .merlin files automatically (#7562)

  • In opam constraints, reject (and) and (or) with no arguments at parse time (#7730, @emillon)

Dune 3.8.3

This point release fixes two important issues on Windows and Linux.

See full changelog
  • Fix deadlock on Windows (dune#8044, @nojb)
  • When using sendfile to copy files on Linux, fall back to the portable version if it fails at runtime for some reason (NFS, etc). (dune#8049, fixes dune#8041, @emillon)

Dune 3.8.2

We've released Dune 3.8.2 with a few bug fixes.

See full changelog
  • Switch back to threaded console for all systems; fix unresponsive console on Windows (dune#7906, @nojb)
  • Respect -p / --only-packages for melange.emit artifacts (dune#7849, @anmonteiro)
  • Fix scanning of Coq installed files (@ejgallego, reported by @palmskog, dune#7895 , fixes dune#7893)
  • Fix RPC buffer corruption issues due to multi threading. This issue was only reproducible with large RPC payloads (dune#7418)
  • Fix printing errors from excerpts whenever character offsets span multiple lines (dune#7950, fixes dune#7905, @rgrinberg)

Dune 3.8.1

We've just released a patch version of Dune to fix regressions introduced in Dune 3.8.0.

In particular, we've reverted some cross-compilation improvements that caused build failures when using ppx_runtime_libraries and we'll revisit them in a future version of Dune.

See full changelog
  • Fix a crash when using a version of Coq < 8.13 due to the native compiler config variable being missing. We now explicitly default to (mode vo) for these older versions of Coq. (dune#7847, fixes dune#7846, @Alizter)
  • Duplicate installed Coq theories are now allowed with the first appearing in COQPATH being preferred. This is inline with Coq's loadpath semantics. This fixes an issue with install layouts based on COQPATH such as those found in nixpkgs. (dune#7790, @Alizter)
  • Revert dune#7415 and dune#7450 (Resolve ppx_runtime_libraries in the target context when cross compiling) (dune#7887, fixes dune#7875, @emillon)

Dune 3.8.0

The dune team is pleased to announce the release of Dune 3.8.0.

It is now available in opam-repository. As usual, it should always be safe to upgrade your dune package: new features and deprecations are only available if you upgrade the language version in your dune-project files.

🌟 Spotlight Features

  1. Dune concurrent action

Dune 3.8.0 introduced the new concurrent action. You can now use it instead of the progn action to execute actions concurrently.

For instance:

(rule
(action
  (concurrent
  (write-file A "I am file A.\n")
  (write-file B "I am certainly file B.\n")
  (write-file C "I am most certainly file C.\n"))))

will write to files A, B and C concurrently.

  1. Support for .mld files

In Dune 3.7.0, we introduced version 0.3 of the mdx stanza, which came with support for .mld files.

In Dune 3.8.0, .mld files are now supported by default with version 0.4 of the mdx stanza!

Have a look at this diff to see how to migrate your code to the new stanza version.

See full changelog

Added

  • Introduce mdx stanza 0.4 requiring mdx >= 2.3.0 which updates the default list of files to include *.mld files (#7582, @Leonidas-from-XIV)

  • Allow (stdlib ...) to be used with (wrapped false) in library stanzas (#7139, @anmonteiro).

  • Allow the main module of a library with (stdlib ...) to depend on other libraries (#7154, @anmonteiro).

  • Support (link_flags ...) in (cinaps ...) stanza. (#7423, fixes #7416, @nojb)

  • Allow (package ...) in any position within (rule ...) stanza (#7445, @Leonidas-from-XIV)

  • Added a new user action (concurrent ) which is like (progn ) but runs the actions concurrently. (#6933, @Alizter)

  • Accept the Ordered Set Language for the modes field in library stanzas (#6611, @anmonteiro).

  • Allow parallel execution of inline tests partitions (#7012, @hhugo)

  • Add the --display-separate-messages flag to separate the error messages produced by commands with a blank line. (#6823, fixes #6158, @esope)

  • Add --watch-exclusions to Dune build options (#7216, @jonahbeckford)

  • Adds support for loading plugins in toplevels (#6082, fixes #6081, @ivg, @richardlford)

  • Introduce a public_headers field on libraries. This field is like install_c_headers, but it allows to choose the extension and choose the paths for the installed headers. (#7512, @rgrinberg)

  • Dune can now detect Coq theories from outside the workspace. This allows for composition with installed theories (not necessarily installed with Dune). (#7047, @Alizter, @ejgallego)

  • Added a --no-build option to dune coq top for avoiding rebuilds (#7380, fixes #7355, @Alizter)

  • Add a coqdoc_flags field to the coq.theory stanza allowing the user to pass extra arguments to coqdoc. (#7676, fixes #7954 @Alizter)

  • Preliminary support for Coq compiled intefaces (.vos files) enabled via (mode vos) in coq.theory stanzas. This can be used in combination with dune coq top to obtain fast re-building of dependencies (with no checking of proofs) prior to stepping into a file. (#7406, @rlepigre)

  • Read pkg-config arguments from the PKG_CONFIG_ARGN environment variable (#1492, #7734, @anmonteiro)

  • Use $PKG_CONFIG, when set, to find the pkg-config binary (#7469, fixes #2572, @anmonteiro)

Changed

  • Bootstrap: remove reliance on shell. Previously, we'd use the shell to get the number of processors. (#7274, @rgrinberg)

  • Non-user proccesses such as version control or config checking are now run silently. (#6994, fixes #4066, @Alizter)

  • Bytecode executables built for JSOO are linked with -noautolink and no longer depend on the shared stubs of their dependent libraries (#7156, @nojb)

  • Always include opam files in the generated .install file. Previously, it would not be included whenever (generate_opam_files true) was set and the .install file wasn't yet generated. (#7547, @rgrinberg)

Deprecated

  • Modules that were declared in (modules_without_implementation), (private_modules) or (virtual_modules) but not declared in (modules) will cause Dune to emit a warning which will become an error in 3.9. (#7608, fixes #7026, @Alizter)

  • Coq language versions less 0.8 are deprecated, and will be removed in an upcoming Dune version. All users are required to migrate to (coq lang 0.8) which provides the right semantics for theories that have been globally installed, such as those coming from opam (@ejgallego, @Alizter)

Fixed

  • Find pps dependencies in the host context when cross-compiling, (#7415, fixes #4156, @anmonteiro)

  • Fix plugin loading with findlib. The functionality was broken in 3.7.0. (#7556, @anmonteiro)

  • Load the host context findlib.conf when cross-compiling (#7428, fixes #1701, @rgrinberg, @anmonteiro)

  • Allow overriding the ocaml binary with findlib configuration (#7648, @rgrinberg)

  • Resolve ppx_runtime_libraries in the target context when cross compiling (#7450, fixes #2794, @anmonteiro)

  • Fix dune install when cross compiling (#7410, fixes #6191, @anmonteiro, @rizo)

  • Fix string quoting in the json file written by --trace-file (#7773, @rleshchinskiy)

  • Correctly set MANPATH in dune exec. Previously, we would use the bin/ directory of the context. (#7655, @rgrinberg)

  • merlin: ignore instrumentation settings for preprocessing. (#7606, fixes #7465, @Alizter)

  • When a rule's action is interrupted, delete any leftover directory targets. This is consistent with how we treat file targets. (#7564, @rgrinberg)

  • Fix dune crashing on MacOS in watch mode whenever $PATH contains $PWD (#7441, fixes #6907, @rgrinberg)

  • Dune in watch mode no longer builds concurrent rules in serial (#7395 @rgrinberg, @jchavarri)

  • dune coq top now correctly respects the project root when called from a subdirectory. However, absolute filenames passed to dune coq top are no longer supported (due to being buggy) (#7357, fixes #7344, @rlepigre and @Alizter)

  • RPC: Ignore SIGPIPE when clients suddenly disconnect (#7299, #7319, fixes #6879, @rgrinberg)

  • Always clean up the UI on exit. (#7271, fixes #7142 @rgrinberg)

  • Bootstrap: correctly detect the number of processors by allowing nproc to be looked up in $PATH (#7272, @Alizter)

  • Speed up file copying on macos by using clonefile when available (@rgrinberg, #7210)

  • Support commands that output 8-bit and 24-bit colors in the terminal (#7188, @Alizter)

  • Speed up rule generation for libraries and executables with many modules (#7187, @jchavarri)

  • Do not re-render UI on every frame if the UI doesn't change (#7186, fix #7184, @rgrinberg)

  • Make coq_db creation in scope lazy (@ejgallego, #7133)

  • dune install now respects --display quiet mode (#7116, fixes #4573, fixes #7106, @Alizter)

  • Stub shared libraries (dllXXX_stubs.so) in Dune-installed libraries could not be used as dependencies of libraries in the workspace (eg when compiling to bytecode and/or Javascript). This is now fixed. (#7151, @nojb)

  • Fix regression where Merlin was unable to handle filenames with uppercase letters under Windows. (#7577, @nojb)

  • On nix+macos, pass -f to the codesign hook to avoid errors when the binary is already signed (#7183, fixes #6265, @greedy)

  • Fix bug where RPC clients built with dune-rpc-lwt would crash when closing their connection to the server (#7581, @gridbugs)

  • Fix RPC server on Windows (used for OCaml-LSP). (#7666, @nojb)

Dune 3.7.1

We are excited to announce the release of Dune 3.7.1, which brings a few bug fixes from the recent 3.7.0 release:

  • Resolved watch mode issue for executables on macOS: We have addressed a problem with the recently introduced watch mode for executables that was causing segmentation faults on macOS. Users can now enjoy a stable watch mode without unexpected crashes on macOS.
  • Fixed "Too many links" error on Windows: We have fixed an issue that caused Dune build failures with a "Too many links" error on Windows when using Dune cache.

... and a few more, you can consult the changelog for a full list of bug fixes.

See full changelog
  • Fix segfault on MacOS when dune was being shutdown while in watch mode. (#7312, fixes #6151, @gridbugs, @emillon)

  • Fix preludes not being recorded as dependencies in the (mdx) stanza (#7109, fixes #7077, @emillon).

  • Pass correct flags when compiling stdlib.ml. (#7241, @emillon)

  • Handle "Too many links" errors when using Dune cache on Windows. The fix in 3.7.0 for this same issue was not effective due to a typo. (#7472, @nojb)

Dune 3.7.0

The dune team is pleased to announce the release of Dune 3.7.0.

As in the previous announce, here is a changelog split in several parts: changes to the dune executable itself (new commands or options, etc) and changes to the dune language. Most of the changes to the latter are only enabled when you opt-in to the new version by specifying (lang dune 3.7) in the corresponding dune-project file. In other words, it should always be safe to upgrade the dune package.

🌟 Spotlight Features

  1. Watch mode for executables

Dune 3.7 now supports watch mode for executables! πŸŽ‰

It works just as you'd expect, if you define an executable, you can run it with

dune exec -w my-executable

It will interrupt the process when a file change and re-start the application.

For a practical example of the workflows enabled by watch-mode, check this demo of a live reload for web development:

  1. Native Windows Polling

Starting from Dune 3.7, Dune watch mode is now available on Windows!

@yams-yams and @nojb from Lexifi have been working on integrating Windows native polling API with Dune to supplement the support for fswatch, which is unavailable on Windows.

Windows users can now run dune build -w out of the box!

  1. Qualified Subdirs

It's quite common to organise your code into subdirectories to separate components. Until now, you could do this by including (include_subdirs unqualified) in your dune files, but this wasn't completely satisfying since all of your modules were available in the top-level. If you wanted to expose modules in subdirectories under another module, you had to create a separate library, which was.. quite the overhead.

Dune 3.7 brings support for the highly-anticipated qualified sub-directories. You can now write (include_subdirs qualified) in your dune file, and modules in your subdirectories will be exposed under a module with the name of the directory.

See full changelog

dune executable

Added

  • Allow running $ dune exec in watch mode (with the -w flag). In watch mode, $ dune exec the executed binary whenever it is recompiled. (#6966, @gridbugs)

  • Add a dune cache size command for displaying the size of the cache (#6638, @Alizter)

  • Allow $ dune ocaml dump-dot-merlin to run in watch mode. Also this command shouldn't print "Entering Directory" mesages. (#6497, @rgrinberg)

  • Add native support for polling mode on Windows (#7010, @yams-yams, @nojb, review by @Rucikir and @jbeckford)

  • Auto-detect dune-workspace files as dune files in Emacs (#7061, @ilankri)

  • Allow $ dune utop to load libraries defined in data only directories defined using (subdir ..) (#6631, @rgrinberg)

Changed

  • Make dune describe workspace return consistent dependencies for executables and for libraries. By default, compile-time dependencies towards PPX-rewriters are from now not taken into account (but runtime dependencies always are). Compile-time dependencies towards PPX-rewriters can be taken into account by providing the --with-pps flag. (#6727, fixes #6486, @esope)

  • Use colored output with MDX when Dune colors are enabled. (#6462, @MisterDA)

  • Use colored output with GCC and Clang when compiling C stubs. The flag -fdiagnostics-color=always is added to the :standard set of flags. (#4083, @MisterDA)

  • Move $ dune ocaml-merlin -dump-config=$dir to $ dune ocaml merlin dump-config $dir. (#6547, @rgrinberg)

Fixed

  • Fix parsing of OCaml errors that contain code excerpts with ... in them. (#7008, @rgrinberg)

  • Fix --trace-file output. Dune now emits a single complete event for every executed process. Unterminated async events are no longer written. (#6892, @rgrinberg)

  • Print missing newline after $ dune exec. (#6821, fixes #6700, @rgrinberg, @Alizter)

  • Fix binary corruption when installing or promoting in parallel (#6669, fixes #6668, @edwintorok)

  • Report an error if dune init ... would create a "dune" file in a location which already contains a "dune" directory (#6705, @gridbugs)

  • Fix the parsing of alerts. They will now show up in diagnostics correctly. (#6678, @rginberg)

  • Print "Leaving Directory" whenever "Entering Directory" is printed. (#6419, fixes #138, @cpitclaudel, @rgrinberg)

  • Remove "Entering Directory" messages for $ dune install. (#6513, @rgrinberg)

  • dune clean should no longer fail under Windows due to the inability to remove the .lock file. Also, bring the implementation of the global lock under Windows closer to that of Unix. (#6523, @nojb)

  • Fix missing dependencies when detecting the kind of C compiler we're using (#6610, fixes #6415, @emillon)

  • Remove spurious build dir created when running dune init proj ... (#6707, fixes #5429, @gridbugs)

  • Validate the command line arguments for $ dune ocaml top-module. This command requires one positional argument (#6796, fixes #6793, @rgrinberg)

  • Fix dependency cycle when installing files to the bin section with glob_files (#6764, fixes #6708, @gridbugs)

  • Handle "Too many links" errors when using Dune cache on Windows (#6993, @nojb)

  • Pre-emptively clear screen in watch mode (#6987, fixes #6884, @rgrinberg)

  • Allow --sandbox to affect ocamldep invocations. Previously, they were wrongly marked as incompatible (#6749, @rgrinberg)

dune language

Added

  • Allow (include_subdirs qualified) for OCaml projects. (#6594, fixes #1084, @rgrinberg)

  • Format dune files when they are named dune-file. This occurs when we enable the alternative file names project option. (#6566, @rgrinberg)

  • Add map_workspace_root dune-project stanza to allow disabling of mapping of workspace root to /workspace_root. (#6988, fixes #6929, @richardlford)

  • Allow the cinaps stanza to set a custom alias. By default, if the alias is not set then the cinaps actions will be attached to both @cinaps and @runtest (#6991, @rgrinberg)

  • Add (using ctypes 0.3). When used, paths in (ctypes) are interpreted relative to where the stanza is defined. (#6883, fixes #5325, @emillon)

Changed

  • Stop passing -q flag in dune coq top, which allows for .coqrc to be loaded. (#6848, fixes #6847, @Alizter)

  • Coq native mode is now automatically detected by Dune starting with Coq lang 0.7. (mode native) has been deprecated in favour of detection from the configuration of Coq. (#6409, @Alizter)

  • Accurately determine merlin configuration for all sources selected with copy# and copy_files#. The old heuristic of looking for a module in parent directories is removed (#6594, @rgrinberg)

Fixed

  • Fix parsing of the <= operator in blang expressions of dune files. Previously, the operator would be interpreted as <. (#6928, @tatchi)

  • Fix preprocessing with staged_pps (#6748, fixes #6644, @rgrinberg)

  • Fix the parsing of decimal and hexadecimal escape literals in dune, dune-package, and other dune s-expression based files (#6710, @shym)

  • Fix cross compilation configuration when a context with targets is itself a host of another context (#6958, fixes #6843, @rgrinberg)

  • Allow compilation rules to be impacted by (env ..) stanzas that modify the environment or set binaries. (#6527, @rgrinberg)

  • Fix handling of support files generated by odoc. (#6913, @jonludlam)

  • Fix the compilation of modules generated at link time when implicit_transitive_deps is enabled (#6642, @rgrinberg)

  • Fix inline tests with js_of_ocaml and whole program compilation mode enabled (#6645, @hhugo)

  • Fix js_of_ocaml separate compilation rules when --enable=effects ,--enable=use-js-string or --toplevel is used. (#6714, #6828, #6920, @hhugo)

  • Fix js_of_ocaml separate compilation in presence of linkall (#6832, #6916, @hhugo)

  • coqdep is now called once per theory, instead of one time per Coq file. This should significantly speed up some builds, as coqdep startup time is often heavy (#7048, @Alizter, @ejgallego)

Dune 3.6.2

See full changelog
  • Fix configurator when using the MSVC compiler (#6538, fixes #6537, @nojb)

  • Fix running the RPC server on windows (#6721 fixes #6720, @rgrinberg)

Dune 3.6.1

See full changelog
  • Fix status line enabled when ANSI colors are forced. (#6503, @MisterDA)

  • Fix build with MSVC compiler (#6517, @nojb)

  • Do not shadow library interface modules (#6549, fixes #6545, @rgrinberg)

Dune 3.6.0

Dear dune users, It is my pleasure to announce that dune 3.6.0 is now available on opam πŸŽ‰. Here's the changelog - I reused the same classification as in the previous announce for dune 3.5.0. Thanks again to all the contributors including bug reporters.

See full changelog

dune executable

This lists features of the β€œdune” executable itself. Upgrading dune will bring in these changes. We consider these changes safe, but it is difficult to define what a breaking change is for a command-line tool (for example, some error messages change). It is important to note that just upgrading the dune executable is not supposed to change how dune interprets existing projects. If just upgrading dune breaks compilation, it is a bug in dune, please report it!

Added

  • Introduce a $ dune ocaml top-module subcommand to load modules directly without sealing them behind the signature. (#5940, @rgrinberg)
  • Revive $ dune external-lib-deps under $ dune describe external-lib-deps. (#6045, @moyodiallo)
  • Extend the promotion CLI to a dune promotion group: dune promote is moved to dune promotion apply (the former still works) and the new dune promotion diff command can be used to just display the promotion without applying it. (#6160, fixes #5368, @emillon)
  • Build progress status now shows number of failed jobs (#6242, @Alizter)
  • Allow promoting into source directories specified by subdir (#6404, fixes #3502, @rgrinberg)
  • Support CLICOLOR and CLICOLOR_FORCE to enable/disable/force ANSI colors. (#6340, fixes #6323, @MisterDA).
  • Create a fake socket file _build/.rpc/dune on windows to allow rpc clients to connect using the build directory. (#6329, @rgrinberg)

Fixed

  • Forbid multiple instances of dune running concurrently in the same workspace. (#6360, fixes #236, @rgrinberg)
  • Make dune describe workspace return the correct root path (#6380, fixes #6379, @esope)
  • Fix running inline tests in bytecode mode (#5622, fixes #5515, @dariusf)

(lang dune 3.6)

This lists changes if you opt into the new (lang dune 3.6) version in your dune-project file. For this too, these are changes that we consider safe, but they can require changes to your dune files. For example, sandboxing is enabled in more places, which means that you might have to be more precise in expressing your dependencies. Please reach out on the issue tracker if you have trouble fixing your dune file or if something does not seem to be possible anymore.

Added

  • Add (glob_files <glob>) and (glob_files_rec <glob>) terms to the files field of the install stanza (#6250, closes #6018, @gridbugs)
  • Allow Byte_complete binaries to be installable (#4837, @AltGr, @rgrinberg)
  • Allow :standard in the (modules) field of the coq.pp stanza (#6229, fixes #2414, @Alizter)

Fixed

  • Allow absolute build directories to find public executables. For example, those specified with (deps %{bin:...}) (#6326, @anmonteiro)
  • [ctypes] do not mangle user written names in the ctypes stanza (#6374, fixes #5561, @rgrinberg)
  • Forbid private libraries with (package ..) set from depending on private libraries that don't belong to a package (#6385, fixes #6153, @rgrinberg)
  • [ctypes] always re-run pkg-config because we aren't tracking its external dependencies (#6052, @rgrinberg)
  • [ctypes] remove dependency on configurator in the generated rules (#6052, @rgrinberg)
  • Fix passing of flags to dune coq top (#6369, fixes #6366, @Alizter)
  • Prevent crash if absolute paths are used in the install stanza and in recursive globs. These cases now result in a user error. (#6331, @gridbugs)
If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.