package b0

  1. Overview
  2. Docs

Build operations guards.

A guard ensure that a build operation is allowed to proceed. This means either that:

  • It is ready and can be submitted for execution. This happens once all the files the operation reads are ready: they exist and are up-to-date.
  • It is aborted. This happens if a file it needs to read never becomes ready.

Guards

type feedback = [
  1. | `File_status_repeat of B0_std.Fpath.t
  2. | `File_status_unstable of B0_std.Fpath.t
]

The type for guard feedbacks:

  • `File_status_repeat f indicates that the file status of f was set more than once.
  • `File_status_unstable f indicates that the file status of f was set more than once and in an inconsistent manner
type t

The type for build operations guards.

val create : ?feedback:(feedback -> unit) -> unit -> t

create ~feedback () is a new guard, using feedback to report inconsistencies (default is a nop.).

val set_file_ready : t -> B0_std.Fpath.t -> unit

set_file_ready g f indicates to g that file f is ready, i.e. that it exists and is up-to-date.

val set_file_never : t -> B0_std.Fpath.t -> unit

set_file_never g f indicate to g that file f will never become ready.

val add : t -> Op.t -> unit

add g o guards o in g until it is allowed.

val allowed : t -> Op.t option

allowed g is an operation that is either ready or aborted in g (if any). In the second case the Op.exec_status is Op.Aborted.

Stuck build analysis

The following functions are not efficient, only use for stuck build anaylsis or debugging.

val guarded_ops : t -> Op.t list

guarded_opts g is the list of operations that are not ready in g.

val ready_files : t -> B0_std.Fpath.Set.t

ready_files g are the files that got ready in g.

val never_files : t -> B0_std.Fpath.Set.t

never_files g are the files that never got ready in g.

val undecided_files : t -> B0_std.Fpath.Set.t

undecided_files g are the files that are neither got ready nor never got ready in g.

val root_undecided_files : t -> B0_std.Fpath.Set.t

root_undecided_file g is like undecided_files but has only the files that are not written by a guarded_op of g. If a build is stuck these are files that are not undecided as the result of a guarded operation.