Don't delete targets before executing a rule
At the moment, this breaks incremental builds
This commit is contained in:
parent
292f423cda
commit
95eca26bf0
|
@ -246,7 +246,7 @@ let refresh_targets_timestamps_after_rule_execution t targets =
|
||||||
| exception _ -> Pset.add fn acc
|
| exception _ -> Pset.add fn acc
|
||||||
| stat ->
|
| stat ->
|
||||||
let ts = stat.st_mtime in
|
let ts = stat.st_mtime in
|
||||||
Hashtbl.add t.timestamps ~key:fn ~data:ts;
|
Hashtbl.replace t.timestamps ~key:fn ~data:ts;
|
||||||
acc)
|
acc)
|
||||||
in
|
in
|
||||||
if not (Pset.is_empty missing) then
|
if not (Pset.is_empty missing) then
|
||||||
|
@ -318,7 +318,15 @@ let compile_rule t ~all_targets_by_dir ?(allow_override=false) pre_rule =
|
||||||
acc || prev_hash <> hash)
|
acc || prev_hash <> hash)
|
||||||
in
|
in
|
||||||
if rule_changed || min_timestamp t targets < max_timestamp t all_deps then begin
|
if rule_changed || min_timestamp t targets < max_timestamp t all_deps then begin
|
||||||
List.iter targets ~f:Path.unlink_no_err;
|
(* CR-someday jdimino: we should remove the targets to be sure
|
||||||
|
the action re-generate them, however it breaks incrementality
|
||||||
|
regarding [Write_file ...] actions, since they end up
|
||||||
|
systematically re-creating the file:
|
||||||
|
|
||||||
|
{[
|
||||||
|
List.iter targets ~f:Path.unlink_no_err;
|
||||||
|
]}
|
||||||
|
*)
|
||||||
Action.exec action >>| fun () ->
|
Action.exec action >>| fun () ->
|
||||||
refresh_targets_timestamps_after_rule_execution t targets
|
refresh_targets_timestamps_after_rule_execution t targets
|
||||||
end else
|
end else
|
||||||
|
|
Loading…
Reference in New Issue