euv-cli 0.50.0

Cross-platform CLI tool for the euv native UI framework supporting run, build, check, fmt, doctor, new, and Hyperlane SSE dynamic updates across all supported platforms.
Documentation
use super::*;

/// `[app]` section of an `euv.toml` project manifest.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct EuvAppConfig {
    /// Human-readable application display name.
    pub(crate) name: Option<String>,
    /// Optional explicit semantic version overriding `Cargo.toml`.
    pub(crate) version: Option<String>,
    /// Reverse-DNS bundle or application identifier (e.g. `dev.euv.app`).
    pub(crate) bundle_id: Option<String>,
    /// Default Cargo package name targeted by `euv build` / `euv run`.
    pub(crate) package: Option<String>,
    /// Optional custom PNG icon source path.
    pub(crate) icon: Option<PathBuf>,
    /// Default targets built when `--target` is omitted.
    pub(crate) default_targets: Vec<String>,
    /// Default render pipeline mode (`auto`, `software`, `hardware`, `hybrid`).
    pub(crate) render: Option<String>,
}

/// `[build]` section of an `euv.toml` project manifest.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct EuvBuildConfig {
    /// Default output directory for built platform bundles.
    pub(crate) out_dir: Option<PathBuf>,
    /// Default URL base prefix for Web bundles (e.g. `./` or `/app/`).
    pub(crate) base: Option<String>,
    /// Whether to emit raw `.wasm` bundles without `wasm-bindgen-cli`.
    #[get(type(copy))]
    pub(crate) raw_wasm: bool,
    /// Whether to skip optional `wasm-opt` size optimization.
    #[get(type(copy))]
    pub(crate) skip_wasm_opt: bool,
    /// Whether desktop bundles include the `euv` CLI binary alongside the app.
    #[get(type(copy))]
    pub(crate) include_cli: bool,
    /// Whether multi-target builds execute in parallel by default.
    #[get(type(copy))]
    pub(crate) parallel: bool,
    /// Preferred Android SDK API level (e.g. `35`).
    #[get(type(copy))]
    pub(crate) android_api_level: Option<u32>,
    /// Preferred Android Build-Tools version string (e.g. `"35.0.0"`).
    pub(crate) android_build_tools: Option<String>,
    /// Optional Apple Developer Team identifier for iOS signing.
    pub(crate) ios_team_id: Option<String>,
}

/// `[ota]` section of an `euv.toml` project manifest.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct EuvOtaConfig {
    /// Logical OTA project identifier.
    pub(crate) project: Option<String>,
    /// Default OTA release channel (e.g. `prod` or `dev`).
    pub(crate) channel: Option<String>,
    /// Local filesystem OTA update store directory.
    pub(crate) store: Option<PathBuf>,
    /// Target OTA update server base URL.
    pub(crate) server_url: Option<String>,
    /// Optional external reverse-proxy base URL.
    pub(crate) proxy_base: Option<String>,
}

/// `[docs]` section of an `euv.toml` project manifest.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct EuvDocsConfig {
    /// Source Markdown documentation directory.
    pub(crate) src: Option<PathBuf>,
    /// Output directory for built documentation sites.
    pub(crate) out: Option<PathBuf>,
    /// Site display title override.
    pub(crate) title: Option<String>,
    /// Optional URL base prefix.
    pub(crate) base: Option<String>,
    /// Whether `euv docs build` defaults to multi-locale WASM site bundling.
    #[get(type(copy))]
    pub(crate) wasm: bool,
}

/// Root parsed representation of an `euv.toml` project configuration file.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct EuvProjectConfig {
    /// Application identity and default target settings.
    pub(crate) app: EuvAppConfig,
    /// Cross-platform build and packaging defaults.
    pub(crate) build: EuvBuildConfig,
    /// Dynamic OTA update store and server defaults.
    pub(crate) ota: EuvOtaConfig,
    /// Documentation site generator defaults.
    pub(crate) docs: EuvDocsConfig,
}

/// Loaded `euv.toml` paired with its discovered filesystem location.
#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct LoadedEuvConfig {
    /// Absolute or resolved path to `euv.toml`.
    pub(crate) config_path: PathBuf,
    /// Parent project root directory containing `euv.toml`.
    pub(crate) project_root: PathBuf,
    /// Parsed `euv.toml` configuration model.
    pub(crate) config: EuvProjectConfig,
}

/// Resolved package metadata for one Cargo workspace member or standalone crate.
#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct WorkspacePackageInfo {
    /// Cargo package name (`[package].name`).
    pub(crate) name: String,
    /// Normalized Rust library target name (hyphens replaced with underscores or `[lib].name`).
    pub(crate) lib_name: String,
    /// Resolved semantic version string (inheriting `[workspace.package].version` when needed).
    pub(crate) version: String,
    /// Path to the package's `Cargo.toml`.
    pub(crate) manifest_path: PathBuf,
    /// Directory containing the package's `Cargo.toml`.
    pub(crate) crate_dir: PathBuf,
    /// Whether `[lib].crate-type` includes `"cdylib"`.
    #[get(type(copy))]
    pub(crate) has_cdylib: bool,
    /// Whether the package defines `[[bin]]` or `src/main.rs`.
    #[get(type(copy))]
    pub(crate) has_bin: bool,
}

/// Dynamic Cargo workspace metadata resolved directly from `Cargo.toml` and `Cargo.lock`.
#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
pub struct WorkspaceMetadata {
    /// Workspace or standalone crate root directory.
    pub(crate) workspace_root: PathBuf,
    /// Path to the root `Cargo.toml`.
    pub(crate) manifest_path: PathBuf,
    /// Dynamic workspace or package semantic version string.
    pub(crate) version: String,
    /// Deterministic numeric Android `versionCode` derived from `version`.
    #[get(type(copy))]
    pub(crate) version_code: u32,
    /// Discovered workspace member packages (including root package when present).
    pub(crate) packages: Vec<WorkspacePackageInfo>,
    /// Locked `wasm-bindgen` version discovered in `Cargo.lock`, if present.
    pub(crate) wasm_bindgen_version: Option<String>,
}