Skip to content

Commit 5b6ada9

Browse files
Do not assume build dir name
Signed-off-by: Marek Kubica <[email protected]>
1 parent 41b587f commit 5b6ada9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/dune_pkg/lock_dir.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,11 @@ let in_source_tree path =
526526
Path.Source.L.relative Path.Source.root components
527527
| source_components ->
528528
(match Path.Build.explode b with
529-
| ".dev-tools.locks" :: dev_tool :: components ->
530-
Path.Source.L.relative
531-
Path.Source.root
532-
([ "_build"; ".dev-tools.locks"; dev_tool ] @ components)
529+
| (".dev-tools.locks" as prefix) :: dev_tool :: components ->
530+
let build_as_source =
531+
Path.build_dir |> Path.to_string |> Path.Source.of_string
532+
in
533+
Path.Source.L.relative build_as_source (prefix :: dev_tool :: components)
533534
| build_components ->
534535
Code_error.raise
535536
"Unexpected location of lock directory in build directory"

src/dune_pkg/workspace.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ let dev_tool_path_to_source_dir path =
7979
[ "external", Path.External.to_dyn path ]
8080
| In_build_dir b ->
8181
(match Path.Build.explode b with
82-
| ".dev-tools.locks" :: dev_tool_name :: components ->
83-
Path.Source.L.relative
84-
Path.Source.root
85-
([ "_build"; ".dev-tools.locks"; dev_tool_name ] @ components)
82+
| (".dev-tools.locks" as prefix) :: dev_tool_name :: components ->
83+
let build_as_source = Path.build_dir |> Path.to_string |> Path.Source.of_string in
84+
Path.Source.L.relative build_as_source (prefix :: dev_tool_name :: components)
8685
| components ->
8786
Code_error.raise
8887
"Unexpected external path"

0 commit comments

Comments
 (0)