diff --git a/CHANGES.md b/CHANGES.md index d4aabb2f1dd..93555786c66 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +Unreleased +---------- + +- No longer emit linkopts(javascript) in META files (#8168, @hhugo) + 3.10.0 (2023-07-31) ------------------- diff --git a/src/dune_rules/gen_meta.ml b/src/dune_rules/gen_meta.ml index 3f4a296a759..f02946e37d3 100644 --- a/src/dune_rules/gen_meta.ml +++ b/src/dune_rules/gen_meta.ml @@ -20,10 +20,6 @@ module Pub_name = struct let pkg, xs = Lib_name.split s in of_list (Package.Name.to_string pkg :: xs) - let rec root = function - | Dot (t, _) -> root t - | Id n -> n - let to_list = let rec loop acc = function | Dot (t, n) -> loop (n :: acc) t @@ -64,7 +60,7 @@ let archives ?(preds = []) lib = ; plugin (preds @ [ Pos "native" ]) (make plugins.native) ] -let gen_lib pub_name lib ~path ~version = +let gen_lib pub_name lib ~version = let open Memo.O in let info = Lib.info lib in let synopsis = Lib_info.synopsis info in @@ -161,14 +157,8 @@ let gen_lib pub_name lib ~path ~version = ; (match Lib_info.jsoo_runtime info with | [] -> [] | l -> - 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" (String.concat ~sep:"/" (root :: path))) - |> String.concat ~sep:" ") - ; rule "jsoo_runtime" [] Set (String.concat l ~sep:" ") - ]) + [ rule "jsoo_runtime" [] Set (String.concat l ~sep:" ") ]) ] let gen ~(package : Package.t) ~add_directory_entry entries = @@ -190,7 +180,7 @@ let gen ~(package : Package.t) ~add_directory_entry entries = match Pub_name.to_list pub_name with | [] -> assert false | package :: path -> - let pub_name, path = + let pub_name = match Lib_info.status info with | Private (_, None) -> (* Not possible b/c we wouldn't be generating a META file for a @@ -206,12 +196,10 @@ let gen ~(package : Package.t) ~add_directory_entry entries = let name = Package.name pkg in Pub_name.of_list (Package.Name.to_string name :: path) in - (pub_name, path) - | _ -> (pub_name, path) - in - let+ entries = - gen_lib pub_name ~path (Lib.Local.to_lib lib) ~version + pub_name + | _ -> pub_name in + let+ entries = gen_lib pub_name (Lib.Local.to_lib lib) ~version in (pub_name, entries)) | Deprecated_library_name { old_name = old_public_name, _ diff --git a/test/blackbox-tests/test-cases/meta-gen.t/run.t b/test/blackbox-tests/test-cases/meta-gen.t/run.t index 648815004fa..8a939042406 100644 --- a/test/blackbox-tests/test-cases/meta-gen.t/run.t +++ b/test/blackbox-tests/test-cases/meta-gen.t/run.t @@ -60,8 +60,6 @@ archive(native) = "foobar_runtime_lib2.cmxa" plugin(byte) = "foobar_runtime_lib2.cma" plugin(native) = "foobar_runtime_lib2.cmxs" - linkopts(javascript) = "+foobar/runtime-lib2/foobar_runtime.js - +foobar/runtime-lib2/foobar_runtime2.js" jsoo_runtime = "foobar_runtime.js foobar_runtime2.js" ) package "sub" (