Skip to content

Commit d4ddf5b

Browse files
Move dev-tool lock dirs into hidden folder
Signed-off-by: Marek Kubica <[email protected]>
1 parent b202280 commit d4ddf5b

26 files changed

+54
-47
lines changed

src/dune_rules/lock_dir.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ 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 = Path.Source.(relative root ".dev-tools.locks") in
152152
let dev_tool_segment = dev_tool_to_path_segment dev_tool in
153153
Path.Source.append_local dev_tools_path dev_tool_segment
154154
;;

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+
| [ ".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 .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 .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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
. ../helpers.sh
22

3+
dev_tool_lock_dir=".dev-tools.locks/ocamlformat"
4+
35
make_fake_ocamlformat() {
46
version=$1
57
if [ "$#" -eq "1" ]
@@ -97,7 +99,7 @@ EOF
9799
(lang dune 3.20)
98100
99101
(lock_dir
100-
(path "dev-tools.locks/ocamlformat")
102+
(path "${dev_tool_lock_dir}")
101103
(repositories mock))
102104
103105
(lock_dir

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 .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: 2 additions & 2 deletions
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 .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
@@ -59,7 +59,7 @@ Retry, without dev-tools feature and without cleaning. This time it uses the OCa
5959
binary from the project dependencies rather than the dev-tool. This exercises the
6060
behavior when OCamlFormat is installed simultaneously as both a dev-tool and as a
6161
regular package dependency.
62-
$ rm -rf dev-tools.locks/ocamlformat
62+
$ rm -r "${dev_tool_lock_dir}"
6363
$ dune fmt --preview
6464
File "foo.ml", line 1, characters 0-0:
6565
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 .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 .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))

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Make dune-project that uses the mocked dev-tool opam-reposiotry.
2525
Without a ".ocamlformat" file, "dune fmt" takes the latest version of
2626
OCamlFormat.
2727
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt --preview
28-
Solution for dev-tools.locks/ocamlformat:
28+
Solution for .dev-tools.locks/ocamlformat:
2929
- ocamlformat.0.26.3
3030
File "foo.ml", line 1, characters 0-0:
3131
Error: Files _build/default/foo.ml and _build/default/.formatted/foo.ml
@@ -40,13 +40,13 @@ Create .ocamlformat file
4040
> EOF
4141

4242
An important cleaning here, "dune fmt" will relock and build the new version(0.26.2) of OCamlFormat.
43-
$ rm -r dev-tools.locks/ocamlformat
43+
$ rm -r "${dev_tool_lock_dir}"
4444
$ dune clean
4545

4646
With a ".ocamlformat" file, "dune fmt" takes the version mentioned inside ".ocamlformat"
4747
file.
4848
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt --preview
49-
Solution for dev-tools.locks/ocamlformat:
49+
Solution for .dev-tools.locks/ocamlformat:
5050
- ocamlformat.0.26.2
5151
File "foo.ml", line 1, characters 0-0:
5252
Error: Files _build/default/foo.ml and _build/default/.formatted/foo.ml
@@ -64,10 +64,11 @@ Formating a second time would not trigger the lock/solve.
6464
$ cat _build/default/.formatted/foo.ml
6565
formatted with version 0.26.2
6666

67-
When "dev-tools.locks" is removed, the solving/lock is renewed
68-
$ rm -r dev-tools.locks/ocamlformat
67+
When the lock dir is removed, the solving/lock is renewed:
68+
69+
$ rm -r "${dev_tool_lock_dir}"
6970
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt --preview
70-
Solution for dev-tools.locks/ocamlformat:
71+
Solution for .dev-tools.locks/ocamlformat:
7172
- ocamlformat.0.26.2
7273
File "foo.ml", line 1, characters 0-0:
7374
Error: Files _build/default/foo.ml and _build/default/.formatted/foo.ml

0 commit comments

Comments
 (0)