diff --git a/bin/main.ml b/bin/main.ml index 7e5d872b..07c9479f 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -804,7 +804,7 @@ let clean = begin set_common common ~targets:[]; Build_system.files_in_source_tree_to_delete () - |> List.iter ~f:Path.unlink_no_err; + |> Path.Set.iter ~f:Path.unlink_no_err; Path.rm_rf Path.build_dir end in diff --git a/src/build_system.ml b/src/build_system.ml index 6950811d..edceb4c2 100644 --- a/src/build_system.ml +++ b/src/build_system.ml @@ -11,25 +11,24 @@ let misc_dir = Path.(relative build_dir) ".misc" module Promoted_to_delete = struct module P = Utils.Persistent(struct - type t = Path.t list + type t = Path.Set.t let name = "PROMOTED-TO-DELETE" let version = 1 end) - let db = ref [] + + let db = ref Path.Set.empty let fn = Path.relative Path.build_dir ".to-delete-in-source-tree" - let add p = db := p :: !db + let add p = db := Path.Set.add !db p let load () = - Option.value ~default:[] (P.load fn) + Option.value ~default:Path.Set.empty (P.load fn) let dump () = if Path.build_dir_exists () then load () - |> Path.Set.of_list - |> Path.Set.union (Path.Set.of_list !db) - |> Path.Set.to_list + |> Path.Set.union !db |> P.dump fn end diff --git a/src/build_system.mli b/src/build_system.mli index 4abbcd2b..631122ee 100644 --- a/src/build_system.mli +++ b/src/build_system.mli @@ -204,11 +204,11 @@ val all_lib_deps_by_context (** List of all buildable targets *) val all_targets : t -> Path.t list -(** Return the list of files that were created in the source tree and +(** Return the set of files that were created in the source tree and needs to be deleted *) val files_in_source_tree_to_delete : unit - -> Path.t list + -> Path.Set.t (** {2 Build rules} *)