Module B0.Unit

module Unit: sig .. end
Build units.

Builds are organized into statically known and named units which allows coarse grained action on builds.


type t 
The type for build units.
type id = int 
The type for build unit unique identifiers. Warning. The same unit can be given different ids in different program runs.
val create : ?loc:B0.Def.loc ->
?src_root:B0.Fpath.t ->
?doc:string ->
?doc_outcome:string ->
?only_aim:B0.Env.build_aim ->
?pkg:B0.Pkg.t ->
?meta:B0.Meta.Unit.t -> string -> ( -> unit) -> t
create ~doc n b is a build unit with unique name n build function b and documented by doc and which logs B0.Unit.doc_outcome once built.

src_root should only be defined if you are not using description files it determines the root of sources for the unit.

By default build units can be built for either B0.Env.build_aim, only_aim allows to restrict this. It is mainly used with `Build_os for units that build private internal tools used by the build itself.

Warning. Units must be defined at toplevel and are subject to namespacing, see details.

include B0.Def.S
val func : t -> -> unit
func u is u's build function.
val src_root : t -> B0.Fpath.t
src_root u is the root of sources for the units. It determines the value of B0.Build.src_dir when the unit is being built.
val basename : t -> string
basename u is u's given base name, without the namespacing.
val doc_outcome : t -> string
doc_outcome u is a string logged when the unit builds successfully.
val id : t -> id
id u is u's unique identifier for the program run.
val pkg : t -> B0.Pkg.t option
pkg u is u's package (if any).
val meta : t -> B0.Meta.Unit.t
meta u is u's metadata.
val meta_mem : 'a B0.Meta.Unit.key -> t -> bool
meta_mem k u is true iff k is defined in u's meta.
val meta_add : 'a B0.Meta.Unit.key -> 'a -> t -> unit
meta_add k v u binds k to v in u's meta.
val meta_find : 'a B0.Meta.Unit.key -> t -> 'a option
meta_find k u is k's value in u's meta (if any).
val meta_get : 'a B0.Meta.Unit.key -> t -> 'a
meta_get k u is like B0.Unit.meta_find but
Raises Invalid_argument if k is not bound in u.
val has_tag : bool B0.Meta.Unit.key -> t -> bool
has_tag k u is true iff k's value in u's meta is true.

Unit id map and sets

module Idset: sig .. end
Sets of unit identifiers.
module Idmap: sig .. end
Maps of unit identifiers.

Unit map and sets

type set 
The type for sets of units.
module Set: sig .. end
Unit sets.
type +'a map 
The type for maps from units to values of type 'a.
module Map: sig .. end
Unit maps.