-
Notifications
You must be signed in to change notification settings - Fork 469
Prevent dune from adding targets to default aliases in some directories #2259
Description
First of all pardon my poorly worded title but I was struggling to find a good one. I'll try to summarize the issue with an example.
I'm trying to vendor some dependencies in a repo using duniverse as you might have guessed.
duniverse will clone the sources (built with dune) in a duniverse/ folder so that you can then just rely on dune to build your entire project and all of its transitive dependencies.
This works rather well but there are a few issues ATM and the most important of them is that if you now run dune build or dune runtest from the root of your project, it will build all installable targets and run all tests in both your project and all the vendored repositories in the duniverse/.
This can be a serious issue since you might end up building stuff you don't want and for which you eventually don't satisfy the dependencies, e.g. if one of the vendored repos' tests depend on ounit when yours depend on alcotest or if one of the repos provides several opam packages including some you don't need and that in turn require extra packages that aren't available.
This can be worked around by always providing the explicit list of targets you want to build but it is tedious and obviously doesn't scale much + you lose a nice feature of dune and eventually have to manually maintain a Makefile.
What I'd really like to be able to do here is tell dune somehow that I don't want it to build those targets by default, unless they are required by other default targets or explicitly specified of course.
Being able to add a dune file in my vendor/ or duniverse/ with a field like (dont_build_by_default true) (with a better name obviously) could greatly simplify vendoring/the duniverse workflow.
I believe such a feature could also prove helpful in some other cases like examples/ folders.
Do you think this would be a sensible addition to dune?