[variants]

The variant data shared by every tool that reads ubproject.toml: the values available as var.*.

Read instead of [needs] variant_data and [needs] variant_data_file when it sets data or data_file, data = {} included; those two [needs] keys are then ignored, with a warning for each one that is set. A [variants] table that sets neither key changes nothing. Any other key is ignored with a warning, so one file can serve tool versions that read more keys.

Guide: Variant builds.

variants.data
Type:
table of (scalar or array of scalars or table of (scalar or array of values or table of values))

Variant values, available as var.* in .. if:: conditions, filters and variant-gated sources.

Values may be strings, booleans, integers, floats, arrays holding one of those types, or nested tables. When data_file is also set, these values are merged over the file’s, table by table; the inline value wins where both set a key. A configuration that extends another, and a -c override, merge their values over the inherited ones the same way.

Each entry: A value in the variant data tree: a scalar, an array of scalars, or a nested table.

Under variants.data and needs.variant_data an array’s elements must share one type.

Forms:

  • a scalar: A single scalar value.

  • an array of scalars: An array of scalar values.

    Under variants.data and needs.variant_data the elements must all be of one type.

  • a table of (scalar or array of scalars or table of values): A nested map of variant values.

variants.data_file
Type:
string

Path to a JSON file holding variant values, as one object.

One non-empty path. A relative path is taken from the directory of the configuration file that sets it, as written (a .. is kept). Unset reads no file. A configuration that extends another, and a -c override, replace an inherited file.