package b0

  1. Overview
  2. Docs
Software construction and deployment kit

Install

dune-project
 Dependency

Authors

Maintainers

Sources

b0-0.0.6.tbz
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0

doc/b0.file/B0_env/index.html

Module B0_envSource

Execution environments.

This is notably what actions get access to.

Note. At some point we need a build/host distinction here.

Sourcetype t

The type for execution environments.

Sourceval make : b0_dir:B0_std.Fpath.t -> build:B0_build.t -> cwd:B0_std.Fpath.t -> root_dir:B0_std.Fpath.t -> scope_dir:B0_std.Fpath.t -> driver_env:B0_std.Os.Env.t -> t

make ~cwd ~scope_dir ~root_dir ~action is an execution context with given parameters. See corresponding accessors for semantics.

Directories

See also the relative file resolutions.

Sourceval b0_dir : t -> B0_std.Fpath.t

b0_dir env is the b0 directory.

Sourceval cwd : t -> B0_std.Fpath.t

cwd env is the absolute path to the current working directory.

Sourceval root_dir : t -> B0_std.Fpath.t

root_dir env is the root directory.

Sourceval scope_dir : t -> B0_std.Fpath.t

scope_dir env is the absolute path to the directory of the b0 file in which the action is defined or the root directory if the action is defined the global scope.

Sourceval scratch_dir : t -> B0_std.Fpath.t

scratch_dir env is a shared scratch directory for actions in b0_dir. The directory must be created it may not exist, it's content may be destroyed at any time and actions are in charge of inventing a naming scheme to avoid collisions.

Sourceval unit_dir : t -> B0_defs.b0_unit -> B0_std.Fpath.t

unit_dir env u is the build directory if u in the build build env. That is B0_build.unit_dir (build env) u.

Sourcetype dir = [
  1. | `Cwd
  2. | `Root_dir
  3. | `Scope_dir
  4. | `Unit_dir
]

The type for speciying directories.

Sourceval pp_dir : dir B0_std.Fmt.t

pp_dir formats directory specification for ui purposes.

Sourceval dir : t -> dir -> B0_std.Fpath.t

dir env d looks up d in env, raises Invalid_argument on `Unit_dir.

Relative file resolution

Sourceval in_root_dir : t -> B0_std.Fpath.t -> B0_std.Fpath.t

in_scope_dir env p is Fpath.(root_dir env // p).

Sourceval in_scope_dir : t -> B0_std.Fpath.t -> B0_std.Fpath.t

in_scope_dir env p is Fpath.(scope_dir env // p).

Sourceval in_scratch_dir : t -> B0_std.Fpath.t -> B0_std.Fpath.t

in_scope_dir env p is Fpath.(scratch_dir env // p).

Sourceval in_unit_dir : t -> B0_defs.b0_unit -> B0_std.Fpath.t -> B0_std.Fpath.t

in_unit_dir env u p is Fpath.(unit_unit_dir env u // p).

in_dir env d p is Fpath.(in_dir env d // p).

Process environments

Sourcetype env = [
  1. | `Build_env
    (*

    Base build process environment.

    *)
  2. | `Driver_env
    (*

    Environment of the b0 invocation.

    *)
]

The type for environments.

Sourceval pp_env : env B0_std.Fmt.t

pp_env formats environments.

Sourceval build_env : t -> B0_std.Os.Env.t

build_env env is the base build process environment.

Sourceval driver_env : t -> B0_std.Os.Env.t

driver_env env is the environment with which b0 was invoked.

Sourceval env : t -> env -> B0_std.Os.Env.t

env env e is the environment e of env.

Build

Sourceval build : t -> B0_build.t

build env is the current build (if any).

Tool lookup

Sourceval get_cmd : ?skip_build:bool -> t -> B0_std.Cmd.tool_search

get_cmd env cmd is cmd with its B0_std.Cmd.get_tool resolved in the environment. If cmd's tool is defined by a unit in the build and is B0_unit.tool_is_user_accessible, it comes first in the search, unless skip_build is true (defaults to false.

Sourceval unit_exe_file : t -> B0_defs.b0_unit -> (B0_std.Fpath.t, string) result

unit_exe_file env u looks up the B0_unit.exe_file of u in env. This errors if u can't be found in the build of if u has no such key.

Sourceval unit_exe_file_cmd : t -> B0_defs.b0_unit -> (B0_std.Cmd.t, string) result

unit_exe_file env u is Result.map Cmd.path (unit_exe_file env u).