-
Notifications
You must be signed in to change notification settings - Fork 464
Description
Right now, if there is no dune-project or dune-workspace file in the current or a parent directory, Dune will still work and will use the current directory as workspace root.
In the past, this has bitten users who accidentally ran dune from the wrong directory, such as their home directory. The current behaviour dates back from jbuilder and was inspired by ocamlbuild. It was pointed out that some users of ocamlbuild already complained about this.
We discussed this in today's meeting and unanimously agreed to change Dune to require at least one dune-project or dune-workspace file to be present. One drawback is that it will make it a bit more difficult to get started, so we should also change dune init so that when invoked without argument it creates a simple dune-project file. A bit like git init.
We also discussed the fact that dune doesn't stop at the first dune-project or dune-workspace file is finds, but continue is search upward so that it uses the outtermost file as workspace root marker. The rationale for this choice is that Dune allows to compose several projects into a single big workspace. It makes sense to not stop at the first dune-project file but it makes a little less sense to continue past a dune-workspace file, given that there can be multiple dune-project file in a workspace but there can only be a single dune-workspace file. So we also decided to change Dune to stop at the first dune-workspace file it encounters.
We will do this changes in main and test them until Dune 3.0 to see how they work in practice. There will also be a release candidate for Dune 3.0, to give users a chance to test all these changes.