Skip to content

refactor: move modules: Modules.t from Dune_package.Lib to Lib_info#6605

Merged
rgrinberg merged 3 commits intoocaml:mainfrom
anmonteiro:anmonteiro/modules-in-lib-info
Nov 30, 2022
Merged

refactor: move modules: Modules.t from Dune_package.Lib to Lib_info#6605
rgrinberg merged 3 commits intoocaml:mainfrom
anmonteiro:anmonteiro/modules-in-lib-info

Conversation

@anmonteiro
Copy link
Copy Markdown
Collaborator

Signed-off-by: Antonio Nuno Monteiro anmonteiro@gmail.com

@anmonteiro anmonteiro marked this pull request as ready for review November 30, 2022 05:49
~modules
in
Dune_package.Lib.of_dune_lib ~info ~modules ~main_module_name
Dune_package.Lib.of_dune_lib ~info ~main_module_name
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

callout: in this function to_dune_lib, we get ~modules as an argument and ignore modules from info.

I suspect it's correct, since info.modules will always probably be Local, but wanted to call out anyway.

@anmonteiro anmonteiro changed the title chore: move modules: Modules.t from Dune_package.Lib to Lib_info refactor: move modules: Modules.t from Dune_package.Lib to Lib_info Nov 30, 2022
match Lib_info.modules info with
| External modules -> Memo.return (Some modules)
| Local -> (
match Path.as_in_build_dir dir with
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

should I be using Path.as_in_build_dir_exn here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good question. The answer is no because it will fail for findlib libraries. We need to improve the types per my comment #6605 (comment) or Ali's suggestion #6605 (comment)


val modes : _ t -> Lib_mode.Map.Set.t

val modules : _ t -> Modules.t Source.t
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, this type isn't quite correct actually. it should really be:

type t =
  | Local
  | Unavailable
  | Present of Modules.t

Since findlib modules do not have this information.

@Alizter
Copy link
Copy Markdown
Collaborator

Alizter commented Nov 30, 2022

I have a similar change in #6489, there I chose: Modules.t option Source.t.

@anmonteiro
Copy link
Copy Markdown
Collaborator Author

Pushed a1f0b46 changing to Modules.t option Source.t as in #6489.

Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
@anmonteiro anmonteiro force-pushed the anmonteiro/modules-in-lib-info branch from a1f0b46 to a8c22c7 Compare November 30, 2022 17:16
anmonteiro and others added 2 commits November 30, 2022 11:15
_
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
@rgrinberg
Copy link
Copy Markdown
Member

Now we can use Path.as_in_build_dir_exn

@rgrinberg rgrinberg merged commit 4a1da01 into ocaml:main Nov 30, 2022
@anmonteiro anmonteiro deleted the anmonteiro/modules-in-lib-info branch November 30, 2022 19:30
moyodiallo pushed a commit to moyodiallo/dune that referenced this pull request Dec 2, 2022
…nfo` (ocaml#6605)

Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
jchavarri added a commit to jchavarri/dune that referenced this pull request Dec 5, 2022
* main: (54 commits)
  doc: how we write `to_dyn` and `equal` (ocaml#6621)
  test(cache): test output of man pages
  test: dune utop for (subdir ..) (ocaml#6629)
  refactor: improve style of utop rules (ocaml#6628)
  test: depend on utop (ocaml#6627)
  refactor(stdune): Add Appendable_list.cons (ocaml#6624)
  doc: tighten wording in README.md
  test: add a repro case for ocaml#6607 (ocaml#6612)
  doc: cleanup status badges in README.md (ocaml#6618)
  doc(README): rewrap paragraphs and cleanup links
  coq: more resilient config query
  fix: link time code gen (ocaml#6606)
  fix(melange): run melc ppx with merlin (ocaml#6476)
  feature(melange): add compile_flags (ocaml#6569)
  refactor: move `modules: Modules.t` from `Dune_package.Lib` to `Lib_info` (ocaml#6605)
  Set CLICOLOR_FORCE=0 (ocaml#6608)
  fix: declare deps for ccomp detection (ocaml#6610)
  refactor: assume Cmdliner.Arg.conv is abstract (ocaml#6609)
  refactor: gen_rules pattern matching (ocaml#6604)
  Add CI for MSVC using dkml-workflows (ocaml#6540)
  ...
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.

3 participants