Module B0_unit

Build units.

A build unit is a named build procedure with metadata associated to it. Build units are the smallest unit of build in B0 files.

Build procedures

type b0_build

The type for builds, see B0_build.

type build_proc = b0_build -> unit B0_std.Fut.t

The type for unit build procedures. Note that when the future determines the build may not be finished.

val build_nop : build_proc

build_nop does nothing.


type t

The type for build units.

val make : ?doc:string -> ?meta:B0_meta.t -> string -> build_proc -> t

make n proc ~doc ~meta ~action is a build unit named n with build procedure proc, synopsis doc and metada meta.

val build_proc : t -> build_proc

proc u are the unit's build procedure.

Metadata for built executables

val tool_name : string B0_meta.key

tool_name is an executable name without the platform specific executable extension.

exe_file is an absolute file path to an executable build by the unit.

val is_public : t -> bool

is_public u is true iff u's meta has B0_meta.public set to true.

val get_or_suggest_tool : keep:(t -> bool) -> string -> (t list, t list) Stdlib.result

get_or_suggest_tool tool_name are tools names whose tool_name match tool_name and are filtered by keep

val tool_is_user_accessible : t -> bool

tool_is_user_accessible u assumes u has a tool name. This then returns true iff u is_public or in_root_scope.

Unit executions

type b0_env

The type for execution environments, see B0_env.

module Exec : sig ... end

Unit executions.

B0 definition API

val mangle_basename : string -> string
val define : ?doc:string -> ?meta:B0_meta.t -> string -> B0_def.def
val def_kind : string
val def : t -> B0_def.def
val name : t -> string
val basename : t -> string
val doc : t -> string
val equal : t -> t -> bool
val compare : t -> t -> int
val meta : t -> B0_meta.t
val mem_meta : 'a B0_meta.key -> t -> bool
val has_tag : bool B0_meta.key -> t -> bool
val find_meta : 'a B0_meta.key -> t -> 'a option
val find_or_default_meta : 'a B0_meta.key -> t -> 'a
val get_meta : 'a B0_meta.key -> t -> ('a, string) Stdlib.result
val add : t -> unit
val fold : (t -> 'a -> 'a) -> 'a -> 'a
val list : unit -> t list
val find : string -> t option
val get : string -> t
val get_or_suggest : string -> (t, t list) Stdlib.result
val get_or_hint : string -> (t, string) Stdlib.result
val get_list_or_hint : all_if_empty:bool -> string list -> (t list, string) Stdlib.result
val scope_path : t -> string list
val in_root_scope : t -> bool
val in_current_scope : t -> bool
val scope_dir : t -> B0_std.Fpath.t option
val scope_dir' : t -> (B0_std.Fpath.t, string) Stdlib.result
val in_scope_dir : t -> B0_std.Fpath.t -> B0_std.Fpath.t option
val in_scope_dir' : t -> B0_std.Fpath.t -> (B0_std.Fpath.t, string) Stdlib.result
val pp_name_str : string B0_std.Fmt.t
val pp_name : t B0_std.Fmt.t
val pp_doc : t B0_std.Fmt.t
val pp_synopsis : t B0_std.Fmt.t
val pp : t B0_std.Fmt.t
module Set : sig ... end
module Map : sig ... end
val tool_name_map : Set.t -> t B0_std.String.Map.t

tool_name_map units are the user accessible tools defined by the set of units units.