Implicit relock if the dependencies have changed
If lockfiles exist and these are out of date, this PR runs the solver again to re-create the lock directory.
This is a copy of @Leonidas-from-XIV's PR https://github.com/ocaml/dune/pull/10546, but targeting main rather than the toolchains branch. I've changed it to use the same feature flags module introduced in https://github.com/ocaml/dune/pull/10639.
There's some problems with this implementation from what I can tell:
-
It adds the overhead of reading the lock directory and checking if it's up to date on every single iteration of the watch mode. Has this overhead been measured?
-
Auto re-locking does not get triggered when local opam repositories are updated.
-
It does not use a lock so a user manually running
dune pkg lockcan race against the auto lock.
Apart from that, I have some questions:
-
How does one force dune to update remote opam repositories before running the auto lock?
-
What happens when one doing is multiple updates to project files in succession? Does it mean this triggers multiple auto locks that all get staggered?
This PR can be closed as it was done in but in a different way in #10851.