From cac1dc0e3e36e66db467dd90a8c20643e35c20cd Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Mon, 6 Mar 2017 15:14:57 +0000 Subject: [PATCH] fixes --- src/build.ml | 5 ++++- src/build.mli | 2 +- src/gen_rules.ml | 12 ++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/build.ml b/src/build.ml index 761b788f..5790e3e8 100644 --- a/src/build.ml +++ b/src/build.ml @@ -104,7 +104,10 @@ let dyn_paths t = Dyn_paths t let contents p = Contents p let lines_of p = Lines_of p -let fail x = Fail x +let fail ?targets x = + match targets with + | None -> Fail x + | Some l -> Targets l >>> Fail x let files_recursively_in ~dir = let ctx_dir, src_dir = diff --git a/src/build.mli b/src/build.mli index 6a285216..396851be 100644 --- a/src/build.mli +++ b/src/build.mli @@ -47,7 +47,7 @@ val lines_of : Path.t -> ('a, string list) t (** Always fail when executed. We pass a function rather than an exception to get a proper backtrace *) -val fail : fail -> (_, _) t +val fail : ?targets:Path.t list -> fail -> (_, _) t module Prog_spec : sig type 'a t = diff --git a/src/gen_rules.ml b/src/gen_rules.ml index 11e8a01b..76bd144c 100644 --- a/src/gen_rules.ml +++ b/src/gen_rules.ml @@ -643,7 +643,7 @@ module Gen(P : Params) = struct >>> Build.action t ~dir ~targets | exception e -> - Build.fail { fail = fun () -> raise e } + Build.fail ~targets { fail = fun () -> raise e } in let build = Build.record_lib_deps ~dir ~kind:dep_kind @@ -799,7 +799,8 @@ module Gen(P : Params) = struct else []) ] - let target = String_with_vars.of_string "${@}" + let target_var = String_with_vars.of_string "${@}" + let root_var = String_with_vars.of_string "${ROOT}" (* Generate rules to build the .pp files and return a new module map where all filenames point to the .pp files *) @@ -816,8 +817,11 @@ module Gen(P : Params) = struct Build.path src >>> Action_interpret.run - (With_stdout_to (target, action)) - ~dir:ctx.build_dir + (With_stdout_to + (target_var, + Chdir (root_var, + action))) + ~dir ~dep_kind ~targets:[dst] ~deps:[Some src]))