euv_cli/builder/android/struct.rs
1use super::*;
2
3/// Resolved Android SDK, NDK, and build-tools executables discovered on the host machine.
4#[derive(Clone, Debug, Deserialize, Eq, Getter, PartialEq, Serialize)]
5pub struct AndroidToolchain {
6 /// Android SDK root directory (`ANDROID_HOME` / `ANDROID_SDK_ROOT`).
7 pub(crate) sdk_root: PathBuf,
8 /// Android NDK installation root directory.
9 pub(crate) ndk_root: PathBuf,
10 /// Target Android SDK API level (for example `"35"`).
11 pub(crate) api_level: String,
12 /// Android SDK build-tools version directory (for example `"35.0.0"`).
13 pub(crate) build_tools: String,
14 /// NDK LLVM prebuilt host tag (`darwin-x86_64`, `linux-x86_64`, or `windows-x86_64`).
15 pub(crate) host_tag: String,
16 /// Directory containing NDK LLVM cross-compilers and `llvm-ar`.
17 pub(crate) ndk_llvm_bin: PathBuf,
18 /// Path to `platforms/android-<api>/android.jar`.
19 pub(crate) android_jar: PathBuf,
20 /// Path to the `aapt2` resource compiler and linker binary.
21 pub(crate) aapt2_bin: PathBuf,
22 /// Path to the `d8` DEX compiler binary.
23 pub(crate) d8_bin: PathBuf,
24 /// Path to the `zipalign` APK alignment binary.
25 pub(crate) zipalign_bin: PathBuf,
26 /// Path to the `apksigner` APK signing and verification binary.
27 pub(crate) apksigner_bin: PathBuf,
28 /// Path to the `adb` device bridge binary.
29 pub(crate) adb_bin: PathBuf,
30 /// Path to the Android emulator binary.
31 pub(crate) emulator_bin: PathBuf,
32}
33
34/// Configuration for building a native Rust + JNI Android or Wear OS APK.
35#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
36pub struct AndroidBuildConfig {
37 /// Root path of the `euv` workspace containing `Cargo.toml` and `example/`.
38 pub(crate) workspace_root: PathBuf,
39 /// Android device kind (`Phone` or `WearOs`).
40 #[get(type(copy))]
41 pub(crate) target_kind: AndroidTargetKind,
42 /// Selected default render pipeline mode for the Android host.
43 #[get(type(copy))]
44 pub(crate) render_mode: RenderArg,
45 /// Native CPU ABIs compiled and packed into `lib/<abi>/libeuv_android_host.so`.
46 pub(crate) abis: Vec<AndroidAbi>,
47 /// Optional explicit semantic version overriding workspace `Cargo.toml`.
48 pub(crate) app_version: Option<String>,
49 /// Optional explicit numeric `android:versionCode` overriding semver calculation.
50 #[get(type(copy))]
51 pub(crate) version_code: Option<u32>,
52 /// Android application package identifier (default `vip.ltpp.euv.showcase`).
53 pub(crate) package_id: String,
54 /// Optional application launcher display label.
55 pub(crate) app_label: Option<String>,
56 /// Optional final APK output path (defaults to `dist/{android,wearos}/EuvShowcase*.apk`).
57 pub(crate) out_file: Option<PathBuf>,
58 /// Optional staging directory for generated Rust/Java host files.
59 pub(crate) build_dir: Option<PathBuf>,
60 /// Optional custom signing keystore path overriding `EUV_ANDROID_KEYSTORE` and debug keystore.
61 pub(crate) keystore_path: Option<PathBuf>,
62 /// Optional signing keystore password.
63 pub(crate) keystore_pass: Option<String>,
64 /// Optional signing key password.
65 pub(crate) key_pass: Option<String>,
66 /// Optional signing key alias.
67 pub(crate) key_alias: Option<String>,
68 /// Whether to compile the native library in release profile with AI-schema stripping check.
69 #[get(type(copy))]
70 pub(crate) release: bool,
71 /// Whether to install and launch the signed APK via `adb` after packaging.
72 #[get(type(copy))]
73 pub(crate) install: bool,
74 /// When `true`, generates the Android host project and resources without invoking NDK/SDK tools.
75 #[get(type(copy))]
76 pub(crate) shell_only: bool,
77 /// Optional Android API level override (defaults to `ANDROID_API_LEVEL` or `"35"`).
78 pub(crate) api_level: Option<String>,
79 /// Optional Android build-tools override (defaults to `ANDROID_BUILD_TOOLS` or `"35.0.0"`).
80 pub(crate) build_tools: Option<String>,
81 /// Optional Android emulator AVD name booted when `--install` finds no online device.
82 pub(crate) avd_name: Option<String>,
83}
84
85/// Machine-readable report produced after generating or building an Android / Wear OS APK.
86#[derive(Clone, Debug, Deserialize, Eq, Getter, PartialEq, Serialize)]
87pub struct AndroidBuildReport {
88 /// Target kind label (`phone` or `wearos`).
89 pub(crate) target_kind: String,
90 /// Resolved semantic version written into `AndroidManifest.xml` and host `Cargo.toml`.
91 pub(crate) version: String,
92 /// Resolved numeric `android:versionCode`.
93 #[get(type(copy))]
94 pub(crate) version_code: u32,
95 /// Compiled Android ABI directory names.
96 pub(crate) abis: Vec<String>,
97 /// Directory containing generated Rust/Java host files and intermediate artifacts.
98 pub(crate) build_dir: PathBuf,
99 /// Final signed APK destination path.
100 pub(crate) apk_path: PathBuf,
101 /// Final signed APK byte size (`0` when `shell_only` is `true`).
102 #[get(type(copy))]
103 pub(crate) apk_bytes: u64,
104 /// Whether all compiled release `.so` binaries passed the zero AI-schema marker check.
105 #[get(type(copy))]
106 pub(crate) ai_schema_clean: bool,
107 /// Whether the APK was installed and launched on at least one online `adb` device.
108 #[get(type(copy))]
109 pub(crate) installed: bool,
110}