Skip to content

Commit

Permalink
Fix META generation wrt javascript deps
Browse files Browse the repository at this point in the history
Signed-off-by: Hugo Heuzard <hugo.heuzard@gmail.com>
  • Loading branch information
hhugo committed May 3, 2020
1 parent 77ed8ab commit 7a69650
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/dune/gen_meta.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let archives ?(preds = []) lib =
; plugin (preds @ [ Pos "native" ]) (make plugins.native)
]

let gen_lib pub_name lib ~version =
let gen_lib pub_name lib ~path ~version =
let info = Lib.info lib in
let synopsis = Lib_info.synopsis info in
let kind = Lib_info.kind info in
Expand Down Expand Up @@ -139,7 +139,7 @@ let gen_lib pub_name lib ~version =
let root = Pub_name.root pub_name in
let l = List.map l ~f:Path.basename in
[ rule "linkopts" [ Pos "javascript" ] Set
(List.map l ~f:(sprintf "+%s/%s" root) |> String.concat ~sep:" ")
(List.map l ~f:(sprintf "+%s/%s" (String.concat ~sep:"/" (root :: path))) |> String.concat ~sep:" ")
; rule "jsoo_runtime" [] Set (String.concat l ~sep:" ")
] )
]
Expand All @@ -153,10 +153,13 @@ let gen ~package ~version ?(add_directory_entry = true) entries =
let pkgs =
List.map entries ~f:(fun (e : Super_context.Lib_entry.t) ->
match e with
| Library lib ->
| Library lib -> (
let name = Lib.Local.info lib |> Lib_info.name in
let pub_name = Pub_name.parse name in
(pub_name, gen_lib pub_name (Lib.Local.to_lib lib) ~version)
(match Pub_name.to_list pub_name with
| [] -> assert false
| _package :: path ->
(pub_name, gen_lib pub_name ~path (Lib.Local.to_lib lib) ~version)))
| Deprecated_library_name
{ old_public_name = { public = old_public_name; _ }
; new_public_name = _, new_public_name
Expand Down
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/meta-gen/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
archive(native) = "foobar_runtime_lib2.cmxa"
plugin(byte) = "foobar_runtime_lib2.cma"
plugin(native) = "foobar_runtime_lib2.cmxs"
linkopts(javascript) = "+foobar/foobar_runtime.js
+foobar/foobar_runtime2.js"
linkopts(javascript) = "+foobar/runtime-lib2/foobar_runtime.js
+foobar/runtime-lib2/foobar_runtime2.js"
jsoo_runtime = "foobar_runtime.js foobar_runtime2.js"
)
package "sub" (
Expand Down

0 comments on commit 7a69650

Please sign in to comment.