rules/rust/kache/toolchain.js
Developer reference: this page includes exported implementation details. BUILD authors should prefer the User API reference.
KACHE_TOOL
const KACHE_TOOL
Undocumented.
kacheConfigSchema
const kacheConfigSchema
Undocumented.
kacheArtifactName()
kacheArtifactName(_version, plat)
Return the kache release artifact filename for a version and platform. Unlike sccache/zola, kache's release assets don't embed the version in the filename — only the release tag in the URL path distinguishes versions. artifactName(version, plat) signature.
| Parameter | Type | Description |
|---|---|---|
| _version | string | Unused; kept for parity with other toolchains' |
| plat | { os: string, arch: string } |
Returns: string
kacheDownloadUrl()
kacheDownloadUrl(version, plat)
Return the kache release download URL for a version and platform.
| Parameter | Type | Description |
|---|---|---|
| version | string | |
| plat | { os: string, arch: string } |
Returns: string
kacheCacheKey()
kacheCacheKey(version, plat)
Return the named-cache key for a kache toolchain version and platform.
| Parameter | Type | Description |
|---|---|---|
| version | string | |
| plat | { os: string, arch: string } |
Returns: string
kacheDataCacheKey()
kacheDataCacheKey(plat)
Return the named-cache key for the kache data (object cache) directory. Deliberately independent of the kache binary version — the on-disk cache format is stable across kache releases in practice, and there's no reason to throw away accumulated cache hits on a routine kache bump.
| Parameter | Type | Description |
|---|---|---|
| plat | { os: string, arch: string } |
Returns: string
kacheSupportedPlatforms()
kacheSupportedPlatforms()
Return the platforms kache publishes release archives for.
Returns: Array<{ os: string, arch: string }>
KacheToolchain (implementation class)
class KacheToolchain
Implementation class. BUILD files should use kacheToolchain().
Undocumented.
kacheToolchain()
kacheToolchain(version, opts = {})
Declare a kache toolchain version and optionally set it as the default. matching lockfile entry (warns instead of failing). KACHE_CACHE_DIR's on-disk size (kache's own default is 50 GiB; imp's GC can't prune inside it, only delete it wholesale — see RustKacheWrapper's doc comment).
| Parameter | Type | Description |
|---|---|---|
| version | string | |
| [opts] | object | |
| [opts.default=false] | boolean | |
| [opts.unverified=false] | boolean | Allow downloading without a |
| [opts.cacheSize="4GiB"] | string | KACHE_MAX_SIZE — caps |
Returns: object Target handle for this kache toolchain.
installKacheToolchain()
installKacheToolchain(version, source)
Install a local kache toolchain directory into the named cache.
| Parameter | Type | Description |
|---|---|---|
| version | string | |
| source | string | Path to the toolchain root. |
Returns: string|null Local path to the cached toolchain root.
acquireKacheToolchain
const acquireKacheToolchain
Acquire a kache toolchain, downloading and caching it if not already installed in the named cache.
| Parameter | Type | Description |
|---|---|---|
| version | string |
Returns: Promise<string> Local path to the toolchain root.
resolveKacheToolchainVersion()
resolveKacheToolchainVersion(version)
Resolve an explicit or default kache toolchain version.
| Parameter | Type | Description |
|---|---|---|
| [version] | string |
Returns: string|null
defaultKacheToolchainVersion()
defaultKacheToolchainVersion()
Return the currently configured default kache toolchain version.
Returns: string|null
defaultKacheToolchain()
defaultKacheToolchain()
Return the currently configured default kache toolchain target handle.
Returns: object|null
RustKacheWrapper
class RustKacheWrapper
Adapter exposing a kache toolchain as Rust's RUSTC_WRAPPER, sharing a persistent on-disk object cache across sandboxed cargo builds. Registered as the "rust-build-cache" product for the "kache-toolchain" kind so rules/rust/index.js can resolve it dynamically via productFor(handle, RUST_BUILD_CACHE) the same way it resolves "rust-link-driver"/"rust-linker".