Skip to content
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

Introduce Local_package module #1554

Merged
merged 5 commits into from
Nov 20, 2018
Merged

Conversation

rgrinberg
Copy link
Member

This package is used to contain all the information required for installing a package.

The old code was overdoing the amount of package maps that it was using. The purpose of this new code is to address that issue. I didn't realize that this refactoring would take so long, so there are still some parts that I've left unfinished. I think it's already an improvement over what we've had before, but I'd like to get some suggestions from the other maintainers before committing more time to this.

@rgrinberg rgrinberg requested review from emillon and a user November 19, 2018 21:39
@rgrinberg rgrinberg force-pushed the installed-package branch 2 times, most recently from ea8cd7d to 1f8059a Compare November 20, 2018 04:46
@rgrinberg
Copy link
Member Author

I'm also planning on reversing the dependency on super_context and local_pacakge. This will be useful twofold:

  • it will allow me to move the version fetching to local_package
  • there's code in odoc that duplicates the mld fetching logic. we'll be able to get rid of it this way.

src/dir_with_dune.mli Outdated Show resolved Hide resolved
@ghost
Copy link

ghost commented Nov 20, 2018

I glanced over the PR and it looks good to me. As a rule of thumb, taking out chunks of code from big modules to put them into smaller logical units is generally a good idea.

This package is used to contain all the information required for installing a package

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
these two are almost the same

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
@rgrinberg rgrinberg merged commit 6f691df into ocaml:master Nov 20, 2018
@rgrinberg
Copy link
Member Author

I need this for other PR's, so I interpreted diml's comment as an approval as I've accepted the only suggestion. Feel free to make further suggestions/refactorings as this part of the code still needs a lot of work.

@@ -226,90 +223,41 @@ module Gen(P : Params) = struct
| Default -> true
| Opam _ -> false

let bin_entries, other_stanzas, install_paths_per_package =
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't read this PR in detail initially. This needed to be done at the toplevel of this module, in order for the rules producing symlinks in _build/install/default/bin to be setup ASAP. I can't find where this code was moved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. Where do we depend on the rules being setup before anything else?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Artifacts.create, we simply list _build/install/default/bin to find out the list of public binaries. This avoids duplicating the logic to interpret install stanzas. However, this requires the install rules to be setup at this point. The install rules for libraries requires to know the list of modules, which is done via Dir_contents which interprets stanza like rule or copy_files. Interpreting these stanzas requires expanding percent forms and so requires the Artifacts.t. Given that, the install rules for bin must be setup before anything else. We introduced this in #1354.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I remember now. It's quite unfortunate that this is a bit fragile. Do you have a test case for this as well, or shall I add one?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have one, adding one is a good idea.

rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Dec 5, 2018
CHANGES:

- Fix regression introduced by ocaml/dune#1554 reported in:
  ocaml/dune#734 (comment) (ocaml/dune#1612,
  @rgrinberg)

- Fix `dune external-lib-deps` when preprocessors are not installed
  (ocaml/dune#1607, @diml)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant