Legend:
Library
Module
Module type
Parameter
Class
Class type
Plugin loader.
This module handles the set of plugins, visible to the platform.
Plugins are looked at the following locations:
paths explicitly specified by a user (via library parameter);
paths specified by the BAP_PLUGIN_PATH environment variable (same syntax as PATH variable);
$prefix/lib/bap, where $prefix is the installation prefix, specified during the installation.
The latter destination is used by the bapbundle install command, so this is the default repository of plugins.
The plugin loader is an event driven system. Once, Plugins.run function is called, events of type Plugins.events will start to fire. By default they are intercepted by a logger, and by the default handler (see Plugins.run function description about the default handler). The logger will write the infromation about events, that is useful for debugging issues with plugins.
val list :
?env:string list->?provides:string list->?library:string list->unit ->plugin list
list ?env ~provides:features ?library () scans a list of directories, provided by a library parameter, and, finally, Config.libdir for files with a plugin extension. Returns all plugins that provide a superset of features and has constrains that are subset of env.
val run :
?argv:string array->?env:string list->?provides:string list->?don't_setup_handlers:bool ->?library:string list->?exclude:string list->unit ->
unit
run ?env ?provides ?library ?exclude load and execute all plugins that can be found in the library paths, and are not in the exclude list. The default event handler will abort the program if there is any Errored event occurs, a message will be printed to the standard output. If don't_setup_handlers option is chosen, then events are not treated, so that a host program may setup a more fine granular error handling.
load ?env ?provides ?library ?exclude is like run, but will not setup handlers, and will return a result of loading. Each element of the list is either an Ok plugin if a plugin was successfully loaded, or Error (name,error) if a plugin with the given name failed with error.