fix: autodetect android install (#3200)

* fix: autodetect android install

* use clang
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-11-12 10:26:00 -05:00
1 parent ac3e33af46
commit c1f3a6868e
3 files changed
+83 -2

No files matched your search

+8 -1
View File
@@ -114,10 +114,17 @@ impl BuildRequest {
// We don't want to overwrite the user's .cargo/config.toml since that gets committed to git
// and we want everyone's install to be the same.
if self.build.platform() == Platform::Android {
let linker = self
.krate
.android_linker()
.context("Could not autodetect android linker")?;
tracing::trace!("Using android linker: {linker:?}");
cmd.env(
LinkAction::ENV_VAR_NAME,
LinkAction::LinkAndroid {
linker: "/Users/jonkelley/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang".into(),
linker,
extra_flags: vec![],
}
.to_json(),
+7 -1
View File
@@ -134,6 +134,12 @@ impl BuildRequest {
/// will do its best to fill in the missing bits by exploring the sdk structure
/// IE will attempt to use the Java installed from android studio if possible.
pub(crate) async fn verify_android_tooling(&self, _rustup: RustupShow) -> Result<()> {
if self.krate.android_linker().is_none() {
return Err(anyhow::anyhow!(
"Android linker not found. Please set the ANDROID_NDK_HOME environment variable to the root of your NDK installation."
).into());
}
Ok(())
}
@@ -142,7 +148,7 @@ impl BuildRequest {
///
/// Eventually, we want to check for the prereqs for wry/tao as outlined by tauri:
/// https://tauri.app/start/prerequisites/
pub(crate) async fn verify_linux_tooling(&self, _rustup: crate::RustupShow) -> Result<()> {
pub(crate) async fn verify_linux_tooling(&self, _rustup: RustupShow) -> Result<()> {
Ok(())
}
}