Skip to content

Commit f8114a9

Browse files
Move to _build/dev-tools.locks
Signed-off-by: Marek Kubica <[email protected]>
1 parent d4ddf5b commit f8114a9

27 files changed

+45
-38
lines changed

src/dune_pkg/lock_dir.ml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,10 +1781,15 @@ let merge_conditionals a b =
17811781
let loc_in_source_tree loc =
17821782
loc
17831783
|> Loc.map_pos ~f:(fun ({ pos_fname; _ } as pos) ->
1784-
let path = Path.of_string pos_fname in
1785-
let new_path = in_source_tree path in
1786-
let pos_fname = Path.Source.to_string new_path in
1787-
{ pos with pos_fname })
1784+
(* we're excluding the hidden dev-tools.locks folders in the build folder
1785+
from rewriting *)
1786+
match String.starts_with ~prefix:"_build/dev-tools.locks/" pos_fname with
1787+
| true -> pos
1788+
| false ->
1789+
let path = Path.of_string pos_fname in
1790+
let new_path = in_source_tree path in
1791+
let pos_fname = Path.Source.to_string new_path in
1792+
{ pos with pos_fname })
17881793
;;
17891794

17901795
let check_if_solved_for_platform { solved_for_platforms; _ } ~platform =

src/dune_rules/lock_dir.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ let dev_tool_to_path_segment dev_tool =
148148
;;
149149

150150
let dev_tool_source_lock_dir dev_tool =
151-
let dev_tools_path = Path.Source.(relative root ".dev-tools.locks") in
151+
let dev_tools_path =
152+
Path.Source.L.relative Path.Source.root [ "_build"; "dev-tools.locks" ]
153+
in
152154
let dev_tool_segment = dev_tool_to_path_segment dev_tool in
153155
Path.Source.append_local dev_tools_path dev_tool_segment
154156
;;

src/dune_rules/pkg_rules.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ end = struct
15341534
[ "dir", Path.External.to_dyn e ]
15351535
| In_source_tree s ->
15361536
(match Path.Source.explode s with
1537-
| [ ".dev-tools.locks"; dev_tool; files_dir ] ->
1537+
| [ "_build"; "dev-tools.locks"; dev_tool; files_dir ] ->
15381538
Path.Build.L.relative
15391539
Private_context.t.build_dir
15401540
[ "default"; ".dev-tool-locks"; dev_tool; files_dir ]

test/blackbox-tests/test-cases/pkg/ocamlformat/gh10991.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Initial file:
1919
let () = print_endline "Hello, world"
2020

2121
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt
22-
Solution for .dev-tools.locks/ocamlformat:
22+
Solution for _build/dev-tools.locks/ocamlformat:
2323
- ocamlformat.0.0.1
2424
File "foo.ml", line 1, characters 0-0:
2525
Error: Files _build/default/foo.ml and _build/default/.formatted/foo.ml

test/blackbox-tests/test-cases/pkg/ocamlformat/gh11037.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ attempt to build the package "foo".
4040
$ cat foo.ml
4141
let () = print_endline "Hello, world"
4242
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt
43-
Solution for .dev-tools.locks/ocamlformat:
43+
Solution for _build/dev-tools.locks/ocamlformat:
4444
- ocamlformat.0.0.1
4545
File "foo.ml", line 1, characters 0-0:
4646
Error: Files _build/default/foo.ml and _build/default/.formatted/foo.ml

test/blackbox-tests/test-cases/pkg/ocamlformat/helpers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
. ../helpers.sh
22

3-
dev_tool_lock_dir=".dev-tools.locks/ocamlformat"
3+
dev_tool_lock_dir="_build/dev-tools.locks/ocamlformat"
44

55
make_fake_ocamlformat() {
66
version=$1

test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-avoid-conflict-with-project.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Add a fake executable in the PATH
2929

3030
Build the OCamlFormat binary dev-tool
3131
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt --preview
32-
Solution for .dev-tools.locks/ocamlformat:
32+
Solution for _build/dev-tools.locks/ocamlformat:
3333
- ocamlformat.0.26.2
3434
File "dune", line 1, characters 0-0:
3535
Error: Files _build/default/dune and _build/default/.formatted/dune differ.

test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-avoid-taking-from-project-deps.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Format using the dev-tools feature, it does not invoke the OCamlFormat binary fr
4545
the project dependencies (0.26.2) but instead builds and runs the OCamlFormat binary as a
4646
dev-tool (0.26.3).
4747
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt
48-
Solution for .dev-tools.locks/ocamlformat:
48+
Solution for _build/dev-tools.locks/ocamlformat:
4949
- ocamlformat.0.26.3
5050
File "foo.ml", line 1, characters 0-0:
5151
Error: Files _build/default/foo.ml and _build/default/.formatted/foo.ml

test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-deps-conflict-project-deps.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ It shows that the project uses printer.2.0
9494
Format foo.ml, "dune fmt" uses printer.1.0 instead. There is no conflict with different
9595
versions of the same dependency.
9696
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt --preview
97-
Solution for .dev-tools.locks/ocamlformat:
97+
Solution for _build/dev-tools.locks/ocamlformat:
9898
- ocamlformat.0.26.2
9999
- printer.1.0
100100
File "foo.ml", line 1, characters 0-0:

test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-fails-to-build.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Make dune-project that uses the mocked dev-tool opam-reposiotry.
1313

1414
It fails during the build because of missing OCamlFormat module.
1515
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt
16-
Solution for .dev-tools.locks/ocamlformat:
16+
Solution for _build/dev-tools.locks/ocamlformat:
1717
- ocamlformat.0.26.4
1818
File "dev-tools.locks/ocamlformat/ocamlformat.pkg", line 4, characters 6-10:
1919
4 | (run dune build -p %{pkg-self:name} @install))

0 commit comments

Comments
 (0)