@@ -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
5750end
5851
5952let 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-
9354let promote_target_if_not_up_to_date ~src ~src_digest ~dst ~promote_source
9455 ~promote_until_clean =
9556 let open Fiber.O in
0 commit comments