Skip to main content

euv_cli/builder/pipeline/
struct.rs

1use super::*;
2
3/// Unified multi-platform build pipeline configuration resolved from CLI flags and optional `euv.toml`.
4#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
5pub struct BuildPipelineConfig {
6    /// Workspace or standalone crate root directory.
7    pub(crate) workspace_root: PathBuf,
8    /// Explicit targets or target groups requested via `--target`.
9    pub(crate) targets: Vec<TargetArg>,
10    /// Shorthand for `--target all` across all 36 production targets.
11    #[get(type(copy))]
12    pub(crate) all: bool,
13    /// Optional Cargo package name override (`-p/--package`).
14    pub(crate) package: Option<String>,
15    /// Optional destination output directory (`--out-dir`).
16    pub(crate) out_dir: Option<PathBuf>,
17    /// Optional exact single-file output path (`--out-file`, e.g. Android APK).
18    pub(crate) out_file: Option<PathBuf>,
19    /// Optional destination archive file path (`--archive`, `.tar.gz` or `.zip`).
20    pub(crate) archive: Option<PathBuf>,
21    /// Optional URL base prefix for Web bundles (`--base`).
22    pub(crate) base: Option<String>,
23    /// When `true`, skips targets whose host OS or SDK prerequisites are missing instead of failing.
24    #[get(type(copy))]
25    pub(crate) skip_unavailable: bool,
26    /// When `true`, executes independent targets concurrently across a bounded worker pool.
27    #[get(type(copy))]
28    pub(crate) parallel: bool,
29    /// Optional concurrency ceiling (`-j/--jobs`) when parallel execution is enabled.
30    #[get(type(copy))]
31    pub(crate) jobs: Option<usize>,
32    /// When `true`, writes a deterministic SHA-256 `euv-release.json` inventory for staged directories.
33    #[get(type(copy))]
34    pub(crate) manifest: bool,
35    /// When `true`, verifies bundle integrity, SHA-256 manifests, zero-JS rules, and release AI-schema stripping.
36    #[get(type(copy))]
37    pub(crate) verify: bool,
38    /// When `true`, builds raw `.wasm` + icons + `build-plan.json` without `wasm-bindgen-cli`.
39    #[get(type(copy))]
40    pub(crate) raw_wasm: bool,
41    /// When `true`, skips optional binaryen `wasm-opt` optimization on Web and ecosystem WASM builds.
42    #[get(type(copy))]
43    pub(crate) skip_wasm_opt: bool,
44    /// When `true`, builds `default` plus all `theme-*` feature variants for Web targets.
45    #[get(type(copy))]
46    pub(crate) theme_variants: bool,
47    /// When `true`, skips automatic simulator/emulator launch after mobile builds.
48    #[get(type(copy))]
49    pub(crate) no_launch: bool,
50    /// When `true`, installs built Android/Wear OS/HarmonyOS bundles onto a connected device.
51    #[get(type(copy))]
52    pub(crate) install: bool,
53    /// When `true`, runs post-build headless smoke verification on desktop/terminal builds.
54    #[get(type(copy))]
55    pub(crate) smoke: bool,
56    /// When `true`, also compiles and stages `euv` CLI binary alongside desktop app binaries.
57    #[get(type(copy))]
58    pub(crate) include_cli: bool,
59    /// Optional explicit semantic version override (`--version`).
60    pub(crate) version: Option<String>,
61    /// Target native CPU ABIs (`--abi`, repeatable/comma-separated).
62    pub(crate) abis: Vec<String>,
63    /// Additional Cargo feature flags (`--features`, repeatable/comma-separated).
64    pub(crate) features: Vec<String>,
65    /// Optional device, simulator UDID, or AVD identifier (`--device`).
66    pub(crate) device: Option<String>,
67    /// Optional custom source PNG icon path overriding the default brand mark (`--icon`).
68    pub(crate) icon: Option<PathBuf>,
69    /// Optional HarmonyOS form factor profile (`--form-factor`).
70    #[get(type(copy))]
71    pub(crate) form_factor: HarmonyFormFactorArg,
72    /// Optional render pipeline mode override (`--render`; defaults to `hardware` on Apple mobile/watch and `auto` elsewhere).
73    #[get(type(copy))]
74    pub(crate) render: Option<RenderArg>,
75    /// When `true`, compiles targets in release optimization profile (`--release`).
76    #[get(type(copy))]
77    pub(crate) release: bool,
78}
79
80/// Execution outcome recorded for one target inside `BuildPipelineReport`.
81#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
82pub struct TargetBuildOutcome {
83    /// Canonical lowercase target label (e.g. `"web"`, `"macos"`, `"android"`).
84    pub(crate) target: String,
85    /// Final target status (`Passed`, `SkippedUnavailable`, or `Failed`).
86    #[get(type(copy))]
87    pub(crate) status: TargetBuildStatus,
88    /// Wall-clock target duration in milliseconds.
89    #[get(type(copy))]
90    pub(crate) elapsed_ms: u64,
91    /// Primary generated artifact file or output directory path, when present.
92    #[new(skip)]
93    pub(crate) artifact_path: Option<String>,
94    /// Packaged archive file path (`.tar.gz` / `.zip`), when created.
95    #[new(skip)]
96    pub(crate) archive_path: Option<String>,
97    /// Generated `euv-release.json` manifest path, when created.
98    #[new(skip)]
99    pub(crate) manifest_path: Option<String>,
100    /// Human-readable status detail, artifact summary, missing prerequisites, or error diagnostic.
101    pub(crate) detail: String,
102    /// Actionable install command hint when skipped due to missing SDK/toolchain prerequisites.
103    #[new(skip)]
104    pub(crate) install_hint: Option<String>,
105}
106
107/// Aggregate multi-platform build summary produced by `execute_build_pipeline`.
108#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
109pub struct BuildPipelineReport {
110    /// Resolved dynamic semantic version applied across all built targets.
111    pub(crate) version: String,
112    /// Resolved primary Cargo package name.
113    pub(crate) package: String,
114    /// Whether bounded parallel target execution was active.
115    #[get(type(copy))]
116    pub(crate) parallel: bool,
117    /// Effective maximum concurrent target worker count.
118    #[get(type(copy))]
119    pub(crate) jobs: usize,
120    /// Total number of targets that succeeded.
121    #[get(type(copy))]
122    pub(crate) passed_count: usize,
123    /// Total number of targets skipped cleanly under `--skip-unavailable`.
124    #[get(type(copy))]
125    pub(crate) skipped_count: usize,
126    /// Total number of targets that failed.
127    #[get(type(copy))]
128    pub(crate) failed_count: usize,
129    /// Total wall-clock pipeline execution time in milliseconds.
130    #[get(type(copy))]
131    pub(crate) total_elapsed_ms: u64,
132    /// Per-target execution outcomes in deterministic target order.
133    pub(crate) outcomes: Vec<TargetBuildOutcome>,
134}
135
136/// Resolved workspace, config, and flag context shared across pipeline target builders.
137pub(crate) struct ResolvedPipelineContext {
138    /// Absolute or resolved workspace root directory.
139    pub(crate) workspace_root: PathBuf,
140    /// Resolved semantic version string.
141    pub(crate) version: String,
142    /// Resolved primary Cargo package name.
143    pub(crate) package: String,
144    /// Resolved app display label.
145    pub(crate) app_label: Option<String>,
146    /// Resolved reverse-DNS bundle identifier.
147    pub(crate) bundle_id: Option<String>,
148    /// Resolved URL base prefix for Web builds.
149    pub(crate) base_url: String,
150    /// Resolved optional custom PNG icon source path.
151    pub(crate) icon_path: Option<PathBuf>,
152    /// Resolved optional Android API level override.
153    pub(crate) android_api_level: Option<String>,
154    /// Resolved optional Android build-tools version override.
155    pub(crate) android_build_tools: Option<String>,
156    /// Effective `--raw-wasm` toggle combining CLI and `euv.toml`.
157    pub(crate) raw_wasm: bool,
158    /// Effective `--skip-wasm-opt` toggle combining CLI and `euv.toml`.
159    pub(crate) skip_wasm_opt: bool,
160    /// Effective `--include-cli` toggle combining CLI and `euv.toml`.
161    pub(crate) include_cli: bool,
162    /// Optional base output directory combining CLI and `euv.toml`.
163    pub(crate) out_dir: Option<PathBuf>,
164    /// Whether more than one concrete target is running in this pipeline invocation.
165    pub(crate) multi_target: bool,
166}