package b0

  1. Overview
  2. Docs
Software construction and deployment kit

Install

dune-project
 Dependency

Authors

Maintainers

Sources

b0-0.0.5.tbz
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e

doc/b0/B0_unit/index.html

Module B0_unitSource

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.

Build procedures

Sourcetype build

The type for builds, see B0_build.

Sourcetype proc = build -> unit B0_std.Fut.t

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

Sourceval proc_nop : proc

proc_nop does nothing.

Units

Sourcetype action = build -> t -> args:string list -> B0_std.Os.Exit.t B0_std.Fut.t

The type for unit outcome actions. Defines an action to perform on build results. args are command line argument passed on the command line.

For example for executables a natural action is to execv them directly or via their runtime (see Action.exec). For built document files it can be to (re)load them in their corresponding viewer application, etc.

TODO. This is not a final design, see unit actions.

Sourceand t

The type for build units.

Sourceval v : ?doc:string -> ?meta:B0_meta.t -> ?action:action -> string -> proc -> t

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

Sourceval proc : t -> proc

proc u are the unit's build procedure.

Sourceval action : t -> action option

action is the unit's outcome action.

Action

Sourcemodule Action : sig ... end

B0 definition API

include B0_def.S with type t := t

Named values

Sourceval define : ?doc:string -> ?meta:B0_meta.t -> string -> B0_def.def

define ~doc ~meta n defines name n in the current scope with documentation string doc (defaults to "undocumented")e and metadata meta (defaults to B0_meta.empty). Defining a duplicate value in a scope raises Duplicate.

Sourceval def_kind : string

def_kind is the kind of defined value.

Sourceval def : t -> B0_def.def

def v is the definition of value v.

Sourceval name : t -> string

name v is v's name.

Sourceval basename : t -> string

basename v is v's name without the scope.

Sourceval doc : t -> string

doc v is v's documentation string.

Sourceval equal : t -> t -> bool

equal v0 v1 is true iff v0 and v1 have the same name.

Sourceval compare : t -> t -> int

compare v0 v1 sorts v0 and v0 in lexicographical order.

Metadata

Sourceval meta : t -> B0_meta.t

meta v is v's metadata.

Sourceval has_meta : 'a B0_meta.key -> t -> bool

has_meta k u is B0_meta.mem k (B0_unit.meta u).

Sourceval find_meta : 'a B0_meta.key -> t -> 'a option

find_meta k u is B0_meta.find k (B0_unit.meta u).

Sourceval get_meta : 'a B0_meta.key -> t -> ('a, string) result

get_meta m k u is Ok v if find_meta k u is Some v and a final user friendly error message if None.

Add & Lookup

Sourceval add : t -> unit

add v adds the value v to the list of defined values.

Sourceval list : unit -> t list

list () is the list of units.

Sourceval find : string -> t option

find n is the value named n (if any).

Sourceval get : string -> t

get n looks up the value named n and errors the B0 file if there no such n.

Sourceval get_or_suggest : string -> (t, t list) result

get_or_suggest n is the value named n or a (possibly empty) list of suggested values whose name could match n.

Sourceval get_or_hint : string -> (t, string) result

get_or_hint n is the value named n or an error message that indicates that n could not be found with suggested names.

Sourceval get_list_or_hint : ?empty_means_all:bool -> string list -> (t list, string) result

get_list_or_hint ns are the value named ns or an error that indicates the names that could not be found with suggested names. If empty_means_all is true (defaults to false) an empty ns returns list () sorted by name.

Formatters

Sourceval pp_name_str : string B0_std.Fmt.t

pp_name_str v pretty prints value names.

Sourceval pp_name : t B0_std.Fmt.t

pp_name v formats v's name.

Sourceval pp_doc : t B0_std.Fmt.t

pp_doc formats v's doc string.

Sourceval pp_synopsis : t B0_std.Fmt.t

pp_synopsis formats v's name and its doc string.

pp formats v 's name, its doc string and its metadata dictionary.

Value set and maps

Sourcemodule Set : Set.S with type elt = t

Value sets.

Sourcemodule Map : Map.S with type key = t

Value maps.