Platform Rules

constraint_setting

constraint_setting(name, deprecation, distribs, features, licenses, tags, testonly, visibility)

This rule defines a type of constraint that can be used to define an execution platform.

Arguments

Attributes
name

Name; required

A unique name for this rule.

constraint_value

constraint_value(name, constraint_setting, deprecation, distribs, features, licenses, tags, testonly, visibility)

This rule defines a specific value of a constraint, which can be used to define execution platforms.

Arguments

Attributes
name

Name; required

A unique name for this rule.

constraint_setting

Label; required

The constraint_setting rule this value is applied to.

platform

platform(name, constraint_values, deprecation, distribs, features, licenses, remote_execution_properties, tags, testonly, visibility)

This rule defines a platform, as a collection of constraint_values.

Examples

This defines two possible platforms, each targeting a different CPU type.

constraint_setting(name="cpu")
constraint_value(
    name="arm64",
    constraint_setting=":cpu")
constraint_value(
    name="k8",
    constraint_setting=":cpu")
platform(
    name="mobile_device",
    constraint_values = [
        ":arm64",
    ])
platform(
    name="devel",
    constraint_values = [
        ":k8",
    ])

Arguments

Attributes
name

Name; required

A unique name for this rule.

constraint_values

List of labels; optional

The constraint_values that define this platform.
remote_execution_properties

String; optional

A string used to configure a remote execution platform. Actual builds make no attempt to interpret this, it is treated as opaque data that can be used by a specific SpawnRunner.

toolchain

toolchain(name, deprecation, distribs, exec_compatible_with, features, licenses, tags, target_compatible_with, testonly, toolchain, toolchain_type, visibility)

This rule declares a specific toolchain's type and constraints so that it can be selected during toolchain resolution.

Arguments

Attributes
name

Name; required

A unique name for this rule.

exec_compatible_with

List of labels; optional; nonconfigurable

The constraints, as defined by constraint_value() and constraint_setting(), that are required on the execution platform for this toolchain to be selected.
target_compatible_with

List of labels; optional; nonconfigurable

The constraints, as defined by constraint_value() and constraint_setting(), that are required on the target platform for this toolchain to be selected.
toolchain

Name; required; nonconfigurable

The label of the actual toolchain data to be used when this toolchain is selected.
toolchain_type

Name; required; nonconfigurable

The type of the toolchain, which should be the label of a toolchain_type() target.