Skip to content

Commit ec2b509

Browse files
Make detection of dev tool lock dirs untracked
Signed-off-by: Marek Kubica <[email protected]>
1 parent f8114a9 commit ec2b509

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/dune_rules/format_rules.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ end
3333

3434
module Ocamlformat = struct
3535
let dev_tool_lock_dir_exists () =
36-
let path = Lock_dir.dev_tool_source_lock_dir Ocamlformat in
37-
Source_tree.find_dir path >>| Option.is_some
36+
Ocamlformat
37+
|> Lock_dir.dev_tool_source_lock_dir
38+
|> Path.source
39+
|> Path.Untracked.exists
3840
;;
3941

4042
(* Config files for ocamlformat. When these are changed, running
@@ -129,7 +131,7 @@ let gen_rules_output
129131
let loc = Format_config.loc config in
130132
let dir = Path.Build.parent_exn output_dir in
131133
let alias_formatted = Alias.fmt ~dir:output_dir in
132-
let* ocamlformat_is_locked = Ocamlformat.dev_tool_lock_dir_exists () in
134+
let ocamlformat_is_locked = Ocamlformat.dev_tool_lock_dir_exists () in
133135
let setup_formatting file =
134136
(let input_basename = Path.Source.basename file in
135137
let input = Path.Build.relative dir input_basename in

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
@@ -15,7 +15,7 @@ It fails during the build because of missing OCamlFormat module.
1515
$ DUNE_CONFIG__LOCK_DEV_TOOL=enabled dune fmt
1616
Solution for _build/dev-tools.locks/ocamlformat:
1717
- ocamlformat.0.26.4
18-
File "dev-tools.locks/ocamlformat/ocamlformat.pkg", line 4, characters 6-10:
18+
File "_build/dev-tools.locks/ocamlformat/ocamlformat.pkg", line 4, characters 6-10:
1919
4 | (run dune build -p %{pkg-self:name} @install))
2020
^^^^
2121
Error: Logs for package ocamlformat

0 commit comments

Comments
 (0)