Make promoted files a set
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
2a80d034fa
commit
4738b6df89
|
@ -804,7 +804,7 @@ let clean =
|
||||||
begin
|
begin
|
||||||
set_common common ~targets:[];
|
set_common common ~targets:[];
|
||||||
Build_system.files_in_source_tree_to_delete ()
|
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
|
Path.rm_rf Path.build_dir
|
||||||
end
|
end
|
||||||
in
|
in
|
||||||
|
|
|
@ -11,25 +11,24 @@ let misc_dir = Path.(relative build_dir) ".misc"
|
||||||
|
|
||||||
module Promoted_to_delete = struct
|
module Promoted_to_delete = struct
|
||||||
module P = Utils.Persistent(struct
|
module P = Utils.Persistent(struct
|
||||||
type t = Path.t list
|
type t = Path.Set.t
|
||||||
let name = "PROMOTED-TO-DELETE"
|
let name = "PROMOTED-TO-DELETE"
|
||||||
let version = 1
|
let version = 1
|
||||||
end)
|
end)
|
||||||
let db = ref []
|
|
||||||
|
let db = ref Path.Set.empty
|
||||||
|
|
||||||
let fn = Path.relative Path.build_dir ".to-delete-in-source-tree"
|
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 () =
|
let load () =
|
||||||
Option.value ~default:[] (P.load fn)
|
Option.value ~default:Path.Set.empty (P.load fn)
|
||||||
|
|
||||||
let dump () =
|
let dump () =
|
||||||
if Path.build_dir_exists () then
|
if Path.build_dir_exists () then
|
||||||
load ()
|
load ()
|
||||||
|> Path.Set.of_list
|
|> Path.Set.union !db
|
||||||
|> Path.Set.union (Path.Set.of_list !db)
|
|
||||||
|> Path.Set.to_list
|
|
||||||
|> P.dump fn
|
|> P.dump fn
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -204,11 +204,11 @@ val all_lib_deps_by_context
|
||||||
(** List of all buildable targets *)
|
(** List of all buildable targets *)
|
||||||
val all_targets : t -> Path.t list
|
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 *)
|
needs to be deleted *)
|
||||||
val files_in_source_tree_to_delete
|
val files_in_source_tree_to_delete
|
||||||
: unit
|
: unit
|
||||||
-> Path.t list
|
-> Path.Set.t
|
||||||
|
|
||||||
(** {2 Build rules} *)
|
(** {2 Build rules} *)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue