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
use error::AndroidError;
use std::path::PathBuf;
macro_rules! bin {
($bin:expr) => {{
#[cfg(not(target_os = "windows"))]
let bin = $bin;
#[cfg(target_os = "windows")]
let bin = concat!($bin, ".exe");
bin
}};
}
pub mod error;
#[cfg(feature = "aapt2")]
pub mod aapt2;
#[cfg(feature = "bundletool")]
pub mod bundletool;
#[cfg(feature = "emulator")]
pub mod emulator;
#[cfg(feature = "java-tools")]
pub mod java_tools;
pub fn sdk_path_from_env() -> crate::error::Result<PathBuf> {
let sdk_path = {
let sdk_path = std::env::var("ANDROID_SDK_ROOT")
.ok()
.or_else(|| std::env::var("ANDROID_SDK_PATH").ok())
.or_else(|| std::env::var("ANDROID_HOME").ok());
std::path::PathBuf::from(sdk_path.ok_or(AndroidError::AndroidSdkNotFound)?)
};
Ok(sdk_path)
}