You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the way we build dune packages is by making dune spawn itself with dune build -p. For self evident reasons, this is rather inefficient. We spawn an extra process, create yet another _build directory and copy everything there, resolve all the public libraries, don't respect -j, etc.
What we could do instead is make dune setup the build rules for the downloaded sources and run them.
While the above would be ideal, the refactoring needed to achieve this would be enormous. A simpler solution which at least solves the -j problem is to create a job protocol like API over RPC and have the spawned dune use that.
I think this is actually the issues @Alizter was just working on. @Alizter, since you have the context, could you link this to the other related issues, closing redundant issues if necessary, and summarizing the findings of your investigation in the best place?
I have investigated the kind of refactoring needed for this, this week, and it has become apparent it will take a lot of work.
Currently we use our Source_tree as a scaffolding for discovering dune projects and stanzas, which means we don't have infrastructure for adding non-source directories. On top of that, all the dune rules assume that they will be sourced from the source tree rather than a source directory. This means there is no clear way to load rules in arbitrary build directories as of yet. Even if we would undertake such a bold refactoring, we would have to touch lots of unrelated parts of dune which I am more hesitant to do for the purposes of getting package management released.
On the point of -j raised here however, I no longer think that this is an issue. When we create a dune build command, which is detected during translation of the opam file, we don't actually pass the -j option in our explicit action. This means the subprocess dune uses as many processes as it pleases, which is problematic but not cache-invalidating at least.
Activity
shonfeder commentedon Oct 10, 2025
I think this is actually the issues @Alizter was just working on. @Alizter, since you have the context, could you link this to the other related issues, closing redundant issues if necessary, and summarizing the findings of your investigation in the best place?
Alizter commentedon Oct 10, 2025
I have investigated the kind of refactoring needed for this, this week, and it has become apparent it will take a lot of work.
Currently we use our
Source_treeas a scaffolding for discovering dune projects and stanzas, which means we don't have infrastructure for adding non-source directories. On top of that, all the dune rules assume that they will be sourced from the source tree rather than a source directory. This means there is no clear way to load rules in arbitrary build directories as of yet. Even if we would undertake such a bold refactoring, we would have to touch lots of unrelated parts of dune which I am more hesitant to do for the purposes of getting package management released.On the point of
-jraised here however, I no longer think that this is an issue. When we create adune buildcommand, which is detected during translation of the opam file, we don't actually pass the-joption in our explicit action. This means the subprocessduneuses as many processes as it pleases, which is problematic but not cache-invalidating at least.