(** Creation and management of sandboxes *)

open Import

type t

val dir : t -> Path.Build.t

(** [map_path t p] returns the path corresponding to [p] inside the sandbox. *)
val map_path : t -> Path.Build.t -> Path.Build.t

(** Create a new sandbox containing [dirs] and copy or link dependencies [deps] inside it. *)
val create
  :  mode:Sandbox_mode.some
  -> dune_stats:Dune_stats.t option
  -> rule_loc:Loc.t
  -> dirs:Path.Build.Set.t
  -> deps:Path.Set.t
  -> rule_dir:Path.Build.t
  -> rule_digest:Digest.t
  -> t Fiber.t

(** Move all targets created by the action from the sandbox to the build
    directory, skipping the files for which [should_be_skipped] returns [true].

    Expands [targets] with the set of files discovered in directory targets. *)
val move_targets_to_build_dir
  :  t
  -> should_be_skipped:(Path.Build.t -> bool)
  -> targets:Targets.Validated.t
  -> unit Fiber.t

val destroy : t -> unit Fiber.t
