Add a list constructor to Dep_conf.t
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
e9027b4b11
commit
4be37dd140
|
@ -241,25 +241,30 @@ module Dep_conf = struct
|
||||||
| Source_tree of String_with_vars.t
|
| Source_tree of String_with_vars.t
|
||||||
| Package of String_with_vars.t
|
| Package of String_with_vars.t
|
||||||
| Universe
|
| Universe
|
||||||
|
| List of t list
|
||||||
|
|
||||||
let t =
|
let t =
|
||||||
let t =
|
let t =
|
||||||
let sw = String_with_vars.t in
|
let sw = String_with_vars.t in
|
||||||
sum
|
fix (fun t ->
|
||||||
[ "file" , (sw >>| fun x -> File x)
|
sum
|
||||||
; "alias" , (sw >>| fun x -> Alias x)
|
[ "file" , (sw >>| fun x -> File x)
|
||||||
; "alias_rec" , (sw >>| fun x -> Alias_rec x)
|
; "alias" , (sw >>| fun x -> Alias x)
|
||||||
; "glob_files" , (sw >>| fun x -> Glob_files x)
|
; "alias_rec" , (sw >>| fun x -> Alias_rec x)
|
||||||
; "package" , (sw >>| fun x -> Package x)
|
; "glob_files" , (sw >>| fun x -> Glob_files x)
|
||||||
; "universe" , return Universe
|
; "package" , (sw >>| fun x -> Package x)
|
||||||
; "files_recursively_in",
|
; "universe" , return Universe
|
||||||
(Syntax.renamed_in Stanza.syntax (1, 0) ~to_:"source_tree"
|
; "files_recursively_in",
|
||||||
>>= fun () ->
|
(Syntax.renamed_in Stanza.syntax (1, 0) ~to_:"source_tree"
|
||||||
sw >>| fun x -> Source_tree x)
|
>>= fun () ->
|
||||||
; "source_tree",
|
sw >>| fun x -> Source_tree x)
|
||||||
(Syntax.since Stanza.syntax (1, 0) >>= fun () ->
|
; "source_tree",
|
||||||
sw >>| fun x -> Source_tree x)
|
(Syntax.since Stanza.syntax (1, 0) >>= fun () ->
|
||||||
]
|
sw >>| fun x -> Source_tree x)
|
||||||
|
; "list",
|
||||||
|
(Syntax.since Stanza.syntax (1, 0) >>= fun () ->
|
||||||
|
(repeat t) >>| fun x -> List x)
|
||||||
|
])
|
||||||
in
|
in
|
||||||
peek_exn >>= function
|
peek_exn >>= function
|
||||||
| Template _ | Atom _ | Quoted_string _ ->
|
| Template _ | Atom _ | Quoted_string _ ->
|
||||||
|
@ -267,7 +272,7 @@ module Dep_conf = struct
|
||||||
| List _ -> t
|
| List _ -> t
|
||||||
|
|
||||||
open Sexp
|
open Sexp
|
||||||
let sexp_of_t = function
|
let rec sexp_of_t = function
|
||||||
| File t ->
|
| File t ->
|
||||||
List [Sexp.unsafe_atom_of_string "file" ; String_with_vars.sexp_of_t t]
|
List [Sexp.unsafe_atom_of_string "file" ; String_with_vars.sexp_of_t t]
|
||||||
| Alias t ->
|
| Alias t ->
|
||||||
|
@ -286,6 +291,9 @@ module Dep_conf = struct
|
||||||
String_with_vars.sexp_of_t t]
|
String_with_vars.sexp_of_t t]
|
||||||
| Universe ->
|
| Universe ->
|
||||||
Sexp.unsafe_atom_of_string "universe"
|
Sexp.unsafe_atom_of_string "universe"
|
||||||
|
| List ts ->
|
||||||
|
List (Sexp.unsafe_atom_of_string "list"
|
||||||
|
:: (List.map ~f:sexp_of_t ts))
|
||||||
end
|
end
|
||||||
|
|
||||||
module Preprocess = struct
|
module Preprocess = struct
|
||||||
|
|
|
@ -90,6 +90,7 @@ module Dep_conf : sig
|
||||||
| Source_tree of String_with_vars.t
|
| Source_tree of String_with_vars.t
|
||||||
| Package of String_with_vars.t
|
| Package of String_with_vars.t
|
||||||
| Universe
|
| Universe
|
||||||
|
| List of t list
|
||||||
|
|
||||||
val t : t Sexp.Of_sexp.t
|
val t : t Sexp.Of_sexp.t
|
||||||
val sexp_of_t : t -> Sexp.t
|
val sexp_of_t : t -> Sexp.t
|
||||||
|
|
|
@ -487,7 +487,7 @@ module Deps = struct
|
||||||
let loc = String_with_vars.loc s in
|
let loc = String_with_vars.loc s in
|
||||||
Alias.of_user_written_path ~loc ((expand_vars_path t ~scope ~dir s))
|
Alias.of_user_written_path ~loc ((expand_vars_path t ~scope ~dir s))
|
||||||
|
|
||||||
let dep t ~scope ~dir = function
|
let rec dep t ~scope ~dir = function
|
||||||
| File s ->
|
| File s ->
|
||||||
let path = expand_vars_path t ~scope ~dir s in
|
let path = expand_vars_path t ~scope ~dir s in
|
||||||
Build.path path
|
Build.path path
|
||||||
|
@ -521,6 +521,9 @@ module Deps = struct
|
||||||
| Universe ->
|
| Universe ->
|
||||||
Build.path Build_system.universe_file
|
Build.path Build_system.universe_file
|
||||||
>>^ fun () -> []
|
>>^ fun () -> []
|
||||||
|
| List ts ->
|
||||||
|
Build.all (List.map ~f:(dep t ~scope ~dir) ts)
|
||||||
|
>>^ List.concat
|
||||||
|
|
||||||
let interpret t ~scope ~dir l =
|
let interpret t ~scope ~dir l =
|
||||||
Build.all (List.map l ~f:(dep t ~scope ~dir))
|
Build.all (List.map l ~f:(dep t ~scope ~dir))
|
||||||
|
|
Loading…
Reference in New Issue