euv_cli/config/struct.rs
1use super::*;
2
3/// `[app]` section of an `euv.toml` project manifest.
4#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
5pub struct EuvAppConfig {
6 /// Human-readable application display name.
7 pub(crate) name: Option<String>,
8 /// Optional explicit semantic version overriding `Cargo.toml`.
9 pub(crate) version: Option<String>,
10 /// Reverse-DNS bundle or application identifier (e.g. `dev.euv.app`).
11 pub(crate) bundle_id: Option<String>,
12 /// Default Cargo package name targeted by `euv build` / `euv run`.
13 pub(crate) package: Option<String>,
14 /// Optional custom PNG icon source path.
15 pub(crate) icon: Option<PathBuf>,
16 /// Default targets built when `--target` is omitted.
17 pub(crate) default_targets: Vec<String>,
18 /// Default render pipeline mode (`auto`, `software`, `hardware`, `hybrid`).
19 pub(crate) render: Option<String>,
20}
21
22/// `[build]` section of an `euv.toml` project manifest.
23#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
24pub struct EuvBuildConfig {
25 /// Default output directory for built platform bundles.
26 pub(crate) out_dir: Option<PathBuf>,
27 /// Default URL base prefix for Web bundles (e.g. `./` or `/app/`).
28 pub(crate) base: Option<String>,
29 /// Whether to emit raw `.wasm` bundles without `wasm-bindgen-cli`.
30 #[get(type(copy))]
31 pub(crate) raw_wasm: bool,
32 /// Whether to skip optional `wasm-opt` size optimization.
33 #[get(type(copy))]
34 pub(crate) skip_wasm_opt: bool,
35 /// Whether desktop bundles include the `euv` CLI binary alongside the app.
36 #[get(type(copy))]
37 pub(crate) include_cli: bool,
38 /// Whether multi-target builds execute in parallel by default.
39 #[get(type(copy))]
40 pub(crate) parallel: bool,
41 /// Preferred Android SDK API level (e.g. `35`).
42 #[get(type(copy))]
43 pub(crate) android_api_level: Option<u32>,
44 /// Preferred Android Build-Tools version string (e.g. `"35.0.0"`).
45 pub(crate) android_build_tools: Option<String>,
46 /// Optional Apple Developer Team identifier for iOS signing.
47 pub(crate) ios_team_id: Option<String>,
48}
49
50/// `[ota]` section of an `euv.toml` project manifest.
51#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
52pub struct EuvOtaConfig {
53 /// Logical OTA project identifier.
54 pub(crate) project: Option<String>,
55 /// Default OTA release channel (e.g. `prod` or `dev`).
56 pub(crate) channel: Option<String>,
57 /// Local filesystem OTA update store directory.
58 pub(crate) store: Option<PathBuf>,
59 /// Target OTA update server base URL.
60 pub(crate) server_url: Option<String>,
61 /// Optional external reverse-proxy base URL.
62 pub(crate) proxy_base: Option<String>,
63}
64
65/// `[docs]` section of an `euv.toml` project manifest.
66#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
67pub struct EuvDocsConfig {
68 /// Source Markdown documentation directory.
69 pub(crate) src: Option<PathBuf>,
70 /// Output directory for built documentation sites.
71 pub(crate) out: Option<PathBuf>,
72 /// Site display title override.
73 pub(crate) title: Option<String>,
74 /// Optional URL base prefix.
75 pub(crate) base: Option<String>,
76 /// Whether `euv docs build` defaults to multi-locale WASM site bundling.
77 #[get(type(copy))]
78 pub(crate) wasm: bool,
79}
80
81/// Root parsed representation of an `euv.toml` project configuration file.
82#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
83pub struct EuvProjectConfig {
84 /// Application identity and default target settings.
85 pub(crate) app: EuvAppConfig,
86 /// Cross-platform build and packaging defaults.
87 pub(crate) build: EuvBuildConfig,
88 /// Dynamic OTA update store and server defaults.
89 pub(crate) ota: EuvOtaConfig,
90 /// Documentation site generator defaults.
91 pub(crate) docs: EuvDocsConfig,
92}
93
94/// Loaded `euv.toml` paired with its discovered filesystem location.
95#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
96pub struct LoadedEuvConfig {
97 /// Absolute or resolved path to `euv.toml`.
98 pub(crate) config_path: PathBuf,
99 /// Parent project root directory containing `euv.toml`.
100 pub(crate) project_root: PathBuf,
101 /// Parsed `euv.toml` configuration model.
102 pub(crate) config: EuvProjectConfig,
103}
104
105/// Resolved package metadata for one Cargo workspace member or standalone crate.
106#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
107pub struct WorkspacePackageInfo {
108 /// Cargo package name (`[package].name`).
109 pub(crate) name: String,
110 /// Normalized Rust library target name (hyphens replaced with underscores or `[lib].name`).
111 pub(crate) lib_name: String,
112 /// Resolved semantic version string (inheriting `[workspace.package].version` when needed).
113 pub(crate) version: String,
114 /// Path to the package's `Cargo.toml`.
115 pub(crate) manifest_path: PathBuf,
116 /// Directory containing the package's `Cargo.toml`.
117 pub(crate) crate_dir: PathBuf,
118 /// Whether `[lib].crate-type` includes `"cdylib"`.
119 #[get(type(copy))]
120 pub(crate) has_cdylib: bool,
121 /// Whether the package defines `[[bin]]` or `src/main.rs`.
122 #[get(type(copy))]
123 pub(crate) has_bin: bool,
124}
125
126/// Dynamic Cargo workspace metadata resolved directly from `Cargo.toml` and `Cargo.lock`.
127#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
128pub struct WorkspaceMetadata {
129 /// Workspace or standalone crate root directory.
130 pub(crate) workspace_root: PathBuf,
131 /// Path to the root `Cargo.toml`.
132 pub(crate) manifest_path: PathBuf,
133 /// Dynamic workspace or package semantic version string.
134 pub(crate) version: String,
135 /// Deterministic numeric Android `versionCode` derived from `version`.
136 #[get(type(copy))]
137 pub(crate) version_code: u32,
138 /// Discovered workspace member packages (including root package when present).
139 pub(crate) packages: Vec<WorkspacePackageInfo>,
140 /// Locked `wasm-bindgen` version discovered in `Cargo.lock`, if present.
141 pub(crate) wasm_bindgen_version: Option<String>,
142}