No optional args for context

This commit is contained in:
Rudi Grinberg 2018-03-15 18:17:00 +08:00
parent 74a98b9caa
commit dea2ac77ca
6 changed files with 11 additions and 9 deletions

View File

@ -888,7 +888,7 @@ and exec_list l ~ectx ~dir ~env ~stdout_to ~stderr_to =
exec t ~ectx ~dir ~env ~stdout_to ~stderr_to >>= fun () ->
exec_list rest ~ectx ~dir ~env ~stdout_to ~stderr_to
let exec ~targets ?context t =
let exec ~targets ~context t =
let env =
match (context : Context.t option) with
| None -> Env.initial ()

View File

@ -112,7 +112,7 @@ module Unexpanded : sig
-> Partial.t
end
val exec : targets:Path.Set.t -> ?context:Context.t -> t -> unit Fiber.t
val exec : targets:Path.Set.t -> context:Context.t option -> t -> unit Fiber.t
(* Return a sandboxed version of an action *)
val sandbox

View File

@ -191,7 +191,7 @@ module Rule = struct
}
let make ?(sandbox=false) ?(mode=Jbuild.Rule.Mode.Not_a_rule_stanza)
?context ?(locks=[]) ?loc build =
~context ?(locks=[]) ?loc build =
let targets = targets build in
let dir =
match targets with

View File

@ -25,7 +25,7 @@ module Rule : sig
val make
: ?sandbox:bool
-> ?mode:Jbuild.Rule.Mode.t
-> ?context:Context.t
-> context:Context.t option
-> ?locks:Path.t list
-> ?loc:Loc.t
-> (unit, Action.t) Build.t

View File

@ -736,7 +736,7 @@ let rec compile_rule t ?(copy_source=false) pre_rule =
in
make_local_dirs t (Action.chdirs action);
with_locks locks ~f:(fun () ->
Action.exec ?context ~targets action) >>| fun () ->
Action.exec ~context ~targets action) >>| fun () ->
Option.iter sandbox_dir ~f:Path.rm_rf;
(* All went well, these targets are no longer pending *)
pending_targets := Pset.diff !pending_targets targets;
@ -783,7 +783,7 @@ and setup_copy_rules t ~ctx_dir ~non_target_source_files =
This allows to keep generated files in tarballs. Maybe we
should allow it on a case-by-case basis though. *)
compile_rule t (Pre_rule.make build) ~copy_source:true)
compile_rule t (Pre_rule.make build ~context:None) ~copy_source:true)
and load_dir t ~dir = ignore (load_dir_and_get_targets t ~dir : Pset.t)
and targets_of t ~dir = load_dir_and_get_targets t ~dir
@ -860,13 +860,14 @@ and load_dir_step2_exn t ~dir ~collector ~lazy_generators =
~suffix:("-" ^ Digest.to_hex stamp)
in
let rule =
Pre_rule.make ~locks
Pre_rule.make ~locks ~context:None
(Build.progn [ action; Build.create_file path ])
in
(rule :: rules, Pset.add deps path))
in
let path = Path.extend_basename base_path ~suffix:Alias0.suffix in
(Pre_rule.make
~context:None
(Build.path_set deps >>>
Build.action ~targets:[path]
(Redirect (Stdout,
@ -1074,6 +1075,7 @@ let stamp_file_for_files_of t ~dir ~ext =
compile_rule t
(let open Build.O in
Pre_rule.make
~context:None
(Build.paths files >>>
Build.action ~targets:[stamp_file]
(Action.with_stdout_to stamp_file

View File

@ -209,13 +209,13 @@ let add_rule t ?sandbox ?mode ?locks ?loc build =
let build = Build.O.(>>>) build t.chdir in
Build_system.add_rule t.build_system
(Build_interpret.Rule.make ?sandbox ?mode ?locks ?loc
~context:t.context build)
~context:(Some t.context) build)
let add_rule_get_targets t ?sandbox ?mode ?locks ?loc build =
let build = Build.O.(>>>) build t.chdir in
let rule =
Build_interpret.Rule.make ?sandbox ?mode ?locks ?loc
~context:t.context build
~context:(Some t.context) build
in
Build_system.add_rule t.build_system rule;
List.map rule.targets ~f:Build_interpret.Target.path