dune icon indicating copy to clipboard operation
dune copied to clipboard

Replace auto-installation of dev tools with autolocking

Open Alizter opened this issue 1 month ago • 2 comments

We have a feature in dune at the moment which is guarded behind --lock-dev-tool in our configure. When running commands like dune fmt it creates a lock directory for ocamlformat, reads it, builds ocmalformat and then uses it in the build.

I propose that we instead forgo the locking part of this process and instead leave it to dune tool install. This feature should really be about being able to get ocamlformat on-the-fly. For this we can use autolocking. This will avoid the race conditions we currently have where source directories are scanned before the lock directories are created.

Alizter avatar Nov 18 '25 11:11 Alizter

What does "This feature" refer to in the following?

This feature should really be about being able to get ocamlformat on-the-fly

Is it the "auto-installation" functionality?

Could we just omit the magic here? I am not convinced there is much value in inferring the need to install stuff. Here's an alternative UI:

$ dune fmt
error: ocamlformat is not installed.
hint: run 'dune tools install ocamlformat'

Printing the hint can be conditional on (pkg enagled). This side steps the whole question of implicit installation by any means, without any significant downside for users, afaict.

I (weakly) hold the opinion that tho whole auto installation thing is a bit of an antifeature, as it leads to a tool doing things I have asked to to do.

shonfeder avatar Nov 19 '25 19:11 shonfeder

The feature I am referencing here is the feature flag DUNE_CONFIG__PKG_DEV_TOOL=enabled. This allows things like dune fmt to lock the dev tool as it's running.

Alizter avatar Nov 19 '25 22:11 Alizter