Permalink
Browse files

Avoid trying to solve deps that are not built anyway in deps.ml.

Ignore-this: e084b85d751ef63951b8a823cb39c00d

darcs-hash:20120510234155-a43a9-89c1ece42eb569447b4c0c34fc08e6586d4b4699
  • Loading branch information...
gildor478 committed May 10, 2012
1 parent 3c9c1e4 commit 58c41ac5b49d98328438bb2a600e4f3a33b9fb85
Showing with 35 additions and 27 deletions.
  1. +35 −27 deps.ml
View
62 deps.ml
@@ -3,6 +3,9 @@ module MapString = Map.Make(String)
module SetString = Set.Make(String)
open OASISTypes
+open BaseEnv
+
+let generated_fn = OASISHostPath.of_unix "src/cli/PluginsLoaded.ml"
let post_configure pkg =
(* Compute build depends *)
@@ -14,31 +17,33 @@ let post_configure pkg =
List.fold_left
(fun (mp_int, set_ext) ->
function
- | Library (cs, bs, lib) ->
- let deps, set_ext =
- List.fold_left
- (fun (deps, set_ext) sct ->
- let deps =
- match sct with
- | InternalLibrary nm ->
- SetString.add (findlib_of_name nm) deps
- | FindlibPackage (fndlb_pkg, _) ->
- SetString.add fndlb_pkg deps
- in
- let set_ext =
- match sct with
- | InternalLibrary _ ->
- set_ext
- | FindlibPackage (fndlb_pkg, _) ->
- SetString.add fndlb_pkg set_ext
- in
- deps, set_ext)
- (SetString.empty, set_ext)
- bs.bs_build_depends
- in
- MapString.add (findlib_of_name cs.cs_name) deps mp_int,
- set_ext
- | Executable (cs, bs, exec) ->
+ | Library (cs, bs, lib) when var_choose bs.bs_build ->
+ begin
+ let deps, set_ext =
+ List.fold_left
+ (fun (deps, set_ext) sct ->
+ let deps =
+ match sct with
+ | InternalLibrary nm ->
+ SetString.add (findlib_of_name nm) deps
+ | FindlibPackage (fndlb_pkg, _) ->
+ SetString.add fndlb_pkg deps
+ in
+ let set_ext =
+ match sct with
+ | InternalLibrary _ ->
+ set_ext
+ | FindlibPackage (fndlb_pkg, _) ->
+ SetString.add fndlb_pkg set_ext
+ in
+ deps, set_ext)
+ (SetString.empty, set_ext)
+ bs.bs_build_depends
+ in
+ MapString.add (findlib_of_name cs.cs_name) deps mp_int,
+ set_ext
+ end
+ | Executable (cs, bs, exec) when var_choose bs.bs_build ->
let set_ext =
List.fold_left
(fun set_ext ->
@@ -84,7 +89,7 @@ let post_configure pkg =
else
visited
in
- let chn = open_out "src/cli/PluginsLoaded.ml" in
+ let chn = open_out generated_fn in
List.iter
(function
| Executable (cs, bs, _) ->
@@ -113,6 +118,9 @@ let setup_t =
BaseSetup.configure =
(fun pkg args ->
setup_t.BaseSetup.configure pkg args;
- post_configure pkg)}
+ post_configure pkg);
+ BaseSetup.distclean =
+ (fun pkg args -> Sys.remove generated_fn)
+ :: setup_t.BaseSetup.distclean}
let setup () = BaseSetup.setup setup_t;;

0 comments on commit 58c41ac

Please sign in to comment.