Skip to main content

maintain_shared_incremental_target

Function maintain_shared_incremental_target 

Source
pub fn maintain_shared_incremental_target(
    spec: &WasmBuildSpec,
    policy: SharedIncrementalTargetPrunePolicy,
) -> Result<Option<SharedIncrementalTargetMaintenance>, WasmBuildError>
Expand description

Apply explicit whole-target retention to caller-owned shared Cargo state.

Returns None without creating anything when the target does not exist. Policy evaluation and any clearing occur under the same cross-process lock used by shared-incremental builds. The target root, CACHEDIR.TAG, and .ic-testkit lock metadata are preserved, so another process cannot enter through a replacement lock while maintenance is active. Every other target child is removed when a limit is exceeded; unrelated data that must survive must not be colocated there. Exact Cargo input resolution first rejects targets overlapping source or configuration.

This function is never called automatically by exact Wasm acquisitions. Consumers retain ownership of when mutable incremental state may be lost.