Module B0caml.Conf

b0caml configuration.

type comp_target = [
  1. | `Auto
  2. | `Byte
  3. | `Native

The type for compilation targets.

val comp_target_of_string : string -> (comp_target, string) Stdlib.result

comp_target_of_string s parses a compilation target from s.


type t

The type for configurations.

val v : cache_dir:B0_std.Fpath.t -> comp_target:comp_target -> cwd:B0_std.Fpath.t -> log_level:B0_std.Log.level -> ocamlpath:B0caml_ocamlpath.t -> tty_cap:B0_std.Tty.cap -> unit -> t

v constructs a configuration with the given attributes. See the corresponding accessors for details.

val cache_dir : t -> B0_std.Fpath.t

cache_dir c is the cache directory.

val b0_cache_dir : t -> B0_std.Fpath.t

b0_cache_dir c is the b0 cache directory.

val comp_target : t -> comp_target

comp_target c is the target to which scripts are compiled.

val cwd : t -> B0_std.Fpath.t

cwd c is the current working directory w.r.t. relative configuration file paths are expressed.

val log_level : t -> B0_std.Log.level

log_level c is the desired log level.

val ocamlpath : t -> B0caml_ocamlpath.t

ocamlpath is the OCAMLPATH to consider.

val memo : t -> (B0_memo.t, string) Stdlib.result

memo c is the memoizer for the configuration.

val tty_cap : t -> B0_std.Tty.cap

tty_cap c is the terminal capability to assume for output.


val setup_with_cli : cache_dir:B0_std.Fpath.t option -> comp_target:comp_target option -> log_level:B0_std.Log.level option -> tty_cap:B0_std.Tty.cap option option -> unit -> (t, string) Stdlib.result

setup_with_cli ~cache_dir ~comp_target ~tty_cap ~log_level () determines and setups a configuration with the given values. These are expected to have been determined by environment variables and command line arguments.

val setup_without_cli : unit -> (t, string) Stdlib.result

setup_without_cli determines and setups a configuration without without command line arguments. This looks up environment variables and determines defaults.