/usr/lib/ocaml/oasis/OASISPlugin.mli is in liboasis-ocaml-dev 0.4.5-1build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | (******************************************************************************)
(* OASIS: architecture for building OCaml libraries and applications *)
(* *)
(* Copyright (C) 2011-2013, Sylvain Le Gall *)
(* Copyright (C) 2008-2011, OCamlCore SARL *)
(* *)
(* This library is free software; you can redistribute it and/or modify it *)
(* under the terms of the GNU Lesser General Public License as published by *)
(* the Free Software Foundation; either version 2.1 of the License, or (at *)
(* your option) any later version, with the OCaml static compilation *)
(* exception. *)
(* *)
(* This library is distributed in the hope that it will be useful, but *)
(* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *)
(* details. *)
(* *)
(* You should have received a copy of the GNU Lesser General Public License *)
(* along with this library; if not, write to the Free Software Foundation, *)
(* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *)
(******************************************************************************)
(** Plugins creation and management
The whole module is {b not exported}.
@author Sylvain Le Gall
*)
(** {2 Types} *)
open OASISTypes
module MapPlugin: OASISUtils.MapExt.S with type key = plugin_kind plugin
module SetPlugin: OASISUtils.SetExt.S with type elt = plugin_kind plugin
(* Check that plugin exist even with a different version. *)
val mem_no_version: plugin_kind plugin -> SetPlugin.t -> bool
type 'a setter = plugin_data ref -> 'a -> unit
type 'a getter = plugin_data ref -> 'a
type 'a prop = 'a setter * 'a getter
(** OCaml module embedded code.
*)
type modul = string
(** Describe setup file changes.
*)
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 context when applying a plugin.
*)
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. *)
}
(** Generator for sections (document, test).
*)
type ('a, 'b) section_act =
context_act ->
package ->
(common_section * 'a) ->
(* Result *)
context_act *
((* Run *)
(package -> (common_section * 'a) -> string array -> 'b),
(* Clean & Distclean *)
(package -> (common_section * 'a) -> string array -> unit)
) setup_changes
(** Generator with a package argument only (build, install).
*)
type package_act =
context_act ->
package ->
(* Result *)
context_act *
((* Run *)
(package -> string array -> unit),
(* Clean & Distclean *)
(package -> string array -> unit)
) setup_changes
(** Base types to build plugin: register fields, action, generators...
*)
type 'a t
(** Base types for all plugins
*)
type all_t = plugin_kind t
(** Register a quickstart completion for this plugin *)
val register_quickstart_completion: all_t -> (package -> package) -> unit
(** Get quickstart completion *)
val quickstart_completion: plugin_kind plugin -> package -> package
(** Register a generator for package, to store data of a plugin *)
val register_generator_package:
all_t -> 'a prop -> (PropList.Data.t -> 'a) -> unit
(** Call generator for provided plugin *)
val generator_package:
plugin_kind plugin -> plugin_data ref -> PropList.Data.t -> unit
(** Register a generator for a section, to store data of a plugin *)
val register_generator_section:
section_kind -> all_t -> 'a prop -> (PropList.Data.t -> 'a) -> unit
(** Call generator for provided plugin on a section *)
val generator_section:
section_kind -> plugin_kind plugin -> plugin_data ref ->
PropList.Data.t -> unit
(** List available plugins. *)
val ls: plugin_kind -> name list
(* All registered plugin. *)
val all_plugins: unit -> plugin_kind plugin list
type help =
{
help_template: string list;
help_order: int;
}
val help_default: string list -> help
(** Register general help. We only rely on plugin name and version. The
replacement field will be computed using the kind of the plugin.
*)
val register_help: [`All | plugin_kind] plugin -> help -> unit
(** Get general help text
*)
val help: [`All] plugin -> help
(** Convert back to plugin *)
val to_plugin: 'a t -> 'a plugin
(** Module to manage a set of plugins, of the same type. *)
module type PLUGINS =
sig
type data
type act
type kind
type self_t = kind t
type self_plugin = kind plugin
val create: self_plugin -> self_t * all_t
(** Register the [section_act] or [package_act] datastructure. *)
val register_act: self_t -> act -> unit
(** Get action. *)
val act: self_plugin -> act
(** Quickstart question. *)
val quickstart_question: unit -> self_plugin quickstart_question
(** Parse a plugin field. *)
val value: self_plugin OASISValues.t
end
(** {2 Modules for plugin type} *)
(** This module manage plugin that can handle configure step. *)
module Configure: PLUGINS with
type act = package_act
and type data = package
and type kind = [`Configure]
(** This module manage plugin that can handle build step. *)
module Build: PLUGINS with
type act = package_act
and type data = package
and type kind = [`Build]
(** This module manage plugin that can handle building documents. *)
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 running tests. *)
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 install/uninstall steps. *)
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 configure step. *)
module Extra: PLUGINS with
type act = context_act -> package -> context_act
and type data = package
and type kind = [`Extra]
(** {2 General plugin functions} *)
(** 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 test_field_name: string -> bool
(** Use a builtin plugin (i.e. version = OASIS version). *)
val builtin: 'a -> name -> 'a plugin
(** Add a template to context *)
val add_file: OASISFileTemplate.template -> context_act -> context_act
(** Define an error in context. It doesn't stop processing, it just sets the
{context_act.error} value.
*)
val set_error: bool -> string -> context_act -> context_act
(** Get a plugin from a string *)
val plugin_of_string: 'a -> string -> 'a plugin
(** Get a list of plugins from a string *)
val plugins_of_string: 'a -> string -> ('a plugin) list
(** Get a list of plugins from a string *)
val string_of_plugin: 'a plugin -> string
(** Compare plugin, caseless for name and don't take into account version
if one is not set.
*)
val plugin_compare: 'a plugin -> 'a plugin -> int
(** Test equality for plugins, a special case of {!plugin_compare}.
*)
val plugin_equal: 'a plugin -> 'a plugin -> bool
(** Create storage for plugin data.
*)
val data_create: unit -> plugin_data ref
(** [data_new_property plg] Create a property that can store plugin data. Beware
that the the couple [(plg, purpose)] must be unique.
@param 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.
*)
val data_new_property:
?purpose:plugin_data_purpose -> plugin_kind plugin -> 'a prop
|