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 -> t
v ~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 -> t
vc ~exists ctx args
is v ~exists ctx (Conf.const args)
.val empty : t
empty
is the empty bundle.val is_empty : t -> bool
is_empty a
is true
if a
is empty.val append : t -> t -> t
append 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 -> t
a @@@ a'
is append a a'
.val concat : t list -> t
concat args
is List.fold_left append empty args
val linkall : t
linkall
is the -linkall
flag in the right `OCaml
contexts.val thread : t
thread
is the -thread
flag in the right `OCaml
contexts.val vmthread : t
vmthread
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 -> t
stub 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
.