Skip to content

Commit 063172a

Browse files
committed
fix: remove .merlin handling from the engine
We haven't relied on .merlin files in the rules for over 2 years. It's OK to get rid of them now. Signed-off-by: Rudi Grinberg <[email protected]> <!-- ps-id: c07ac682-fad3-49b0-8b93-92dd0ef9e529 -->
1 parent 82c670e commit 063172a

File tree

3 files changed

+0
-48
lines changed

3 files changed

+0
-48
lines changed

src/dune_engine/load_rules.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,10 +753,6 @@ end = struct
753753
source_files_to_ignore
754754
|> Path.Source.Set.of_list
755755
in
756-
let source_files_to_ignore =
757-
Target_promotion.delete_stale_dot_merlin_file ~dir
758-
~source_files_to_ignore
759-
in
760756
Path.Source.Set.diff files source_files_to_ignore
761757
in
762758
let subdirs = String.Set.diff subdirs source_dirnames_to_ignore in

src/dune_engine/target_promotion.ml

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -41,55 +41,16 @@ module To_delete = struct
4141
if Path.Source.Set.mem db p then None
4242
else Some (Path.Source.Set.add db p))
4343

44-
let remove p =
45-
modify_db (fun db ->
46-
if Path.Source.Set.mem db p then Some (Path.Source.Set.remove db p)
47-
else None)
48-
4944
let dump () =
5045
if !needs_dumping && Path.build_dir_exists () then (
5146
needs_dumping := false;
5247
get_db () |> P.dump fn)
5348

54-
let mem p = Path.Source.Set.mem !(Lazy.force db) p
55-
5649
let () = Hooks.End_of_build.always dump
5750
end
5851

5952
let files_in_source_tree_to_delete () = To_delete.get_db ()
6053

61-
(* TODO: Delete this step after users of Dune <2.8 are sufficiently rare. This
62-
step is sketchy because it's using the [To_delete] database and that can get
63-
out of date (see a comment on [To_delete]), so we should not widen the scope
64-
of it too much. *)
65-
let delete_stale_dot_merlin_file ~dir ~source_files_to_ignore =
66-
(* If a [.merlin] file is present in the [To_delete] set but not in the
67-
[Source_files_to_ignore] that means the rule that ordered its promotion is
68-
no more valid. This would happen when upgrading to Dune 2.8 from earlier
69-
version without and building uncleaned projects. We delete these leftover
70-
files here. *)
71-
let merlin_file = ".merlin" in
72-
let source_dir = Path.Build.drop_build_context_exn dir in
73-
let merlin_in_src = Path.Source.(relative source_dir merlin_file) in
74-
let source_files_to_ignore =
75-
if
76-
To_delete.mem merlin_in_src
77-
&& not (Path.Source.Set.mem source_files_to_ignore merlin_in_src)
78-
then (
79-
Log.info
80-
[ Pp.textf "Deleting left-over Merlin file %s.\n"
81-
(Path.Source.to_string merlin_in_src)
82-
];
83-
(* We remove the file from the promoted database *)
84-
To_delete.remove merlin_in_src;
85-
Path.Source.unlink_no_err merlin_in_src;
86-
(* We need to keep ignoring the .merlin file for that build or Dune will
87-
attempt to copy it and fail because it has been deleted *)
88-
Path.Source.Set.add source_files_to_ignore merlin_in_src)
89-
else source_files_to_ignore
90-
in
91-
source_files_to_ignore
92-
9354
let promote_target_if_not_up_to_date ~src ~src_digest ~dst ~promote_source
9455
~promote_until_clean =
9556
let open Fiber.O in

src/dune_engine/target_promotion.mli

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,3 @@ val promote :
1818

1919
(** The set of files created in the source tree that need to be deleted. *)
2020
val files_in_source_tree_to_delete : unit -> Path.Source.Set.t
21-
22-
val delete_stale_dot_merlin_file :
23-
dir:Path.Build.t
24-
-> source_files_to_ignore:Path.Source.Set.t
25-
-> Path.Source.Set.t

0 commit comments

Comments
 (0)