diff --git a/cargo-apk/src/apk.rs b/cargo-apk/src/apk.rs index bf4b5569..53b3e4ed 100644 --- a/cargo-apk/src/apk.rs +++ b/cargo-apk/src/apk.rs @@ -273,7 +273,7 @@ impl<'a> ApkBuilder<'a> { jni_dir.join("Android.mk"), format!("APP_ABI=\"{}\"\nTARGET_OUT=\"\"\n", abi.android_abi()), )?; - Command::new(self.ndk.ndk().join("ndk-gdb")) + Command::new(self.ndk.ndk_gdb()) .current_dir(target_dir) .status()?; Ok(()) diff --git a/ndk-build/CHANGELOG.md b/ndk-build/CHANGELOG.md index de987d18..0c4ad311 100644 --- a/ndk-build/CHANGELOG.md +++ b/ndk-build/CHANGELOG.md @@ -4,6 +4,7 @@ - Add `adb` device serial parameter to `detect_abi()` and `Apk::{install,start}()`. ([#329](https://github.com/rust-windowing/android-ndk-rs/pull/329)) - Fix missing `.exe` extension for `adb` on Windows inside `detect_abi()`. ([#339](https://github.com/rust-windowing/android-ndk-rs/pull/339)) - `start()` now returns the PID of the started app process (useful for passing to `adb logcat --pid`). ([#331](https://github.com/rust-windowing/android-ndk-rs/pull/331)) +- Add `ndk_gdb()` function to acquire `ndk-gdb` script path with the appropriate extension across platforms. ([#330](https://github.com/rust-windowing/android-ndk-rs/pull/330)) # 0.7.0 (2022-07-05) diff --git a/ndk-build/src/lib.rs b/ndk-build/src/lib.rs index a4323002..efd6dc6f 100644 --- a/ndk-build/src/lib.rs +++ b/ndk-build/src/lib.rs @@ -18,6 +18,16 @@ macro_rules! bat { }; } +macro_rules! cmd { + ($cmd:expr) => { + if cfg!(target_os = "windows") { + concat!($cmd, ".cmd") + } else { + $cmd + } + }; +} + pub mod apk; pub mod cargo; pub mod dylibs; diff --git a/ndk-build/src/ndk.rs b/ndk-build/src/ndk.rs index 78e4abf6..a9e6a004 100644 --- a/ndk-build/src/ndk.rs +++ b/ndk-build/src/ndk.rs @@ -127,6 +127,10 @@ impl Ndk { &self.ndk_path } + pub fn ndk_gdb(&self) -> PathBuf { + self.ndk_path.join(cmd!("ndk-gdb")) + } + pub fn build_tools_version(&self) -> &str { &self.build_tools_version }