package oasis

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Plugins creation and management

The whole module is not exported.

  • author Sylvain Le Gall

Types

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 = {
  1. chng_moduls : modul list;
    (*

    OCaml module to be added to setup file

    *)
  2. 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...)

    *)
  3. chng_clean : 'b OASISDataNotation.func option;
    (*

    Function to be called when cleaning

    *)
  4. chng_distclean : 'b OASISDataNotation.func option;
    (*

    Function to be called when distcleaning

    *)
}

Describe setup file changes.

type context_act = {
  1. ctxt : OASISContext.t;
    (*

    Global context.

    *)
  2. update : OASISSetupUpdate.t;
    (*

    What is the value given to -setup-update ?

    *)
  3. error : bool;
    (*

    Are there errors?

    *)
  4. files : OASISFileTemplate.templates;
    (*

    Generated files.

    *)
  5. 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...

Base types for all plugins

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

Register a quickstart completion for this plugin

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

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

Call generator for provided plugin on a section

List available plugins.

val all_plugins : unit -> OASISTypes.plugin_kind OASISTypes.plugin list
type help = {
  1. help_template : string list;
  2. help_order : int;
}
val help_default : string list -> help
val register_help : [ `All | OASISTypes.plugin_kind ] 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 = 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).

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 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.

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

  • parameter 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.

OCaml

Innovation. Community. Security.