android_build/lib.rs
1//! Supports Android-specific Java build and run tasks in Rust projects from a Cargo build script.
2//!
3//! ## Tools exposed by this crate
4//! * javac: use the [`JavaBuild`] struct.
5//! * java: use the [`JavaRun`] struct.
6// //! * d8: through the [`Dexer`] struct.
7//!
8//! ## Environment variables in use
9//! * `ANDROID_HOME` or `ANDROID_SDK_ROOT`: path to the Android SDK directory.
10//! * `ANDROID_BUILD_TOOLS_VERSION`: the version of the Android build tools.
11//! * Examples: `33.0.1`, `34.0.0-rc2`.
12//! * This must be fully specified all in one string.
13//! * `ANDROID_PLATFORM`, `ANDROID_API_LEVEL`, or `ANDROID_SDK_VERSION`:
14//! the platform version string (aka API level, SDK version) being targeted for compilation.
15//! * All three of these environment variables are treated identically.
16//! * Examples: `34`, `android-34`, `android-33`, `33`.
17//! * If an SDK extension must be specified, use the full string with the `android` prefix
18//! like so: `android-33-ext4`.
19//! * This may or may not include the SDK extension level as a suffix
20//! (see `ANDROID_SDK_EXTENSION` below).
21//! * `ANDROID_SDK_EXTENSION`: the extension of the Android SDK.
22//! * To specify `android-33-ext4`, this can be set to `-ext4`, `ext4`, or just `4`.
23//! All of these will be treated identically.
24//! * If `ANDROID_PLATFORM`/`ANDROID_API_LEVEL`/`ANDROID_SDK_VERSION`
25//! already includes an extension, then `ANDROID_SDK_EXTENSION` will be ignored.
26//! * `ANDROID_D8_JAR`: the path to the `d8.jar` file.
27//! * `ANDROID_JAR`: the path to the `android.jar` file.
28//! * `JAVA_HOME`: the Java SDK directory.
29//!
30//! ## Acknowledgments
31//! This crate simplifies some code found in other crates:
32//! * [`dirs-sys`](https://github.com/dirs-dev/dirs-sys-rs/blob/c0fd66cb08f1f97ebf670914253a34bd42d284fb/src/lib.rs#L151)
33//! for the Windows-specific home directory lookup.
34//! * [`java-locator`](https://github.com/astonbitecode/java-locator/)
35//! for finding the Java home directory on macOS, Linux, and Windows.
36//! * [`jerk`](https://github.com/MaulingMonkey/jerk)
37//! for arguments that can be passed into `java` and `javac` commands.
38//!
39
40
41mod java_build;
42mod java_run;
43mod env_paths;
44
45pub use java_build::*;
46pub use java_run::*;
47pub use env_paths::*;