1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
use super::*;
/// Configuration for building the shared zero-SIMD WebAssembly host core (`euv_app.wasm` + CJS/ESM glue).
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct SharedWasmHostConfig {
/// Root path of the `euv` workspace containing `example/`.
pub(crate) workspace_root: PathBuf,
/// Optional staging directory overriding `target/mobile-hosts/euv-host-wasm`.
pub(crate) stage_dir: Option<PathBuf>,
/// Whether to compile in release mode (`panic=abort` + optional `wasm-opt -Oz` + AI-schema check).
#[get(type(copy))]
pub(crate) release: bool,
/// Whether to skip the optional `wasm-opt` pass.
#[get(type(copy))]
pub(crate) skip_wasm_opt: bool,
/// Whether to reuse existing staged WASM/glue files when present on disk.
#[get(type(copy))]
pub(crate) reuse_existing: bool,
}
/// Output paths produced by compiling the shared zero-DOM WebAssembly host core.
#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct SharedWasmHostArtifacts {
/// Compiled (and optionally `wasm-opt` optimized) `euv_app.wasm` path.
pub(crate) wasm_path: PathBuf,
/// Patched CommonJS glue path (`euv_wasm_glue.cjs.js`).
pub(crate) glue_cjs_path: PathBuf,
/// Patched ES Module glue path (`euv_wasm_glue.esm.js`).
pub(crate) glue_esm_path: PathBuf,
/// Final `euv_app.wasm` size in bytes.
#[get(type(copy))]
pub(crate) wasm_bytes: u64,
}
/// Configuration for generating and compiling a HarmonyOS / OpenHarmony Stage-Model project.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct HarmonyBuildConfig {
/// Root directory of the `euv` workspace.
pub(crate) workspace_root: PathBuf,
/// Target HarmonyOS device form factor (`phone`, `tablet`, `2in1`, `universal`, `foldable`, `wearable`, `tv`, `car`).
#[get(type(copy))]
pub(crate) device_kind: HarmonyDeviceKind,
/// Optional explicit ABI list; empty triggers auto-selection (`[arm64-v8a, x86_64]` for PC/universal, `[arm64-v8a]` otherwise).
pub(crate) abis: Vec<HarmonyAbi>,
/// Optional explicit semantic version overriding workspace `Cargo.toml`.
pub(crate) app_version: Option<String>,
/// Optional output directory overriding `dist/harmony/<device>`.
pub(crate) out_dir: Option<PathBuf>,
/// Optional staging directory overriding `target/mobile-hosts/harmony-<device>`.
pub(crate) build_dir: Option<PathBuf>,
/// Optional OpenHarmony SDK root directory overriding `OHOS_SDK_HOME` auto-detection.
pub(crate) ohos_sdk_root: Option<PathBuf>,
/// When `true`, generates the Stage-Model + N-API + Rust shell without invoking OHOS NDK/hvigorw.
#[get(type(copy))]
pub(crate) shell_only: bool,
/// When `true` and a `.hap` is assembled, installs it via `hdc install -r`.
#[get(type(copy))]
pub(crate) install_hap: bool,
}
/// Report emitted after generating or compiling a HarmonyOS / OpenHarmony project.
#[derive(Clone, Debug, Deserialize, Eq, Getter, PartialEq, Serialize)]
pub struct HarmonyBuildReport {
/// Device form factor label (`phone`, `2in1`, `wearable`, etc.).
pub(crate) device_kind: String,
/// Resolved semantic version written into `oh-package.json5` and `AppScope/app.json5`.
pub(crate) version: String,
/// Computed HarmonyOS integer `versionCode`.
#[get(type(copy))]
pub(crate) version_code: u32,
/// Generated HarmonyOS project root directory.
pub(crate) out_dir: PathBuf,
/// Rust staticlib host build directory.
pub(crate) build_dir: PathBuf,
/// Paths to compiled `libeuv_harmony_host.so` binaries (empty in `shell_only` or without OHOS NDK).
pub(crate) compiled_so_paths: Vec<PathBuf>,
/// Optional assembled `.hap` path when `hvigorw` was executed.
pub(crate) hap_path: Option<PathBuf>,
/// Whether `hdc install -r` deployed the `.hap`.
#[get(type(copy))]
pub(crate) installed: bool,
}
/// Configuration for generating and packaging MiniApp vendor hosts (13 ecosystems).
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct MiniAppBuildConfig {
/// Root directory of the `euv` workspace.
pub(crate) workspace_root: PathBuf,
/// Target MiniApp vendors to generate (empty defaults to all 13 vendors).
pub(crate) vendors: Vec<MiniAppVendor>,
/// Optional explicit semantic version overriding workspace `Cargo.toml`.
pub(crate) app_version: Option<String>,
/// Optional output root overriding `dist/miniapp`.
pub(crate) out_base: Option<PathBuf>,
/// Whether to compile the shared WASM core in release profile.
#[get(type(copy))]
pub(crate) release: bool,
/// When `true`, skips shared WASM core and HarmonyOS native compilation.
#[get(type(copy))]
pub(crate) shell_only: bool,
/// Whether to skip optional `wasm-opt` when compiling the shared WASM core.
#[get(type(copy))]
pub(crate) skip_wasm_opt: bool,
}
/// Report produced after building one or more MiniApp vendor projects.
#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct MiniAppBuildReport {
/// Resolved semantic version used in generated manifests.
pub(crate) version: String,
/// Generated vendor labels and output directories.
pub(crate) generated_dirs: Vec<PathBuf>,
/// Whether the shared zero-DOM WASM core was compiled and bundled into JS vendors.
#[get(type(copy))]
pub(crate) wasm_bundled: bool,
}
/// Configuration for generating and packaging QuickApp vendor projects (`alliance`, `huawei`).
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct QuickAppBuildConfig {
/// Root directory of the `euv` workspace.
pub(crate) workspace_root: PathBuf,
/// Target QuickApp vendors (empty defaults to `[Alliance, Huawei]`).
pub(crate) vendors: Vec<QuickAppVendor>,
/// Optional explicit semantic version overriding workspace `Cargo.toml`.
pub(crate) app_version: Option<String>,
/// Optional output root overriding `dist/quickapp`.
pub(crate) out_base: Option<PathBuf>,
/// Whether to compile the shared WASM core in release profile.
#[get(type(copy))]
pub(crate) release: bool,
/// When `true`, skips shared WASM core compilation and `hap release` `.rpk` packaging.
#[get(type(copy))]
pub(crate) shell_only: bool,
/// Whether to skip optional `wasm-opt`.
#[get(type(copy))]
pub(crate) skip_wasm_opt: bool,
}
/// Report produced after building one or more QuickApp vendor projects.
#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct QuickAppBuildReport {
/// Resolved semantic version written into `package.json` and `src/manifest.json`.
pub(crate) version: String,
/// Computed numeric `versionCode`.
#[get(type(copy))]
pub(crate) version_code: u32,
/// Generated QuickApp vendor project directories.
pub(crate) generated_dirs: Vec<PathBuf>,
/// Whether the shared zero-DOM WASM core was compiled and copied.
#[get(type(copy))]
pub(crate) wasm_bundled: bool,
}
/// Configuration for generating and building smartwatch wearable hosts across 8 ecosystems.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct WearableBuildConfig {
/// Root directory of the `euv` workspace.
pub(crate) workspace_root: PathBuf,
/// Target wearable vendors (empty defaults to all 8 vendors).
pub(crate) vendors: Vec<WearableVendor>,
/// Optional explicit semantic version overriding workspace `Cargo.toml`.
pub(crate) app_version: Option<String>,
/// Optional output root overriding `dist/wearable`.
pub(crate) out_base: Option<PathBuf>,
/// Whether to compile native/WASM artifacts in release profile.
#[get(type(copy))]
pub(crate) release: bool,
/// When `true`, generates project shells without invoking NDK/Xcode/OHOS/WASM compilers.
#[get(type(copy))]
pub(crate) shell_only: bool,
/// When `true`, installs built Wear OS APK / HarmonyOS Watch HAP where supported.
#[get(type(copy))]
pub(crate) install: bool,
/// Whether to skip optional `wasm-opt`.
#[get(type(copy))]
pub(crate) skip_wasm_opt: bool,
}
/// Report produced after building one or more smartwatch wearable targets.
#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct WearableBuildReport {
/// Resolved semantic version written into wearable manifests.
pub(crate) version: String,
/// Computed numeric `versionCode`.
#[get(type(copy))]
pub(crate) version_code: u32,
/// Generated wearable project directories or artifact paths.
pub(crate) generated_paths: Vec<PathBuf>,
/// Whether the shared zero-DOM WASM core was compiled and bundled into WASM watches.
#[get(type(copy))]
pub(crate) wasm_bundled: bool,
}