Configuration

The configuration block describes a context to run a build. There you define variables that can be used in PROJECT files.

Example Usage

# default configuration (no need to specify `--configuration` on command line)
configuration {
  variables = {
    configuration: "Debug"
  }
}

# named configuration (must specify --configuration <identifier> on command line)
configuration <identifier> {
  variables = {
    configuration: "Release"
  }
}

Argument Reference

The following arguments are supported:

  • identifier - (Mandatory) Identifier of the configuration.
  • variables - (Optional) Mapping of all variables to define. Values are expressions. Changing values may lead to rebuild of targets.

Variable override

Variables must be declared in a configuration block in WORKSPACE - hence they are typed, known and documented.

Terrabuild supports variable overriding using:

  • Environment variable: use TB_VAR_xxx to override a variable (with xxx the variable name).
  • Command line argument: use --variable switch when building a target.
ℹ️

Value and type of a variable is determined in this order:

  1. Value and type from default configuration in WORKSPACE.
  2. Value and type from requested configuration in WORKSPACE.
  3. Apply environment variable value. Value is converted to variable type.
  4. Apply command line value. Value is converted to variable type.

Note overriding value must match variable type. Override name is always converted to lowercase.

Last updated on