Skip to main content

euv_cli/platform/
struct.rs

1use super::*;
2
3/// Target platform metadata describing Rust triple, system APIs, and output bundle.
4#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
5pub struct TargetSpec {
6    /// Human-readable target key (`web`, `android`, `ios`, `ios-sim`, `ipad`, `ipad-sim`, `macos`, `windows`, `linux`, etc.).
7    pub(crate) name: String,
8    /// Rust compiler target triple.
9    pub(crate) rust_triple: String,
10    /// Direct OS/browser system API stack used by `euv-core`.
11    pub(crate) system_api: String,
12    /// Primary packaged output artifact path.
13    pub(crate) artifact: String,
14    /// Core `PlatformKind` discriminant.
15    pub(crate) platform_kind: String,
16    /// Preferred hardware GPU backend reported by `euv-core`.
17    pub(crate) preferred_gpu: String,
18}
19
20/// Single executable command step inside a cross-platform `BuildPlan`.
21#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
22pub struct BuildStep {
23    /// Human-readable purpose of this step.
24    pub(crate) description: String,
25    /// Executable program name.
26    pub(crate) program: String,
27    /// Command-line arguments passed to `program`.
28    pub(crate) args: Vec<String>,
29}
30
31/// Complete declarative build plan for one target platform.
32#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
33pub struct BuildPlan {
34    /// Target specification metadata.
35    pub(crate) target: TargetSpec,
36    /// Selected default render mode (`Auto`, `Software`, `Hardware`, `Hybrid`).
37    pub(crate) render_mode: String,
38    /// Whether release optimization profile is enabled.
39    #[get(type(copy))]
40    pub(crate) release: bool,
41    /// Ordered build and packaging steps.
42    pub(crate) steps: Vec<BuildStep>,
43}
44
45/// Per-target build readiness assessment on the active host machine.
46#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
47pub struct TargetCapability {
48    /// Canonical target name (e.g. `android`, `ios-sim`, `web`).
49    pub(crate) target: String,
50    /// Rust compiler target triple.
51    pub(crate) triple: String,
52    /// High-level ecosystem category label.
53    pub(crate) category: String,
54    /// Whether the current host OS can natively build this target.
55    #[get(type(copy))]
56    pub(crate) host_supported: bool,
57    /// Whether all required Rust targets, SDKs, and CLI tools are present.
58    #[get(type(copy))]
59    pub(crate) ready: bool,
60    /// Names of missing triples, tools, or SDK environment variables.
61    pub(crate) missing_tools: Vec<String>,
62    /// Exact commands or instructions to satisfy missing prerequisites.
63    pub(crate) install_hints: Vec<String>,
64}
65
66/// Snapshot of host OS, architecture, installed Rust targets, SDK paths, and CLI build tools.
67#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
68pub struct HostCapabilityProbe {
69    /// Host operating system (`macos`, `linux`, `windows`).
70    pub(crate) host_os: String,
71    /// Host CPU architecture (`aarch64`, `x86_64`, etc.).
72    pub(crate) host_arch: String,
73    /// Rust compiler target triples reported by `rustup target list --installed`.
74    pub(crate) installed_triples: Vec<String>,
75    /// Detected build tool versions keyed by tool name.
76    pub(crate) available_tools: BTreeMap<String, String>,
77    /// Detected SDK directory paths keyed by environment variable name.
78    pub(crate) env_sdks: BTreeMap<String, String>,
79}