package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/b0.file/B0_pack/index.html
Module B0_packSource
Build packs.
A build pack gathers a set of build units and attaches metadata to it.
Packs
The type for build units.
make n us is a build pack named n made of build units us and described by doc. locked defaults to false, see locked for the semantics.
locked is true if the pack when used in a build mandates a locked build.
Metadata derivation
find_default () is a default pack.
FIXME This is likely not a good idea. There's no context to override the default.
derive_synopsis_and_description p m if B0_meta.synopsis or B0_meta.description are undefined in m it tries to fill them in from an existing README.md in the scope directory of p. The first marked up section of the file is extracted using B0_adhoc.commonmark_first_section its title is parsed according to the pattern '$(NAME) $(SEP) $(SYNOPSIS)' to get a synopsis line and the body up to the next (sub)section defines the description.
XXX. See if we couldn't define that as a default key value in the future. Though we'd need the def for getting the directory.
b0 definition API
include B0_def.S with type t := t
Named values
mangle_basename s is a basename that can be used with define.
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 an exception.
def_kind is the kind of defined value.
def v is the definition of value v.
name v is v's name. Note that this name changes depending on how the definition is scoped.
Metadata
mem_meta k v is B0_meta.mem k (B0_def.meta v).
has_tag k v is B0_meta.has_tag k (B0_def.meta v).
find_meta k v is B0_meta.find k (B0_def.meta v).
find_or_default_meta k u is B0_meta.find_or_default k (B0_unit.meta u).
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
get name looks up the value named name and errors the b0 file if there no such name.
get_or_suggest name is the value named name or a (possibly empty) list of suggested values whose name could match name.
get_or_hint name is the value named name or an error message that indicates that name could not be found with suggested names.
get_list_or_hint ~all_if_empty names are the value named after names or an error that indicates the names that could not be found with suggested names. If all_if_empty is true an empty ns returns list () sorted by name.
Scope
scope_path v are the scopes in which v is defined starting from the root. If v is defined in the root scope this is [], if v is defined in a library scope lib this is [[""]; lib]
scope_dir v is the scope directory in which v is defined.
scope_dir' v is like scope_dir but errors with an end-user message if None.
in_scope_dir v path makes the path path absolute with respect to the scope directory in which v is defined. This is None if v's scope has no directory (e.g. on library scopes).
in_scope_dir' is like in_scope_dir but errors with an end-user message if None.
Formatters
pp_name_str v pretty prints value names.
pp_name v formats v's name.
pp_doc formats v's doc string.
pp_synopsis formats v's name and its doc string.
pp formats v 's name, its doc string and its metadata dictionary.