Skip to main content

euv_cli/builder/pipeline/
impl.rs

1use super::*;
2
3/// Default multi-platform build pipeline configuration rooted at the current working directory.
4impl Default for BuildPipelineConfig {
5    /// Constructs a `BuildPipelineConfig` targeting the current working directory with safe defaults.
6    ///
7    /// # Returns
8    ///
9    /// - `Self` - Default pipeline configuration.
10    fn default() -> Self {
11        Self {
12            workspace_root: PathBuf::from("."),
13            targets: Vec::new(),
14            all: false,
15            package: None,
16            out_dir: None,
17            out_file: None,
18            archive: None,
19            base: None,
20            skip_unavailable: false,
21            parallel: false,
22            jobs: None,
23            manifest: false,
24            verify: false,
25            raw_wasm: false,
26            skip_wasm_opt: false,
27            theme_variants: false,
28            no_launch: false,
29            install: false,
30            smoke: false,
31            include_cli: false,
32            version: None,
33            abis: Vec::new(),
34            features: Vec::new(),
35            device: None,
36            icon: None,
37            form_factor: HarmonyFormFactorArg::Phone,
38            render: None,
39            release: false,
40        }
41    }
42}
43
44/// Badge and display helpers on `TargetBuildStatus`.
45impl TargetBuildStatus {
46    /// Maps this build status to its terminal `StatusBadge`.
47    ///
48    /// # Returns
49    ///
50    /// - `StatusBadge` - Corresponding terminal badge token.
51    #[must_use]
52    pub const fn badge(self) -> StatusBadge {
53        match self {
54            Self::Passed => StatusBadge::Pass,
55            Self::SkippedUnavailable => StatusBadge::Skip,
56            Self::Failed => StatusBadge::Fail,
57        }
58    }
59
60    /// Returns the short uppercase status label (`PASS`, `SKIP`, or `FAIL`).
61    ///
62    /// # Returns
63    ///
64    /// - `&'static str` - Canonical uppercase status token.
65    #[must_use]
66    pub const fn label(self) -> &'static str {
67        match self {
68            Self::Passed => PIPELINE_STATUS_PASSED,
69            Self::SkippedUnavailable => PIPELINE_STATUS_SKIPPED,
70            Self::Failed => PIPELINE_STATUS_FAILED,
71        }
72    }
73}
74
75/// Aggregate result helpers on `BuildPipelineReport`.
76impl BuildPipelineReport {
77    /// Returns `true` when zero targets failed during this pipeline execution.
78    ///
79    /// # Returns
80    ///
81    /// - `bool` - Whether all non-skipped targets succeeded.
82    #[must_use]
83    pub fn all_succeeded(&self) -> bool {
84        self.get_failed_count() == 0
85    }
86}