Move sandboxed back to Action
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
1b71d57bba
commit
c7bd8bc556
|
@ -754,3 +754,22 @@ module Infer = struct
|
|||
let unexpanded_targets t =
|
||||
(Unexp.infer t).targets
|
||||
end
|
||||
|
||||
let sandbox t ~sandboxed ~deps ~targets : t =
|
||||
Progn
|
||||
[ Progn (List.filter_map deps ~f:(fun path ->
|
||||
if Path.is_managed path then
|
||||
Some (Symlink (path, sandboxed path))
|
||||
else
|
||||
None))
|
||||
; map t
|
||||
~dir:Path.root
|
||||
~f_string:(fun ~dir:_ x -> x)
|
||||
~f_path:(fun ~dir:_ p -> sandboxed p)
|
||||
~f_program:(fun ~dir:_ x -> Result.map x ~f:sandboxed)
|
||||
; Progn (List.filter_map targets ~f:(fun path ->
|
||||
if Path.is_managed path then
|
||||
Some (Rename (sandboxed path, path))
|
||||
else
|
||||
None))
|
||||
]
|
||||
|
|
|
@ -117,10 +117,10 @@ module Infer : sig
|
|||
val unexpanded_targets : Unexpanded.t -> String_with_vars.t list
|
||||
end
|
||||
|
||||
val map
|
||||
(** Return a sandboxed version of an action *)
|
||||
val sandbox
|
||||
: t
|
||||
-> dir:Path.t
|
||||
-> f_program:(dir:Path.t -> Prog.t -> Prog.t)
|
||||
-> f_string:(dir:Path.t -> string -> string)
|
||||
-> f_path:(dir:Path.t -> Path.t -> Path.t)
|
||||
-> sandboxed:(Path.t -> Path.t)
|
||||
-> deps:Path.t list
|
||||
-> targets:Path.t list
|
||||
-> t
|
||||
|
|
|
@ -227,22 +227,3 @@ let exec ~targets ~context t =
|
|||
let purpose = Process.Build_job targets in
|
||||
let ectx = { purpose; context } in
|
||||
exec t ~ectx ~dir:Path.root ~env ~stdout_to:None ~stderr_to:None
|
||||
|
||||
let sandbox t ~sandboxed ~deps ~targets : Action.t =
|
||||
Progn
|
||||
[ Progn (List.filter_map deps ~f:(fun path ->
|
||||
if Path.is_managed path then
|
||||
Some (Action.Symlink (path, sandboxed path))
|
||||
else
|
||||
None))
|
||||
; Action.map t
|
||||
~dir:Path.root
|
||||
~f_string:(fun ~dir:_ x -> x)
|
||||
~f_path:(fun ~dir:_ p -> sandboxed p)
|
||||
~f_program:(fun ~dir:_ x -> Result.map x ~f:sandboxed)
|
||||
; Progn (List.filter_map targets ~f:(fun path ->
|
||||
if Path.is_managed path then
|
||||
Some (Action.Rename (sandboxed path, path))
|
||||
else
|
||||
None))
|
||||
]
|
||||
|
|
|
@ -5,11 +5,3 @@ val exec
|
|||
-> context:Context.t option
|
||||
-> Action.t
|
||||
-> unit Fiber.t
|
||||
|
||||
(* Return a sandboxed version of an action *)
|
||||
val sandbox
|
||||
: Action.t
|
||||
-> sandboxed:(Path.t -> Path.t)
|
||||
-> deps:Path.t list
|
||||
-> targets:Path.t list
|
||||
-> Action.t
|
||||
|
|
|
@ -796,7 +796,7 @@ let rec compile_rule t ?(copy_source=false) pre_rule =
|
|||
let sandboxed path = Path.sandbox_managed_paths ~sandbox_dir path in
|
||||
make_local_parent_dirs t all_deps ~map_path:sandboxed;
|
||||
make_local_parent_dirs t targets ~map_path:sandboxed;
|
||||
Action_exec.sandbox action
|
||||
Action.sandbox action
|
||||
~sandboxed
|
||||
~deps:all_deps_as_list
|
||||
~targets:targets_as_list
|
||||
|
|
Loading…
Reference in New Issue