From 5c967b158fe7b43e4386a9bc1c54a450dcfd7417 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Sat, 25 Feb 2023 18:23:33 -0800 Subject: [PATCH] fix: always start from lib_subdir when installing module sources Signed-off-by: Antonio Nuno Monteiro --- src/dune_rules/install_rules.ml | 9 +++++++++ .../test-cases/install/dune-package-source-path.t | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/dune_rules/install_rules.ml b/src/dune_rules/install_rules.ml index 3fee9c9cd8e..aee581eb059 100644 --- a/src/dune_rules/install_rules.ml +++ b/src/dune_rules/install_rules.ml @@ -155,6 +155,15 @@ end = struct in (sub_dir, dst) in + let sub_dir = + match sub_dir with + | None -> lib_subdir + | Some subdir -> + Some + (match lib_subdir with + | None -> subdir + | Some lib_subdir -> Filename.concat lib_subdir subdir) + in make_entry ?sub_dir Lib source ?dst)) in let { Lib_config.has_native; ext_obj; _ } = lib_config in diff --git a/test/blackbox-tests/test-cases/install/dune-package-source-path.t b/test/blackbox-tests/test-cases/install/dune-package-source-path.t index 88db5067c1d..15f9109bac3 100644 --- a/test/blackbox-tests/test-cases/install/dune-package-source-path.t +++ b/test/blackbox-tests/test-cases/install/dune-package-source-path.t @@ -70,8 +70,6 @@ Test paths on public libraries with `.` are correct $ cat b/_build/default/b.install lib: [ "_build/install/default/lib/b/META" - "_build/install/default/lib/b/child/bar.ml" {"child/bar.ml"} - "_build/install/default/lib/b/child/child.ml" {"child/child.ml"} "_build/install/default/lib/b/dune-package" "_build/install/default/lib/b/sub/b.a" {"sub/b.a"} "_build/install/default/lib/b/sub/b.cma" {"sub/b.cma"} @@ -89,6 +87,8 @@ Test paths on public libraries with `.` are correct "_build/install/default/lib/b/sub/b__Foo.cmi" {"sub/b__Foo.cmi"} "_build/install/default/lib/b/sub/b__Foo.cmt" {"sub/b__Foo.cmt"} "_build/install/default/lib/b/sub/b__Foo.cmx" {"sub/b__Foo.cmx"} + "_build/install/default/lib/b/sub/child/bar.ml" {"sub/child/bar.ml"} + "_build/install/default/lib/b/sub/child/child.ml" {"sub/child/child.ml"} "_build/install/default/lib/b/sub/foo.ml" {"sub/foo.ml"} ] libexec: [