Bug 1204260 - Pre: Don't expose ANDROID_{BUILD,PLATFORM}_TOOLS. r=glandium,gbrown

This stops exposing ANDROID_BUILD_TOOLS and ANDROID_PLATFORM_TOOLS via
AC_SUBST.  We expose most tools already, and this adds EMULATOR, and
consumes it (and ADB) where appropriate.
This commit is contained in:
Nick Alexander 2015-09-12 14:59:31 -04:00
parent 3ce48dd454
commit 2d07957703
2 changed files with 37 additions and 28 deletions

View File

@ -386,22 +386,19 @@ case "$target" in
ANDROID_SDK_ROOT="${android_sdk_root}"
ANDROID_TOOLS="${android_tools}"
ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
ANDROID_BUILD_TOOLS="${android_build_tools}"
AC_SUBST(ANDROID_SDK_ROOT)
AC_SUBST(ANDROID_SDK)
AC_SUBST(ANDROID_TOOLS)
AC_SUBST(ANDROID_PLATFORM_TOOLS)
AC_SUBST(ANDROID_BUILD_TOOLS)
dnl Google has a history of moving the Android tools around. We don't
dnl care where they are, so let's try to find them anywhere we can.
ALL_ANDROID_TOOLS_PATHS="$ANDROID_TOOLS$all_android_build_tools:$ANDROID_PLATFORM_TOOLS"
MOZ_PATH_PROG(ZIPALIGN, zipalign, :, [$ALL_ANDROID_TOOLS_PATHS])
MOZ_PATH_PROG(DX, dx, :, [$ALL_ANDROID_TOOLS_PATHS])
MOZ_PATH_PROG(AAPT, aapt, :, [$ALL_ANDROID_TOOLS_PATHS])
MOZ_PATH_PROG(AIDL, aidl, :, [$ALL_ANDROID_TOOLS_PATHS])
MOZ_PATH_PROG(ADB, adb, :, [$ALL_ANDROID_TOOLS_PATHS])
all_android_tools_paths="$ANDROID_TOOLS:$all_android_build_tools:$android_platform_tools"
MOZ_PATH_PROG(ZIPALIGN, zipalign, :, [$all_android_tools_paths])
MOZ_PATH_PROG(DX, dx, :, [$all_android_tools_paths])
MOZ_PATH_PROG(AAPT, aapt, :, [$all_android_tools_paths])
MOZ_PATH_PROG(AIDL, aidl, :, [$all_android_tools_paths])
MOZ_PATH_PROG(ADB, adb, :, [$all_android_tools_paths])
MOZ_PATH_PROG(EMULATOR, emulator, :, [$all_android_tools_paths])
if test -z "$ZIPALIGN" -o "$ZIPALIGN" = ":"; then
AC_MSG_ERROR([The program zipalign was not found. Use --with-android-sdk={android-sdk-dir}.])

View File

@ -485,38 +485,50 @@ class AndroidEmulator(object):
def _find_sdk_exe(self, exe, tools):
if tools:
subdir = 'tools'
var = 'ANDROID_TOOLS'
else:
subdir = 'platform-tools'
var = 'ANDROID_PLATFORM_TOOLS'
found = False
if not found and self.substs:
# It's best to use the tool specified by the build, rather
# than something we find on the PATH or crawl for.
try:
exe_path = self.substs[exe.upper()]
if os.path.exists(exe_path):
found = True
else:
self._log_debug(
"Unable to find executable at %s" % exe_path)
except KeyError:
self._log_debug("%s not set" % exe.upper())
# Can exe be found in the Android SDK?
try:
android_sdk_root = os.environ['ANDROID_SDK_ROOT']
exe_path = os.path.join(
android_sdk_root, subdir, exe)
if os.path.exists(exe_path):
found = True
else:
_log_debug(
"Unable to find executable at %s" % exe_path)
except KeyError:
_log_debug("ANDROID_SDK_ROOT not set")
if not found and self.substs:
# Can exe be found in ANDROID_TOOLS/ANDROID_PLATFORM_TOOLS?
if not found:
try:
android_sdk_root = os.environ['ANDROID_SDK_ROOT']
exe_path = os.path.join(
self.substs[var], exe)
android_sdk_root, subdir, exe)
if os.path.exists(exe_path):
found = True
else:
_log_debug(
"Unable to find executable at %s" % exe_path)
except KeyError:
_log_debug("%s not set" % var)
_log_debug("ANDROID_SDK_ROOT not set")
if not found:
# Can exe be found in the Android SDK?
try:
android_sdk_root = os.environ['ANDROID_SDK_ROOT']
exe_path = os.path.join(
android_sdk_root, subdir, exe)
if os.path.exists(exe_path):
found = True
else:
_log_debug(
"Unable to find executable at %s" % exe_path)
except KeyError:
_log_debug("ANDROID_SDK_ROOT not set")
if not found:
# Can exe be found in the default bootstrap location?