Implem of Build.progn

This commit is contained in:
Jérémie Dimino 2017-03-05 10:05:05 +00:00
parent 9013a836f0
commit ba80202747
1 changed files with 29 additions and 0 deletions

View File

@ -190,3 +190,32 @@ let and_create_file fn =
{ action with
action = Progn [action.action; Create_file fn]
})
(*
{[
let progn ts =
all ts >>^ fun (actions : Action.t list) ->
match actions with
| [] ->
{ Action.
context = None
; dir = Path.root
; action = Progn []
}
| first :: rest ->
let rest =
List.map rest ~f:(fun a ->
(match first.context, a.context with
| None, None -> ()
| Some c1, Some c2 when c1.name = c2.name -> ()
| _ ->
Sexp.code_error "Build.progn"
[ "actions", Sexp.To_sexp.list Action.sexp_of_t actions ]);
if first.dir = a.dir then
a.action
else
Chdir (a.dir, a.action))
in
{ first with action = Progn (first :: rest) }
]}
*)