# Module OASISPlugin

    module OASISPlugin: sig .. end

Plugins creation and management

The whole module is not exported.

- Author(s): Sylvain Le Gall

### Types

    module MapPlugin: OASISUtils.MapExt.S  with type key = plugin_kind plugin

    module SetPlugin: OASISUtils.SetExt.S  with type elt = plugin_kind plugin

    val mem_no_version : OASISTypes.plugin_kind OASISTypes.plugin -> SetPlugin.t -> bool

    type 'a setter = OASISTypes.plugin_data Stdlib.ref -> 'a -> unit

    type 'a getter = OASISTypes.plugin_data Stdlib.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 OASISDataNotation.func`;` | `(*` | Main function to be added to BaseSetup.t (i.e. the one that that really do something: configure, build, test...) | `*)`
`` | `chng_clean : `'b OASISDataNotation.func option`;` | `(*` | Function to be called when cleaning | `*)`
`` | `chng_distclean : `'b OASISDataNotation.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 *
           (ctxt:OASISContext.t ->
            OASISTypes.package -> OASISTypes.common_section * 'a -> string array -> 'b,
            ctxt:OASISContext.t ->
            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 *
           (ctxt:OASISContext.t -> OASISTypes.package -> string array -> unit,
            ctxt:OASISContext.t -> 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 Stdlib.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 Stdlib.ref -> PropList.Data.t -> unit

Call generator for provided plugin on a section

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

List registered plugins of given kind.

    val all_plugins : unit -> OASISTypes.plugin_kind OASISTypes.plugin list

All registered plugin.

    type help = {

`` | `help_template : `string list`;`
`` | `help_order : `int`;`

`}`

    val help_default : string list -> help

    val register_help : [ `All | `Build | `Configure | `Doc | `Extra | `Install | `Test ]
           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 .. end

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

### Modules for plugin type

    module Configure: PLUGINS  with
      type act = package_act
                               and type data = 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 = package
                           and type kind = [`Build]

This module manage plugin that can handle build step.

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

This module manage plugin that can handle building documents.

    module Test: PLUGINS  with
      type act = (test, float) section_act
                          and type data = common_section * 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 = package
                             and type kind = [`Install]

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

    module Extra: PLUGINS  with
      type act = context_act -> package -> context_act
                               and type data = 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 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 `OASISPlugin.plugin_compare`.

    val data_create : unit -> OASISTypes.plugin_data Stdlib.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.