bootstrap/core/
android.rs

1use std::path::PathBuf;
2
3use crate::core::builder::Builder;
4use crate::core::config::TargetSelection;
5
6pub(crate) struct Android {
7    pub(crate) adb_path: &'static str,
8    pub(crate) adb_test_dir: &'static str,
9    pub(crate) android_cross_path: PathBuf,
10}
11
12pub(crate) fn discover_android(builder: &Builder<'_>, target: TargetSelection) -> Option<Android> {
13    if !target.contains("android") {
14        return None;
15    }
16
17    let adb_path = "adb";
18    // See <https://github.com/rust-lang/rust/pull/102755>.
19    let adb_test_dir = "/data/local/tmp/work";
20
21    let android_cross_path = if !builder.config.dry_run() {
22        builder.cc(target).parent().unwrap().parent().unwrap().to_owned()
23    } else {
24        PathBuf::new()
25    };
26
27    Some(Android { adb_path, adb_test_dir, android_cross_path })
28}