module Acmd:sig
..end
An action command represents the invocation of a program and the possible redirection of its standard file descriptors. Lists of action commands are the building block of actions.
Program executables are represented by the Assemblage.Acmd.cmd
type. Values of this type can be created either with a
configuration key or directly with a static string. If
you are defining build actions you should use a configuration key
and Assemblage.Acmd.cmd
as it ensures the program can be redefined at
configuration time thus making the build system more portable for
end users.
The module also provides a few system utility
invocations that enforce portable
behaviour.
type
cmd
val cmd : string Assemblage.Conf.key -> cmd Assemblage.Conf.value
cmd name
is a program whose name is the value of name
.val static : string -> cmd
static name
is a program whose name is name
.
Important. For build commands, Assemblage.Acmd.cmd
should be used.
Assemblage.Acmd.static
is best used for defining test runs and other
convenience development runs.
type
t
val v : ?stdin:Assemblage.Path.t ->
?stdout:Assemblage.Path.t ->
?stderr:Assemblage.Path.t ->
cmd -> string list -> t
v cmd args
represents the execution of program cmd
with
argument args
and standard file descriptors redirected to
stdin
, stdout
, and stderr
(if specified).module Args:sig
..end
Rather than using system utility configuration keys directly you should use the following functions, they will enforce portable behaviour.
Note. Function arguments could support more labelling but
this doesn't blend well with Assemblage.Conf.app
.
val dev_null : Assemblage.Path.t Assemblage.Conf.value
dev_null
is a file that discards all writes.val cd : (Assemblage.Path.t -> t) Assemblage.Conf.value
cd
has a command exec dir
to change directory to dir
.val ln : (Assemblage.Path.t -> Assemblage.Path.t -> t)
Assemblage.Conf.value
ln
has a command exec src dst
to link symbolically file src
to
dst
.
Warning. On Windows this is a copy.
val ln_rel : (Assemblage.Path.t -> Assemblage.Path.t -> t)
Assemblage.Conf.value
ln_rel
has a command exec src dst
to link symbolically file
src
to dst
. FIXME if src
and dst
are relative this links
src
to dst
as seen from the empty relative directory (is
that understandable ? is that really needed ?val cp : (Assemblage.Path.t -> Assemblage.Path.t -> t)
Assemblage.Conf.value
cp
has a command exec src dst
to copy file src
to dst
.val mv : (Assemblage.Path.t -> Assemblage.Path.t -> t)
Assemblage.Conf.value
mv
has a command exec src dst
to move path src
to dst
.val rm_files : (?f:bool -> Assemblage.Path.t list -> t)
Assemblage.Conf.value
rm_files
has a command exec ~f paths
to remove the file
paths paths
. If f
is true
files are removed regardless of
permissions (defaults to false
). paths
elements must be files,
for directories, see Assemblage.Acmd.rm_dirs
.val rm_dirs : (?f:bool -> ?r:bool -> Assemblage.Path.t list -> t)
Assemblage.Conf.value
rm_dirs
has a command exec ~f ~r paths
to remove the directory paths paths
. If f
is true
directories are
removed regardless of permissions (defaults to false
). If r
is true
removes the file hierarchies rooted at the elements of
paths
. Note that paths
must be directories, for removing
files, see Assemblage.Acmd.rm_files
.val mkdir : (Assemblage.Path.t -> t) Assemblage.Conf.value
mkdir
has a command exec d
to create the directory p
.
Intermediate directories are created as required (mkdir -p
in
Unix parlance).val stamp : (Assemblage.Path.t -> string -> t) Assemblage.Conf.value
stamp
has a command execs f content
that writes content
to f
.