Fix Super_context.expand_and_eval_set
It declared its own dependencies as action dependencies rather than rule dependencies
This commit is contained in:
parent
ecf9207830
commit
f2a857f406
12
src/build.ml
12
src/build.ml
|
@ -131,6 +131,18 @@ let dyn_paths t = Dyn_paths t
|
||||||
let contents p = Contents p
|
let contents p = Contents p
|
||||||
let lines_of p = Lines_of 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_ =
|
let if_file_exists p ~then_ ~else_ =
|
||||||
If_file_exists (p, ref (Undecided (then_, else_)))
|
If_file_exists (p, ref (Undecided (then_, else_)))
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,9 @@ val dyn_paths : ('a, Path.t list) t -> ('a, 'a) t
|
||||||
val contents : Path.t -> ('a, string) t
|
val contents : Path.t -> ('a, string) t
|
||||||
val lines_of : Path.t -> ('a, string list) 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
|
(** Evaluates to [true] if the file is present on the file system or is the target of a
|
||||||
rule. *)
|
rule. *)
|
||||||
val file_exists : Path.t -> ('a, bool) t
|
val file_exists : Path.t -> ('a, bool) t
|
||||||
|
|
|
@ -720,13 +720,8 @@ let expand_and_eval_set ~dir set ~standard =
|
||||||
Build.return (Ordered_set_lang.eval_with_standard set ~standard)
|
Build.return (Ordered_set_lang.eval_with_standard set ~standard)
|
||||||
| files ->
|
| files ->
|
||||||
let paths = List.map files ~f:(Path.relative dir) in
|
let paths = List.map files ~f:(Path.relative dir) in
|
||||||
Build.paths paths
|
Build.all (List.map paths ~f:Build.read_sexp)
|
||||||
>>>
|
>>^ fun sexps ->
|
||||||
Build.arr (fun () ->
|
let files_contents = List.combine files sexps |> String_map.of_alist_exn in
|
||||||
let files_contents =
|
let set = Ordered_set_lang.Unexpanded.expand set ~files_contents in
|
||||||
List.map2 files paths ~f:(fun fn path ->
|
Ordered_set_lang.eval_with_standard set ~standard
|
||||||
(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)
|
|
||||||
|
|
Loading…
Reference in New Issue