Skip to content

Use (format-dune-file) instead of dune format-dune-file #1338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nojb
Copy link

@nojb nojb commented Apr 4, 2025

Hello,

You are currently calling dune format-dune-file from one of your tests. This command does not honour the Dune lang version used in the project which means that your test will break whenever we change the formatting style in Dune.

In Dune 3.18 we introduced a built-in action (format-dune-file <src> <dst>) precisely for this purpose. This action honours the current Dune lang version and does not require shelling out to an external process.

Note that dune format-dune-file may evolve in ways that may not be backwards compatible in the near future (as the CLI interface does not have any backwards compatibility or versioning guarantees), so we are encouraging users of this command to switch to the action instead.

See ocaml/dune#10892 (comment) for some of the context.

@maiste
Copy link

maiste commented Apr 8, 2025

Thanks @nojb!
I was about to do it today but you were clearly faster 😄

One question I have regarding this: shouldn't it add a dependency on dune >= 3.18 to make sure it supports the functionality?

@nojb
Copy link
Author

nojb commented Apr 8, 2025

Thanks @nojb! I was about to do it today but you were clearly faster 😄

One question I have regarding this: shouldn't it add a dependency on dune >= 3.18 to make sure it supports the functionality?

Yes, indeed. I pushed a fix (I think ; I am not very familiar with OPAM).

@panglesd panglesd added the no changelog This pull request does not need a changelog entry label May 14, 2025
Copy link
Collaborator

@panglesd panglesd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nojb! That looks good.

The benchmark CI failure seems to be related to ocaml/dune#11045.
It does not happen on ocaml-ci, which install deps and then call dune. On the contrary, the benchmark ci seems to pin everything and install them with opam, which calls dune subst and that is what is breaking.

Maybe that would be better to wait for the ocaml/dune#11045 fix to be released before raising dune lang if that is what triggers the bug?

@maiste
Copy link

maiste commented May 26, 2025

The new fix was merged. It should be available in 3.20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog This pull request does not need a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants