module Args:sig..end
Argument bundles are conditional bindings from execution contexts to lists of command arguments. They provide a simply mechanism to allow the end user to inject flags on the command lines of actions.
See Argument bundles basics and Argument bundle propagation model for more details.
type t
val v : ?exists:bool Assemblage.Conf.value ->
Assemblage.Ctx.t -> string list Assemblage.Conf.value -> tv ~exists ctx args is the bundle that binds ctx to args
whenever exists evaluates to true (defaults to Assemblage.Conf.true_).val vc : ?exists:bool Assemblage.Conf.value ->
Assemblage.Ctx.t -> string list -> tvc ~exists ctx args is v ~exists ctx (Conf.const args).val empty : tempty is the empty bundle.val is_empty : t -> boolis_empty a is true if a is empty.val append : t -> t -> tappend a a' is the bundle that has the bindings of a and
a'. If both a and a' have bindings for the same context,
they are preserved each with their own condition of existence
and it is guaranteed that the binding arguments of a will
appear before those of a' on the command line.val (@@@) : t -> t -> ta @@@ a' is append a a'.val concat : t list -> tconcat args is List.fold_left append empty argsval linkall : tlinkall is the -linkall flag in the right `OCaml contexts.val thread : tthread is the -thread flag in the right `OCaml contexts.val vmthread : tvmthread is the -vmthread flag in the right `OCaml contexts.val cclib : string list -> t-cclib x args. FIXMEval ccopt : string list -> t-ccopt x args. FIXMEval stub : string -> tstub s adds -cclib -ls -dllib -ls to the bytecode
linking options and -cclib -ls to the native linking
options. FIXMEArgument bundles allow to tweak actions by prepending additional arguments to their command invocations. For example the following bundle:
let ocaml_debug =
let debug ctx = Args.vc ~exists:Conf.debug ctx ["-g"] in
Args.(debug [`OCaml; `Compile] @@@ debug [`OCaml; `Link])
used with a part will, whenever the configuration value of
Assemblage.Conf.debug evaluates to true, prepend the option -g to any
command of its actions that operates in a context that contains
the `OCaml and `Compile or `Link elements. Note, you don't
need the above definition, assemblage's OCaml built-in actions
know how to handle the Assemblage.Conf.debug key for you.
Given an argument bundle and a command to execute, every binding in the bundle is considered, if the context of the binding matches the context of the command and the binding exists, the arguments of the binding are prepended to the command invocation.
Warning. Do not rely on the order of context matches for your command lines to be valid. The argument bundle mechanism is a rough end user build action tweaking mechanism that is mostly useful for injecting command line options, not positional arguments. The final bundle given to actions is the concatenation of many bundle sources (project, parts, action implementation) that may be applied in arbitrary order.
Which argument bundles are applied to an action (and its commands):
i is integrated by
a part p its build
actions are integrated into p. In that
case these actions have both the argument bundle of the
integrated part i and that of the integrating part p.