summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ocamlbuild/resource.ml27
-rw-r--r--ocamlbuild/resource.mli2
-rw-r--r--ocamlbuild/solver.ml3
3 files changed, 15 insertions, 17 deletions
diff --git a/ocamlbuild/resource.ml b/ocamlbuild/resource.ml
index 26fb5ba83..7b8d51e31 100644
--- a/ocamlbuild/resource.ml
+++ b/ocamlbuild/resource.ml
@@ -166,21 +166,18 @@ module Cache = struct
let resource_failed r = (get r).built <- Bcannot_be_built
let import_in_build_dir r =
- if exists_in_source_dir r then begin
- let cache_entry = get r in
- let r_in_build_dir = in_build_dir r in
- let r_in_source_dir = in_source_dir r in
- if source_is_up_to_date r_in_source_dir r_in_build_dir then begin
- dprintf 5 "%a exists and up to date" print r;
- end else begin
- dprintf 5 "%a exists in source dir -> import it" print r;
- Shell.mkdir_p (Pathname.dirname r);
- Pathname.copy r_in_source_dir r_in_build_dir;
- cache_entry.changed <- Yes;
- end;
- cache_entry.built <- Bbuilt;
- true
- end else false
+ let cache_entry = get r in
+ let r_in_build_dir = in_build_dir r in
+ let r_in_source_dir = in_source_dir r in
+ if source_is_up_to_date r_in_source_dir r_in_build_dir then begin
+ dprintf 5 "%a exists and up to date" print r;
+ end else begin
+ dprintf 5 "%a exists in source dir -> import it" print r;
+ Shell.mkdir_p (Pathname.dirname r);
+ Pathname.copy r_in_source_dir r_in_build_dir;
+ cache_entry.changed <- Yes;
+ end;
+ cache_entry.built <- Bbuilt
let suspend_resource r cmd kont prods =
let cache_entry = get r in
diff --git a/ocamlbuild/resource.mli b/ocamlbuild/resource.mli
index 56157a67d..d34623bef 100644
--- a/ocamlbuild/resource.mli
+++ b/ocamlbuild/resource.mli
@@ -36,7 +36,7 @@ module Cache :
val resource_has_changed : t -> bool
val resource_built : t -> unit
val resource_failed : t -> unit
- val import_in_build_dir : t -> bool
+ val import_in_build_dir : t -> unit
val suspend_resource : t -> Command.t -> (unit -> unit) -> t list -> unit
val resume_resource : t -> unit
val resume_suspension : suspension -> unit
diff --git a/ocamlbuild/solver.ml b/ocamlbuild/solver.ml
index 11804a2ab..6e63d4499 100644
--- a/ocamlbuild/solver.ml
+++ b/ocamlbuild/solver.ml
@@ -46,7 +46,8 @@ let rec self depth on_the_go_orig target =
(dprintf 5 "%a was suspended -> resuming" Resource.print target;
Resource.Cache.resume_suspension s)
| Resource.Cache.Bnot_built_yet ->
- if Resource.Cache.import_in_build_dir target then ()
+ if Resource.exists_in_source_dir target then
+ Resource.Cache.import_in_build_dir target
else
(* FIXME tags of target
let tags = Configuration.tags_of_target target in