package b0
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dba2fc571f39f3b8e87ee55c77bdec7ec6a5ddc7d99b8b20aeda848af546be04
md5=51ee1d66acc4d7f87bdceac1341b7711
doc/b0.driver/B0_driver/index.html
Module B0_driver
B0 file drivers.
B0 file drivers access the definitions of B0 files. See this manual section for an overview and a minimal example.
Commonalities
module Exit : sig ... end
Driver exit codes.
module Env : sig ... end
Driver environment variables.
module Conf : sig ... end
Driver configuration.
module Cli : sig ... end
Cli interaction.
Drivers
type main = unit -> Exit.t Cmdliner.Term.result
The type for driver main functions. A function that returns a Cmdliner evaluation result. This evaluation result is used by run
to handle program termination. Note that the driver may exit prematurely with Exit.b0_file_error
if there's a fatal error in the B0 file.
val create :
name:string ->
version:string ->
libs:B00_ocaml.Lib_name.t list ->
t
create ~name ~version
is a new driver named name
which has version version
and uses library libs
to link the B0 file. Note that these libraries are not added during the compilation phase.
Note. The b0 libraries are automatically added to libs
there's no need to mention them. Just mention your driver library and its dependencies in order.
val name : t -> string
name d
is the name of d
.
val version : t -> string
version d
is the version of d
.
val libs : t -> B00_ocaml.Lib_name.t list
libs d
are the libraries that need to be added for linking.
set d
sets the driver to d
and its main function to main
. Use run
to run the driver.
run ~has_b0_file
runs the driver set by set
. has_b0_file
must be true
if the B0 file is linked in, this is typically done by the B0 file expanded source invocation. Raises Invalid_argument
if no driver is set.
Require the B0 file
val with_b0_file :
driver:t ->
(Conf.t -> Exit.t) Cmdliner.Term.t ->
Exit.t Cmdliner.Term.t
with_b0_file ~driver cmd
wraps cmd
to make sure it runs with the B0 file compiled and linked in as specified by driver
.
has_b0_file ()
is true
if run
is called with has_b0_file
.
Compilation
module Compile : sig ... end
Driver compilation.