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
use super::*;
/// Resolved Android SDK, NDK, and build-tools executables discovered on the host machine.
#[derive(Clone, Debug, Deserialize, Eq, Getter, PartialEq, Serialize)]
pub struct AndroidToolchain {
/// Android SDK root directory (`ANDROID_HOME` / `ANDROID_SDK_ROOT`).
pub(crate) sdk_root: PathBuf,
/// Android NDK installation root directory.
pub(crate) ndk_root: PathBuf,
/// Target Android SDK API level (for example `"35"`).
pub(crate) api_level: String,
/// Android SDK build-tools version directory (for example `"35.0.0"`).
pub(crate) build_tools: String,
/// NDK LLVM prebuilt host tag (`darwin-x86_64`, `linux-x86_64`, or `windows-x86_64`).
pub(crate) host_tag: String,
/// Directory containing NDK LLVM cross-compilers and `llvm-ar`.
pub(crate) ndk_llvm_bin: PathBuf,
/// Path to `platforms/android-<api>/android.jar`.
pub(crate) android_jar: PathBuf,
/// Path to the `aapt2` resource compiler and linker binary.
pub(crate) aapt2_bin: PathBuf,
/// Path to the `d8` DEX compiler binary.
pub(crate) d8_bin: PathBuf,
/// Path to the `zipalign` APK alignment binary.
pub(crate) zipalign_bin: PathBuf,
/// Path to the `apksigner` APK signing and verification binary.
pub(crate) apksigner_bin: PathBuf,
/// Path to the `adb` device bridge binary.
pub(crate) adb_bin: PathBuf,
/// Path to the Android emulator binary.
pub(crate) emulator_bin: PathBuf,
}
/// Configuration for building a native Rust + JNI Android or Wear OS APK.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct AndroidBuildConfig {
/// Root path of the `euv` workspace containing `Cargo.toml` and `example/`.
pub(crate) workspace_root: PathBuf,
/// Android device kind (`Phone` or `WearOs`).
#[get(type(copy))]
pub(crate) target_kind: AndroidTargetKind,
/// Selected default render pipeline mode for the Android host.
#[get(type(copy))]
pub(crate) render_mode: RenderArg,
/// Native CPU ABIs compiled and packed into `lib/<abi>/libeuv_android_host.so`.
pub(crate) abis: Vec<AndroidAbi>,
/// Optional explicit semantic version overriding workspace `Cargo.toml`.
pub(crate) app_version: Option<String>,
/// Optional explicit numeric `android:versionCode` overriding semver calculation.
#[get(type(copy))]
pub(crate) version_code: Option<u32>,
/// Android application package identifier (default `vip.ltpp.euv.showcase`).
pub(crate) package_id: String,
/// Optional application launcher display label.
pub(crate) app_label: Option<String>,
/// Optional final APK output path (defaults to `dist/{android,wearos}/EuvShowcase*.apk`).
pub(crate) out_file: Option<PathBuf>,
/// Optional staging directory for generated Rust/Java host files.
pub(crate) build_dir: Option<PathBuf>,
/// Optional custom signing keystore path overriding `EUV_ANDROID_KEYSTORE` and debug keystore.
pub(crate) keystore_path: Option<PathBuf>,
/// Optional signing keystore password.
pub(crate) keystore_pass: Option<String>,
/// Optional signing key password.
pub(crate) key_pass: Option<String>,
/// Optional signing key alias.
pub(crate) key_alias: Option<String>,
/// Whether to compile the native library in release profile with AI-schema stripping check.
#[get(type(copy))]
pub(crate) release: bool,
/// Whether to install and launch the signed APK via `adb` after packaging.
#[get(type(copy))]
pub(crate) install: bool,
/// When `true`, generates the Android host project and resources without invoking NDK/SDK tools.
#[get(type(copy))]
pub(crate) shell_only: bool,
/// Optional Android API level override (defaults to `ANDROID_API_LEVEL` or `"35"`).
pub(crate) api_level: Option<String>,
/// Optional Android build-tools override (defaults to `ANDROID_BUILD_TOOLS` or `"35.0.0"`).
pub(crate) build_tools: Option<String>,
/// Optional Android emulator AVD name booted when `--install` finds no online device.
pub(crate) avd_name: Option<String>,
}
/// Machine-readable report produced after generating or building an Android / Wear OS APK.
#[derive(Clone, Debug, Deserialize, Eq, Getter, PartialEq, Serialize)]
pub struct AndroidBuildReport {
/// Target kind label (`phone` or `wearos`).
pub(crate) target_kind: String,
/// Resolved semantic version written into `AndroidManifest.xml` and host `Cargo.toml`.
pub(crate) version: String,
/// Resolved numeric `android:versionCode`.
#[get(type(copy))]
pub(crate) version_code: u32,
/// Compiled Android ABI directory names.
pub(crate) abis: Vec<String>,
/// Directory containing generated Rust/Java host files and intermediate artifacts.
pub(crate) build_dir: PathBuf,
/// Final signed APK destination path.
pub(crate) apk_path: PathBuf,
/// Final signed APK byte size (`0` when `shell_only` is `true`).
#[get(type(copy))]
pub(crate) apk_bytes: u64,
/// Whether all compiled release `.so` binaries passed the zero AI-schema marker check.
#[get(type(copy))]
pub(crate) ai_schema_clean: bool,
/// Whether the APK was installed and launched on at least one online `adb` device.
#[get(type(copy))]
pub(crate) installed: bool,
}