-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Package subsetting support for vendored code #7058
Comments
In a way this is similar to #3734 as it arises from the same issue, dealing with large duniverses, but this suggestion seems to me like a somewhat simpler solution as it also allows multiple versions of the same source tree, but at the moment my knowledge of dune scopes is too shallow to say for sure, hence I hope for suggestions and ideas on how to solve this problem. |
This proposal is a decent workaround, but I don't think I understand the semantics yet. E.g. suppose that we have:
And we try to remove the package |
Isn't this the same problem as doing [1]:
|
Nope, the above is correct. When |
Yes, but I don't see how this this would be a different case? If we assume a hypothetical configuration like this:
Then the If you don't specify it then it fails, but that's the same as if depending on |
That sounds fine. I'm just trying to understand the semantics. As far as I can see, this feature is basically like My original proposal can be used to fix other issues as well, so I'm not yet certain if this intermediate step is worth doing. |
Yes indeed, this is more like It is for sure less comprehensive than #3734, but I fear just the solution proposed in #3734 is not enough to solve the problem we have in
as dune won't know which vendored version of the same repo is supposed to provide the Thus I don't think a fully inferred solution is possible. In the case of opam-monorepo we infer which package to use for which vendored source tree from the |
Yes, I agree that a fully inferred solution isn't possible. Anyway, this proposal sounds reasonable but we need a little more requisite work and a better idea on how it's going to work with other features that we're proposing before tackling this. I would suggest that we pause the discussion until we a prototype of the package management ready before we can be more confident about what to do about this. |
Desired Behavior
When other Dune projects are vendored, I would like to be able to define which packages are visible to Dune. This is currently supported using the
-p
flag todune build
when building/installing with OPAM: in that case Dune only builds (and OPAM installs) only the artifacts that are part of the packages specified via the-p
flag.This allows to use multiple third party libraries that contain the same package name (e.g.
dune
packages that dune vendors) or multiple versions of the same package (e.g.libfoo-1.0
andlibbar-1.0.1
from the same dev-repo, sharing a dune-project but installed in different versions).Unfortunately, the same is not possible when vendoring code, as in such case dune aborts because the same packages exist multiple times and it doesn't know which code to pick.
Example
Currently to designate a directory as vendored we can use
In this RFC I would like to suggest an extension to the
vendored_dirs
stanza that would allow specifying additional metadata on the directories to be vendored:Would in such case use the directory name
foo
and only build the packages that arefoo
,bar
would do similarly, while the other directories would have all their packages evaluated.Other solutions
I've attempted to write a tool to rename packages to random names (e.g. package
bar
in dirfoo
would becomebar-ab43ec
andfoo
in dirbar
would becomefoo-e21fce
, but unfortunately such a tool is not possible without running into a lot of problems:dune
files need to be rewritten to patch the project-internal references, despite ending up not actually building the renamed packages.dune-project
files need to be rewritten to rename thepackage
stanzas<project>.opam
files need to be renamedWhile these issues are solvable with a bit of elbow-grease, the thing that broke the camels back was
dune
files need to have their(package)
stanzas patched in rulesdune
files that exist statically. If the rules are generated, e.g. using an ML file either asdune
file or as generator that generatesdune.inc
-like files that need to contain references to packages, these generators would need to be patched which is not possible.As such, my suggestion is to implement this extension as part of Dune, which has all the information to subselect packages in a dune project already (with
-p
) so the extension is most likely rather limited in scope.The text was updated successfully, but these errors were encountered: