Extensions for bzlmod.
zig = use_extension("@rules_zig//zig:extensions.bzl", "zig")
zig.toolchain(name, default, extra_exec_compatible_with, extra_target_compatible_with,
extra_target_settings, zig_version)
zig.extra_exec_compatible_with(constraints)
zig.extra_target_compatible_with(constraints)
zig.extra_target_settings(settings)
zig.index(file)
zig.mirrors(urls)
Installs a Zig toolchain.
Every module can define multiple toolchain versions. All these versions will be
registered as toolchains and you can select the toolchain using the
@zig_toolchains//:version build flag.
The latest version will be the default unless the root module explicitly declares one as the default.
TAG CLASSES
Fetch and define toolchain targets for the given Zig SDK version.
Defaults to the latest known version.
Attributes
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A descriptive suffix for generated toolchain targets. Leave empty for the default wrapper names. | Name | optional | "" |
| default | Make this the default Zig SDK version. Can only be used once, and only in the root module. | Boolean | optional | False |
| extra_exec_compatible_with | Additional execution platform constraints for generated Zig SDK toolchain targets. | List of labels | optional | [] |
| extra_target_compatible_with | Additional target platform constraints for generated Zig SDK toolchain targets. | List of labels | optional | [] |
| extra_target_settings | Additional target settings for generated Zig SDK toolchain targets. | List of labels | optional | [] |
| zig_version | The Zig SDK version. | String | required |
Add execution platform constraints to all generated Zig SDK toolchain targets.
Attributes
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| constraints | Additional execution platform constraints for generated Zig SDK toolchain targets. | List of labels | optional | [] |
Add target platform constraints to all generated Zig SDK toolchain targets.
Attributes
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| constraints | Additional target platform constraints for generated Zig SDK toolchain targets. | List of labels | optional | [] |
Add target settings to all generated Zig SDK toolchain targets.
Attributes
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| settings | Additional target settings for generated Zig SDK toolchain targets. | List of labels | optional | [] |
Extend the set of known Zig SDK versions based on a Zig version index.
The provided index must use a schema that is compatible with the upstream index.
Attributes
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| file | The Zig version index JSON file. | Label | required |
Attributes
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| urls | The mirrors base URLs. | List of strings | required |