Skip to content

Commit

Permalink
Fix META generation for private libs.
Browse files Browse the repository at this point in the history
Signed-off-by: Romain Beauxis <[email protected]>
  • Loading branch information
toots committed Aug 2, 2021
1 parent d1e683b commit d9fd758
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased
----------

- Fixes `opam` META file requires entry for private libs (#4841, fixes #4839, @toots)

- Fixes `dune exec` not adding .exe on Windows (#4371, fixes #3322, @MisterDA)

- Allow multiple cinaps stanzas in the same directory (#4460, @rgrinberg)
Expand Down
9 changes: 8 additions & 1 deletion src/dune_rules/gen_meta.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ let gen_lib pub_name lib ~path ~version =
| Ppx_deriver _ ->
[ Pos "ppx_driver" ]
in
let to_names = Lib_name.Set.of_list_map ~f:Lib.name in
let name lib =
let name = Lib.name lib in
match Lib_info.status (Lib.info lib) with
| Private (_, Some pkg) ->
Lib_name.mangled (Package.name pkg) (Lib_name.to_local_exn name)
| _ -> name
in
let to_names = Lib_name.Set.of_list_map ~f:name in
let* lib_deps = Resolve.read_memo_build (Lib.requires lib) >>| to_names in
let* ppx_rt_deps =
Resolve.read_memo_build (Lib.ppx_runtime_deps lib) >>| to_names
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/private-package-lib.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Note the name mangling convention in the META file:
package "bar" (
directory = "bar"
description = ""
requires = "secret"
requires = "foo.__private__.secret"
archive(byte) = "foo.cma"
archive(native) = "foo.cmxa"
plugin(byte) = "foo.cma"
Expand Down

0 comments on commit d9fd758

Please sign in to comment.