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: Consider ANDROID_SDK_ROOT as deprecated instead of ANDROID_HOME #346

Merged
merged 1 commit into from
Sep 12, 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
1 change: 1 addition & 0 deletions ndk-build/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Provide `adb` path to `ndk-gdb`, allowing it to run without `adb` in `PATH`. ([#343](https://github.com/rust-windowing/android-ndk-rs/pull/343))
- Remove quotes from `Android.mk` to fix `ndk-gdb` on Windows. ([#344](https://github.com/rust-windowing/android-ndk-rs/pull/344))
- Launch Android activity through `ndk-gdb` to block app start until the debugger is attached. ([#345](https://github.com/rust-windowing/android-ndk-rs/pull/345))
- Consider `ANDROID_SDK_ROOT` as deprecated instead of `ANDROID_HOME`. ([#346](https://github.com/rust-windowing/android-ndk-rs/pull/346))

# 0.7.0 (2022-07-05)

Expand Down
18 changes: 10 additions & 8 deletions ndk-build/src/ndk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ pub struct Ndk {
impl Ndk {
pub fn from_env() -> Result<Self, NdkError> {
let sdk_path = {
let mut sdk_path = std::env::var("ANDROID_HOME").ok();
let sdk_path = std::env::var("ANDROID_SDK_ROOT").ok();
if sdk_path.is_some() {
println!(
"Warning: You use environment variable ANDROID_HOME that is deprecated. \
Please, remove it and use ANDROID_SDK_ROOT instead. Now ANDROID_HOME is used"
eprintln!(
"Warning: Environment variable ANDROID_SDK_ROOT is deprecated \
(https://developer.android.com/studio/command-line/variables#envar). \
It will be used until it is unset and replaced by ANDROID_HOME."
);
}
if sdk_path.is_none() {
sdk_path = std::env::var("ANDROID_SDK_ROOT").ok();
}

PathBuf::from(sdk_path.ok_or(NdkError::SdkNotFound)?)
PathBuf::from(
sdk_path
.or_else(|| std::env::var("ANDROID_HOME").ok())
.ok_or(NdkError::SdkNotFound)?,
)
};

let ndk_path = {
Expand Down