This commit is contained in:
Jeremie Dimino 2018-05-09 16:18:18 +01:00
parent 4ffa88726a
commit 7c1e1923a0
3 changed files with 57 additions and 45 deletions

View File

@ -31,6 +31,9 @@ next
- Display a better error messages when writing `(inline_tests)` in an
executable stanza (#748, @diml)
- Restore promoted files when they are deleted or changed in the
source tree (#760, fix #759, @diml)
1.0+beta20 (10/04/2018)
-----------------------

View File

@ -753,6 +753,7 @@ let rec compile_rule t ?(copy_source=false) pre_rule =
!Clflags.force &&
List.exists targets_as_list ~f:Path.is_alias_stamp_file
in
begin
if deps_or_rule_changed || targets_missing || force then begin
List.iter targets_as_list ~f:Path.unlink_no_err;
pending_targets := Pset.union targets !pending_targets;
@ -781,20 +782,25 @@ let rec compile_rule t ?(copy_source=false) pre_rule =
Option.iter sandbox_dir ~f:Path.rm_rf;
(* All went well, these targets are no longer pending *)
pending_targets := Pset.diff !pending_targets targets;
clear_targets_digests_after_rule_execution targets_as_list;
(match mode with
clear_targets_digests_after_rule_execution targets_as_list
end else
Fiber.return ()
end >>| fun () ->
begin
match mode with
| Standard | Fallback | Not_a_rule_stanza | Ignore_source_files -> ()
| Promote | Promote_but_delete_on_clean ->
Pset.iter targets ~f:(fun path ->
let in_source_tree = Option.value_exn (Path.drop_build_context path) in
if not (Path.exists in_source_tree) ||
(Utils.Cached_digest.file path <>
Utils.Cached_digest.file in_source_tree) then begin
if mode = Promote_but_delete_on_clean then
Promoted_to_delete.add in_source_tree;
Io.copy_file ~src:path ~dst:in_source_tree));
Io.copy_file ~src:path ~dst:in_source_tree
end)
end;
t.hook Rule_completed
end else begin
t.hook Rule_completed;
Fiber.return ()
end
in
let rule =
{ Internal_rule.

View File

@ -6,9 +6,12 @@
$ rm -f .merlin
$ jbuilder build foo.cma
$ cat .merlin
cat: .merlin: No such file or directory
[1]
B _build/default/.foo.objs
FLG -open Foo -w -40
S .
$ echo toto > .merlin
$ jbuilder build foo.cma
$ cat .merlin
toto
B _build/default/.foo.objs
FLG -open Foo -w -40
S .