Switch over to ANDROID_HOME

Keep ANDROID_SDK_ROOT as a fallback
This commit is contained in:
topjohnwu
2024-07-21 00:53:13 -07:00
parent 33cb39c8af
commit b26db8cee6
5 changed files with 27 additions and 18 deletions

View File

@ -55,8 +55,13 @@ if is_windows:
if not sys.version_info >= (3, 8):
error("Requires Python 3.8+")
if "ANDROID_SDK_ROOT" not in os.environ:
error("Please set Android SDK path to environment variable ANDROID_SDK_ROOT!")
try:
sdk_path = Path(os.environ["ANDROID_HOME"])
except KeyError:
try:
sdk_path = Path(os.environ["ANDROID_SDK_ROOT"])
except KeyError:
error("Please set Android SDK path to environment variable ANDROID_HOME")
if shutil.which("sccache") is not None:
os.environ["RUSTC_WRAPPER"] = "sccache"
@ -80,7 +85,6 @@ default_targets = ["magisk", "magiskinit", "magiskboot", "magiskpolicy"]
support_targets = default_targets + ["resetprop"]
rust_targets = ["magisk", "magiskinit", "magiskboot", "magiskpolicy"]
sdk_path = Path(os.environ["ANDROID_SDK_ROOT"])
ndk_root = sdk_path / "ndk"
ndk_path = ndk_root / "magisk"
ndk_build = ndk_path / "ndk-build"