Module B0.Variant

module Variant: sig .. end
Build variants.

Build variants define a configuration, build directory and environment to run a build.

The environment of a build variant is defined via a variant scheme which is responsible for setting up and destroying the environment.



Variant


module Scheme: sig .. end
Variant schemes.
type t 
The type for variants.
val create : ?preset:bool ->
dir:B0.Fpath.t ->
string ->
Scheme.t ->
(t * B0.Conf.Preset.def_error list) B0.result
create ~preset ~dir n scheme creates a variant named n with scheme scheme in directory dir and if preset is true (default) applies the scheme's preset on the empty configuration.
val reset : t -> unit B0.result
reset v resets variant v. FIXME After this has been called the variant should be in a state that is similar to create.
val delete : ?force:bool ->
t ->
(unit, [ `Msg of string | `Scheme of B0.R.msg ]) Pervasives.result
delete ~force v deletes variant v. If force is true (defaults to false) the deletion occurs even if the scheme hook errors.
val scheme : t -> Scheme.t
scheme v is v's scheme.
val conf_path : t -> B0.Fpath.t
conf_path v is the path to v's configuration.
val outcome_path : t -> B0.Fpath.t
outcome_path v is the path to v's outcome
val build_path : t -> B0.Fpath.t
build_path v is the path to v's build directory.
val cache_index_path : t -> B0.Fpath.t
cache_index_path v is the path to v's cache index.
val value_kind : string
val name : t -> string
name v is v's name.
val path : t -> B0.Fpath.t
path v is the path to v.
val equal : t -> t -> bool
equal v0 v1 is true iff v0 and v1 are the same variant.
val compare : t -> t -> int
equal v0 v1 is a total order on variants compatible with B0.Variant.equal.
val compare_by_name : t -> t -> int
compare v0 v1 totally orders v0 and v1 in increasing lexicographical variant name order.
type unknown_scheme = [ `Unknown_scheme of string * t ] 
The type for variant with unknown schemes. If the scheme is unknown it is replaced by B0.Variant.Scheme.nop.
val of_unknown_scheme : unknown_scheme -> t
of_unknown_scheme u is the variant in u with The nop variant scheme scheme.
val pp_unknown_scheme : unknown_scheme B0.Fmt.t
pp_unknown_scheme ppf u prints an unspecified representation of u on ppf.
type load = (t, [ `Unknown_scheme of string * t ])
Pervasives.result
The type for variant loads. If the scheme is unknown it is replaced by The nop variant scheme.
val of_load : load -> t
of_load l is the variant in l.
val exists : dir:B0.Fpath.t -> string -> bool B0.result
exists ~dir n is Ok true if variant named n exists in dir.
val find : dir:B0.Fpath.t -> string -> load option B0.result
find ~dir n is the variant named n in directory dir (if any).
val get : dir:B0.Fpath.t -> string -> load B0.result
get ~dir n is like B0.Variant.find but
Raises Invalid_argument if no variant named n exists.
val get_or_suggest : dir:B0.Fpath.t ->
string -> (load, string list) Pervasives.result B0.result
get_or_suggest ~dir n is the variant with name n if it exists or a list of suggested variant names that could match n.
val list : dir:B0.Fpath.t -> load list B0.result
list ~dir is the list of variants located in directory dir in increasing lexicographical variant name order.
val list_empty : dir:B0.Fpath.t -> bool B0.result
list_empty ~dir is Ok true if there are no variants dir or if dir doesn't exist.

Pretty-printing


val pp_name_str : string B0.Fmt.t
pp_name_str ppf s prints s as if it was a name on ppf.
val pp_name : t B0.Fmt.t
pp_name ppf v prints v's name on ppf.
val pp_synopsis : t B0.Fmt.t
pp_synopsis ppf v prints v's synopsis: its name and documentation.
val pp_info : t B0.Fmt.t
pp_info ppf v prints v's synopsis and fields.
val pp_info_ext : t B0.Fmt.t -> t B0.Fmt.t
pp_info ext ppf v prints v's synopsis and fields extended with ext.