package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/b0.memo/B0_memo/Tool/index.html
Module B0_memo.Tool
Source
Command line tools.
A tool is specified either by name, to be looked up via an unspecified mecanism, or by a file path to an executable file. It declares the environment variables it accesses in the process environment and whether and how it supports response files.
By default declared environment variables are assumed to influence the tool's output and are part of the stamp used to memoize tool spawns. If an environment variable is accessed by the tool but does not influence its output it should be declared as unstamped. Variables specifying the location of temporary file directories are good examples of unstamped variables.
Portability. In order to maximize portability no .exe
suffix should be added to executable names on Windows, the search procedure will add the suffix during the tool search procedure if absent.
Environment variables
The type for lists of environment variable names.
Response files
The type for response file specification.
val response_file_of :
(B0_std.Cmd.t -> string) ->
(B0_std.Fpath.t -> B0_std.Cmd.t) ->
response_file
response_file_of to_file cli
is a response file specification that uses to_file cmd
to convert the command line cmd
to a response file content and cli f
a command line fragment to be given to the tool so that it treats file f
as a response file.
args0
is response file support for tools that reads null byte (0x00
) terminated arguments response files via an -args0 FILE
command line synopsis.
Tools
The type for tools.
val make :
?response_file:response_file ->
?unstamped_vars:env_vars ->
?vars:env_vars ->
B0_std.Cmd.tool ->
t
make ~response_file ~unstamped_vars ~vars cmd
is a tool specified by cmd
. vars
are the stamped variables accessed by the tool (defaults to []
). unstamped_vars
are the unstamped variables accessed by the tool (defaults to tmp_vars
). response_file
defines the reponse file support for the tool (if any).
val by_name :
?response_file:response_file ->
?unstamped_vars:env_vars ->
?vars:env_vars ->
string ->
t
by_name
is like make
but reference the tool directly via a name.
Raises Invalid_argument
if B0_std.Fpath.is_seg
name
is false
.
name t
is t
's tool name. If this is a relative file path with a single segment the tool is meant to be searched via an external mecanism.
unstamped_vars t
are the unstamped environment variables accessed by t
.
response_file t
is t
's response file specification (if any).
val read_env :
forced_env_vars:env_vars ->
t ->
B0_std.Os.Env.t ->
B0_std.Os.Env.t * B0_std.Os.Env.t
read_env t env
is (all, stamped)
such that:
all
has the variables ofenv
that are invars t
andunstamped_vars t
unstamped
has the variables ofenv
that are instamped t
only.