Zig

Developer reference: this page includes exported implementation details. BUILD authors should prefer the User API reference.

ZIG_TOOL

const ZIG_TOOL

Undocumented.

zigArtifactName()

zigArtifactName(version, plat)

Return the Zig release artifact filename for a version and platform.

ParameterTypeDescription
versionstring
plat{ os: string, arch: string }

Returns: string

zigDownloadUrl()

zigDownloadUrl(version, plat)

Return the Zig release download URL for a version and platform.

ParameterTypeDescription
versionstring
plat{ os: string, arch: string }

Returns: string

zigSupportedPlatforms()

zigSupportedPlatforms()

Return the platforms this module resolves Zig release archives for.

Returns: Array<{ os: string, arch: string }>

zigCacheKey()

zigCacheKey(version, plat)

Return the named-cache key for a Zig toolchain version and platform.

ParameterTypeDescription
versionstring
plat{ os: string, arch: string }

Returns: string

ZigToolchain (implementation class)

class ZigToolchain

Implementation class. BUILD files should use zigToolchain().

Undocumented.

zigToolchain()

zigToolchain(version, opts = {})

Declare a Zig toolchain version and optionally set it as the default. matching lockfile entry (warns instead of failing).

ParameterTypeDescription
versionstring
[opts]object
[opts.default=false]boolean
[opts.unverified=false]booleanAllow downloading without a

Returns: object Target handle for this Zig toolchain.

installZigToolchain()

installZigToolchain(version, source)

Install a local Zig toolchain directory into the named cache.

ParameterTypeDescription
versionstring
sourcestringPath to the toolchain root.

Returns: string|null Local path to the cached toolchain root.

acquireZigToolchain

const acquireZigToolchain

Acquire a Zig toolchain, downloading and caching it if not already installed in the named cache.

ParameterTypeDescription
versionstring

Returns: Promise<string> Local path to the toolchain root.

resolveZigToolchainVersion()

resolveZigToolchainVersion(version)

Resolve an explicit or default Zig toolchain version.

ParameterTypeDescription
[version]string

Returns: string|null

zigGlobalCacheEnv()

zigGlobalCacheEnv()

Return the run() env entries pointing Zig at its shared build-cache tool mount (see zigBuildCacheTool). Any run() using this must also include that tool, or the path won't exist in the sandbox.

Returns: string[]

defaultZigToolchainVersion()

defaultZigToolchainVersion()

Return the currently configured default Zig toolchain version.

Returns: string|null

defaultZigToolchain()

defaultZigToolchain()

Return the currently configured default Zig toolchain target handle.

Returns: object|null