Up

module OASISPlugin

: sig

Plugins creation and management

The whole module is not exported.

Author Sylvain Le Gall

Types

#
module MapPlugin : OASISUtils.MapExt.S with type key = OASISTypes.plugin_kind OASISTypes.plugin
#
module SetPlugin : OASISUtils.SetExt.S with type elt = OASISTypes.plugin_kind OASISTypes.plugin
#
val mem_no_version : OASISTypes.plugin_kind OASISTypes.plugin -> SetPlugin.t -> bool
#
type 'a setter = OASISTypes.plugin_data Pervasives.ref -> 'a -> unit
#
type 'a getter = OASISTypes.plugin_data Pervasives.ref -> 'a
#
type 'a prop = 'a setter * 'a getter
#
type modul = string

OCaml module embedded code.

#
type ('a, 'b) setup_changes = {
# chng_moduls
: modul list;(*OCaml module to be added to setup file*)
# chng_main
: 'a ODNFunc.func;(*Main function to be added to BaseSetup.t (i.e. the one that that really do something: configure, build, test...)*)
# chng_clean
: 'b ODNFunc.func option;(*Function to be called when cleaning*)
# chng_distclean
: 'b ODNFunc.func option;(*Function to be called when distcleaning*)
}

Describe setup file changes.

#
type context_act = {
# ctxt
: OASISContext.t;(*Global context.*)
# update
: OASISSetupUpdate.t;(*What is the value given to -setup-update ?*)
# error
: bool;(*Are there errors?*)
# files
: OASISFileTemplate.templates;(*Generated files.*)
# other_actions
: (unit -> unit) list;(*Extra actions.*)
}

Describe context when applying a plugin.

#
type ('a, 'b) section_act = context_act -> OASISTypes.package -> OASISTypes.common_section * 'a -> context_act * (OASISTypes.package -> OASISTypes.common_section * 'a -> string array -> 'b, OASISTypes.package -> OASISTypes.common_section * 'a -> string array -> unit) setup_changes

Generator for sections (document, test).

#
type package_act = context_act -> OASISTypes.package -> context_act * (OASISTypes.package -> string array -> unit, OASISTypes.package -> string array -> unit) setup_changes

Generator with a package argument only (build, install).

#
type 'a t

Base types to build plugin: register fields, action, generators...

#
type all_t = OASISTypes.plugin_kind t

Base types for all plugins

#
val register_quickstart_completion : all_t -> (OASISTypes.package -> OASISTypes.package) -> unit

Register a quickstart completion for this plugin

#
val quickstart_completion : OASISTypes.plugin_kind OASISTypes.plugin -> OASISTypes.package -> OASISTypes.package

Get quickstart completion

#
val register_generator_package : all_t -> 'a prop -> (PropList.Data.t -> 'a) -> unit

Register a generator for package, to store data of a plugin

#
val generator_package : OASISTypes.plugin_kind OASISTypes.plugin -> OASISTypes.plugin_data Pervasives.ref -> PropList.Data.t -> unit

Call generator for provided plugin

#
val register_generator_section : OASISTypes.section_kind -> all_t -> 'a prop -> (PropList.Data.t -> 'a) -> unit

Register a generator for a section, to store data of a plugin

#
val generator_section : OASISTypes.section_kind -> OASISTypes.plugin_kind OASISTypes.plugin -> OASISTypes.plugin_data Pervasives.ref -> PropList.Data.t -> unit

Call generator for provided plugin on a section

#
val ls : OASISTypes.plugin_kind -> OASISTypes.name list

List available plugins.

#
val all_plugins : unit -> OASISTypes.plugin_kind OASISTypes.plugin list
#
type help = {
# help_template
: string list;
# help_order
: int;
}
#
val help_default : string list -> help
#
val register_help : [
| `All
] OASISTypes.plugin -> help -> unit

Register general help. We only rely on plugin name and version. The replacement field will be computed using the kind of the plugin.

#
val help : [
| `All
] OASISTypes.plugin -> help

Get general help text

#
val to_plugin : 'a t -> 'a OASISTypes.plugin

Convert back to plugin

#
module type PLUGINS = sig

Module to manage a set of plugins, of the same type.

#
type data
#
type act
#
type kind
#
type self_t = kind t
#
type self_plugin = kind OASISTypes.plugin
#
val create : self_plugin -> self_t * all_t
#
val register_act : self_t -> act -> unit

Register the section_act or package_act datastructure.

#
val act : self_plugin -> act

Get action.

#
val quickstart_question : unit -> self_plugin OASISTypes.quickstart_question

Quickstart question.

#
val value : self_plugin OASISValues.t

Parse a plugin field.

end

Modules for plugin type

#
module Configure : PLUGINS with type act = package_act and type data = OASISTypes.package and type kind = [
| `Configure
]

This module manage plugin that can handle configure step.

#
module Build : PLUGINS with type act = package_act and type data = OASISTypes.package and type kind = [
| `Build
]

This module manage plugin that can handle build step.

#
module Doc : PLUGINS with type act = (OASISTypes.doc, unit) section_act and type data = OASISTypes.common_section * OASISTypes.doc and type kind = [
| `Doc
]

This module manage plugin that can handle building documents.

#
module Test : PLUGINS with type act = (OASISTypes.test, float) section_act and type data = OASISTypes.common_section * OASISTypes.test and type kind = [
| `Test
]

This module manage plugin that can handle running tests.

#
module Install : PLUGINS with type act = package_act * package_act and type data = OASISTypes.package and type kind = [
| `Install
]

This module manage plugin that can handle install/uninstall steps.

#
module Extra : PLUGINS with type act = context_act -> OASISTypes.package -> context_act and type data = OASISTypes.package and type kind = [
| `Extra
]

This module manage plugin that can handle configure step.

General plugin functions

#
val test_field_name : string -> bool

Check that a field name has the form to match a plugin. Don't check that the plugin exists. This functions help to ignore plugin fields.

#
val builtin : 'a -> OASISTypes.name -> 'a OASISTypes.plugin

Use a builtin plugin (i.e. version = OASIS version).

#
val add_file : OASISFileTemplate.template -> context_act -> context_act

Add a template to context

#
val set_error : bool -> string -> context_act -> context_act

Define an error in context. It doesn't stop processing, it just sets the CUSTOM(context_act) .error value.

#
val plugin_of_string : 'a -> string -> 'a OASISTypes.plugin

Get a plugin from a string

#
val plugins_of_string : 'a -> string -> 'a OASISTypes.plugin list

Get a list of plugins from a string

#
val string_of_plugin : 'a OASISTypes.plugin -> string

Get a list of plugins from a string

#
val plugin_compare : 'a OASISTypes.plugin -> 'a OASISTypes.plugin -> int

Compare plugin, caseless for name and don't take into account version if one is not set.

#
val plugin_equal : 'a OASISTypes.plugin -> 'a OASISTypes.plugin -> bool

Test equality for plugins, a special case of plugin_compare.

#
val data_create : unit -> OASISTypes.plugin_data Pervasives.ref

Create storage for plugin data.

#
val data_new_property : ?purpose:OASISTypes.plugin_data_purpose -> OASISTypes.plugin_kind OASISTypes.plugin -> 'a prop

data_new_property plg Create a property that can store plugin data. Beware that the the couple (plg, purpose) must be unique.

purpose An identifier to make possible the use of several properties for the same plugin. If not defined, it is derived from the kind of plugin.
end