Fix Super_context.expand_and_eval_set

It declared its own dependencies as action dependencies rather than
rule dependencies
This commit is contained in:
Jeremie Dimino 2017-05-16 12:19:18 +01:00
parent ecf9207830
commit f2a857f406
3 changed files with 20 additions and 10 deletions

View File

@ -131,6 +131,18 @@ let dyn_paths t = Dyn_paths t
let contents p = Contents p
let lines_of p = Lines_of p
let read_sexp p =
contents p
>>^ fun s ->
let lb = Lexing.from_string s in
lb.lex_curr_p <-
{ pos_fname = Path.to_string p
; pos_lnum = 1
; pos_bol = 0
; pos_cnum = 0
};
Sexp_lexer.single lb
let if_file_exists p ~then_ ~else_ =
If_file_exists (p, ref (Undecided (then_, else_)))

View File

@ -45,6 +45,9 @@ val dyn_paths : ('a, Path.t list) t -> ('a, 'a) t
val contents : Path.t -> ('a, string) t
val lines_of : Path.t -> ('a, string list) t
(** Load an S-expression from a file *)
val read_sexp : Path.t -> (unit, Sexp.Ast.t) t
(** Evaluates to [true] if the file is present on the file system or is the target of a
rule. *)
val file_exists : Path.t -> ('a, bool) t

View File

@ -720,13 +720,8 @@ let expand_and_eval_set ~dir set ~standard =
Build.return (Ordered_set_lang.eval_with_standard set ~standard)
| files ->
let paths = List.map files ~f:(Path.relative dir) in
Build.paths paths
>>>
Build.arr (fun () ->
let files_contents =
List.map2 files paths ~f:(fun fn path ->
(fn, Sexp_load.single (Path.to_string path)))
|> String_map.of_alist_exn
in
let set = Ordered_set_lang.Unexpanded.expand set ~files_contents in
Ordered_set_lang.eval_with_standard set ~standard)
Build.all (List.map paths ~f:Build.read_sexp)
>>^ fun sexps ->
let files_contents = List.combine files sexps |> String_map.of_alist_exn in
let set = Ordered_set_lang.Unexpanded.expand set ~files_contents in
Ordered_set_lang.eval_with_standard set ~standard