Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndk-build: Add ndk_gdb() function to acquire ndk-gdb script path with the correct per-platform extension #330

Merged
merged 4 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cargo-apk/src/apk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
1 change: 1 addition & 0 deletions ndk-build/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
10 changes: 10 additions & 0 deletions ndk-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions ndk-build/src/ndk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down