A driver is an executable that provides a service on a root description. Some commands of the driver may need the description to run and others may not.
For driver commands that need the description. Running the driver compiles and links the root description with libraries implementing the driver into a single executable called a driver instance. This executable is then run to provide the driver's service on the root description. If no description can be found the driver's executable is run with an indication that this is the case.
TODO A simple, complete example.
[ `Driver | `Instance ]
`Driveris the driver executable.
`Instanceis the driver library linked with the root description.
val b0_dir :
setup -> B0_driver.B0_dir.t
b0_diris the absolute path to the b0 directory.
val color :
setup -> B0.Tty.cap option
color sis the requested terminal capability. Note.
B0.Ttyis already setup accordingly.
val verbosity :
setup -> B0.Log.level
verbosity sis the requested log verbosity. Note.
B0.Logis already setup accoringly.
val exec :
setup -> exec
execis the kind of execution. Note that if a command requests an
`Instanceexecution, this will be
`Driverif no root description was found.
(setup -> int) Cmdliner.Term.t * Cmdliner.Term.info *
execvalue indicates if a driver needs an instance to run or not. Note that even if the command requests
`Instanceand there is no build description it will be executed with
-Coption. Remaining files specified on the cli and used by the term should be interpreted relative to the current directory.
val create :
libs:string list -> cmd list -> t
create ~name ~version ~libs cmds mainis a driver named
versionthat implements its service using the libraries
libssorted in dependency order (recursive dependencies are not looked up) and the given
B0_driverlibrary and its recursive dependencies should not be mentioned in
cmd terms are wrapped with additional options for
configuring and setting up the driver instance. These options are
documented in the
B0_driver.Cli.s_driver_opts section of the commands
cmds that requested
`Instance execution will be run as
`Driver if no root description is found.
val set :
t -> unit
set dsets the driver to
d. This must be set by one of the driver's libraries mentioned in
Invalid_argumentif a driver is already set.
val driver_main :
unit -> unit
driver_main ()runs the driver executable's main function. This must be called by the driver executable.
Invalid_argumentif no driver was set.
val instance_main :
unit -> unit
instance_main ()runs the driver instance's main function. This gets called by the compiled driver instance.