diff options
author | Nicolas Pouillard <np@nicolaspouillard.fr> | 2007-12-18 08:57:36 +0000 |
---|---|---|
committer | Nicolas Pouillard <np@nicolaspouillard.fr> | 2007-12-18 08:57:36 +0000 |
commit | c0b37df251b286234522123d356d089da68ce8af (patch) | |
tree | f8d645e90f64e767e36aaccd561429dfc780c893 | |
parent | 7779f740c4042a1ca87912f25fb425ab11ad105d (diff) |
ocamlbuild: extract exists_in_source_dir from import_in_build_dir.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8716 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | ocamlbuild/resource.ml | 27 | ||||
-rw-r--r-- | ocamlbuild/resource.mli | 2 | ||||
-rw-r--r-- | ocamlbuild/solver.ml | 3 |
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 |