Skip to main content

ic_build/artifacts/
phase.rs

1//! One phase vocabulary for Wasm execution, progress and failure attribution.
2
3/// Phase of a Wasm acquisition, including commands, coordination and recovery.
4///
5/// Progress and failures use the same phase identity. Command errors identify
6/// the invoked Cargo/rustc operation; timing summaries may aggregate phases.
7#[non_exhaustive]
8#[derive(Clone, Copy, Debug, Eq, PartialEq)]
9pub enum WasmBuildPhase {
10    /// Validating the caller's specification before effects.
11    Specification,
12    /// Waiting for the exact-cache lock or preparing its directory.
13    ExactCacheCoordination,
14    /// Reading the Cargo executable identity.
15    CargoIdentity,
16    /// Reading the Rust compiler identity.
17    RustcIdentity,
18    /// Resolving or decoding Cargo's package graph.
19    CargoMetadata,
20    /// Discovering selected source and configuration inputs.
21    InputDiscovery,
22    /// Hashing selected and conservative input contents.
23    ContentHashing,
24    /// Waiting for or preparing a shared incremental target.
25    SharedTargetCoordination,
26    /// Inspecting or clearing a shared incremental target.
27    SharedTargetMaintenance,
28    /// Compiling the selected Wasm packages.
29    CargoBuild,
30    /// Validating, copying, hashing or stamping exact artifacts.
31    ArtifactPublication,
32    /// Applying retention to immutable exact-cache entries.
33    ExactCacheMaintenance,
34    /// Removing an incomplete exact-cache entry after failure.
35    Cleanup,
36}
37
38impl std::fmt::Display for WasmBuildPhase {
39    fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40        formatter.write_str(match self {
41            Self::Specification => "specification",
42            Self::ExactCacheCoordination => "exact cache coordination",
43            Self::CargoIdentity => "Cargo identity",
44            Self::RustcIdentity => "Rust compiler identity",
45            Self::CargoMetadata => "cargo metadata",
46            Self::InputDiscovery => "input discovery",
47            Self::ContentHashing => "content hashing",
48            Self::SharedTargetCoordination => "shared target coordination",
49            Self::SharedTargetMaintenance => "shared target maintenance",
50            Self::CargoBuild => "cargo build",
51            Self::ArtifactPublication => "artifact publication",
52            Self::ExactCacheMaintenance => "exact cache maintenance",
53            Self::Cleanup => "cleanup",
54        })
55    }
56}