-
Notifications
You must be signed in to change notification settings - Fork 27
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
Rewrite unused package names #367
Rewrite unused package names #367
Conversation
84a7c83
to
a88183b
Compare
in | ||
Set.mem test_against keep | ||
|
||
let rename_library t ~keep renames stanzas = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One trick I recently learned is that you can patch the dune
file of a subdirectory without writing in that directory: you can mark that directory as data_only_dirs
and use (subdir)
to set the contents of the (virtual) dune file in there. I don't know if that applies to that case, but that can be useful if you don't want to change the contents of the unpacked tarball.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an interesting trick, but I can unfortunately see a number of problems with nested directories where I need to modify foo/dune
but there is a foo/bar/dune
that would has to stay the same (or be also moved up using subdir
).
Rewriting it this way I can't easily ignore dune
files in OCaml (and hoping they don't create issues). The cleanest way would probably be to collect all dune
stanzas and dump them into a top level dune
file but then I would also need to know which dune
-files are actually being evaluated (e.g. no point to collect dune
files from data_only_dirs
which might actually break the build if collected). I feel this is getting dangerously close to a half-baked implementation of the rule-discovery logic of Dune itself.
But this does point at the necessity of eventually implementing such a feature in Dune itself.
This is a bit better than the long tuple with somewhat unclear semantics.
This has the advantage that the rewriting step is reproducible.
39cb064
to
5c87fbc
Compare
This PR started small and then continued snowballing a little as it was growing.
What this does is when deduplication is disabled (opt-in) to determine which dependency should build which dune packages (by scanning OPAM files for
dune build -p <name>
), this info is saved into the lockfile.From there, when pulling, the it will process
dune
files and rename public names that are not to be built to avoid clashing.