Module B0_pack

Build packs.

A build pack gathers a set of build units and attaches metadata to it.

Packs

type b0_unit = B0_defs.b0_unit

The type for b0 units. See B0_unit.t.

type t

The type for build units.

val make : ?doc:string -> ?meta:B0_meta.t -> string -> locked:bool -> b0_unit list -> t

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.

val locked : t -> bool

locked is true if the pack when used in a build mandates a locked build.

val units : t -> b0_unit list

units p are the units of p.

Metadata derivation

val find_default : unit -> t option

find_default () is a default pack.

FIXME This is likely not a good idea. There's no context to override the default.

val derive_synopsis_and_description : t -> B0_meta.t -> B0_meta.t

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_std.String.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
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