Bug 898296 - Search for Android SDK build tools version 18.0.0. r=gps
authorNick Alexander <nalexander@mozilla.com>
Tue, 30 Jul 2013 09:15:50 -0700
changeset 140576 db8581f995e9681b3ee468ae1df4f1624b1e36ea
parent 140575 17773671a1f3ec9a74360ee1249020122be112d6
child 140577 cc2c2f1f16be06d310f8b8d2d8ab88a3a5c6370a
push id25033
push userryanvm@gmail.com
push dateWed, 31 Jul 2013 01:29:46 +0000
treeherdermozilla-central@c2b375f3a909 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs898296
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 898296 - Search for Android SDK build tools version 18.0.0. r=gps This patch also tries to verify that the tools are actually found early in the configure process, rather than failing with difficult to parse errors at the end of the build. Since the Android developer tools are defined earlier in the build process, we can remove a work-around needed for |make install|.
build/autoconf/android.m4
config/android-common.mk
js/src/build/autoconf/android.m4
mobile/android/build.mk
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -284,44 +284,66 @@ case "$target" in
             AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
         fi
 
         if test $android_api_level -lt $1 ; then
             AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($1 or higher required).])
         fi
     fi
 
+    android_tools="$android_sdk"/../../tools
     android_platform_tools="$android_sdk"/../../platform-tools
     if test ! -d "$android_platform_tools" ; then
         android_platform_tools="$android_sdk"/tools # SDK Tools < r8
     fi
     # The build tools got moved around to different directories in
     # SDK Tools r22.  Try to locate them.
     android_build_tools=""
-    for suffix in 17.0.0 android-4.2.2; do
+    for suffix in 18.0.0 17.0.0 android-4.2.2; do
         tools_directory="$android_sdk/../../build-tools/$suffix"
         if test -d "$tools_directory" ; then
             android_build_tools="$tools_directory"
             break
         fi
     done
     if test -z "$android_build_tools" ; then
         android_build_tools="$android_platform_tools" # SDK Tools < r22
     fi
     ANDROID_SDK="${android_sdk}"
     if test -e "${android_sdk}/../../extras/android/compatibility/v4/android-support-v4.jar" ; then
         ANDROID_COMPAT_LIB="${android_sdk}/../../extras/android/compatibility/v4/android-support-v4.jar"
     else
         ANDROID_COMPAT_LIB="${android_sdk}/../../extras/android/support/v4/android-support-v4.jar";
     fi
+    ANDROID_TOOLS="${android_tools}"
     ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
     ANDROID_BUILD_TOOLS="${android_build_tools}"
     AC_SUBST(ANDROID_SDK)
     AC_SUBST(ANDROID_COMPAT_LIB)
     if ! test -e $ANDROID_COMPAT_LIB ; then
         AC_MSG_ERROR([You must download the Android support library when targeting Android.   Run the Android SDK tool and install Android Support Library under Extras.  See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_COMPAT_LIB)])
     fi
-    AC_SUBST(ANDROID_PLATFORM_TOOLS)
-    AC_SUBST(ANDROID_BUILD_TOOLS)
+
+    MOZ_PATH_PROG(ZIPALIGN, zipalign, :, [$ANDROID_TOOLS])
+    MOZ_PATH_PROG(DX, dx, :, [$ANDROID_BUILD_TOOLS])
+    MOZ_PATH_PROG(AAPT, aapt, :, [$ANDROID_BUILD_TOOLS])
+    MOZ_PATH_PROG(AIDL, aidl, :, [$ANDROID_BUILD_TOOLS])
+    MOZ_PATH_PROG(ADB, adb, :, [$ANDROID_PLATFORM_TOOLS])
+
+    if test -z "$ZIPALIGN" -o "$ZIPALIGN" = ":"; then
+      AC_MSG_ERROR([The program zipalign was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
+    if test -z "$DX" -o "$DX" = ":"; then
+      AC_MSG_ERROR([The program dx was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
+    if test -z "$AAPT" -o "$AAPT" = ":"; then
+      AC_MSG_ERROR([The program aapt was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
+    if test -z "$AIDL" -o "$AIDL" = ":"; then
+      AC_MSG_ERROR([The program aidl was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
+    if test -z "$ADB" -o "$ADB" = ":"; then
+      AC_MSG_ERROR([The program adb was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
     ;;
 esac
 
 ])
--- a/config/android-common.mk
+++ b/config/android-common.mk
@@ -7,21 +7,16 @@
 ifndef ANDROID_SDK
   $(error ANDROID_SDK must be defined before including android-common.mk)
 endif
 
 ifndef JAVA_CLASSPATH
   $(error JAVA_CLASSPATH must be defined before including android-common.mk)
 endif
 
-DX=$(ANDROID_BUILD_TOOLS)/dx
-AAPT=$(ANDROID_BUILD_TOOLS)/aapt
-AIDL=$(ANDROID_BUILD_TOOLS)/aidl
-ADB=$(ANDROID_PLATFORM_TOOLS)/adb
-ZIPALIGN=$(ANDROID_SDK)/../../tools/zipalign
 # DEBUG_JARSIGNER always debug signs.
 DEBUG_JARSIGNER=$(PYTHON) $(call core_abspath,$(topsrcdir)/mobile/android/debug_sign_tool.py) \
   --keytool=$(KEYTOOL) \
   --jarsigner=$(JARSIGNER) \
   $(NULL)
 
 # For Android, this defaults to $(ANDROID_SDK)/android.jar
 ifndef JAVA_BOOTCLASSPATH
--- a/js/src/build/autoconf/android.m4
+++ b/js/src/build/autoconf/android.m4
@@ -284,44 +284,66 @@ case "$target" in
             AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
         fi
 
         if test $android_api_level -lt $1 ; then
             AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($1 or higher required).])
         fi
     fi
 
+    android_tools="$android_sdk"/../../tools
     android_platform_tools="$android_sdk"/../../platform-tools
     if test ! -d "$android_platform_tools" ; then
         android_platform_tools="$android_sdk"/tools # SDK Tools < r8
     fi
     # The build tools got moved around to different directories in
     # SDK Tools r22.  Try to locate them.
     android_build_tools=""
-    for suffix in 17.0.0 android-4.2.2; do
+    for suffix in 18.0.0 17.0.0 android-4.2.2; do
         tools_directory="$android_sdk/../../build-tools/$suffix"
         if test -d "$tools_directory" ; then
             android_build_tools="$tools_directory"
             break
         fi
     done
     if test -z "$android_build_tools" ; then
         android_build_tools="$android_platform_tools" # SDK Tools < r22
     fi
     ANDROID_SDK="${android_sdk}"
     if test -e "${android_sdk}/../../extras/android/compatibility/v4/android-support-v4.jar" ; then
         ANDROID_COMPAT_LIB="${android_sdk}/../../extras/android/compatibility/v4/android-support-v4.jar"
     else
         ANDROID_COMPAT_LIB="${android_sdk}/../../extras/android/support/v4/android-support-v4.jar";
     fi
+    ANDROID_TOOLS="${android_tools}"
     ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
     ANDROID_BUILD_TOOLS="${android_build_tools}"
     AC_SUBST(ANDROID_SDK)
     AC_SUBST(ANDROID_COMPAT_LIB)
     if ! test -e $ANDROID_COMPAT_LIB ; then
         AC_MSG_ERROR([You must download the Android support library when targeting Android.   Run the Android SDK tool and install Android Support Library under Extras.  See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_COMPAT_LIB)])
     fi
-    AC_SUBST(ANDROID_PLATFORM_TOOLS)
-    AC_SUBST(ANDROID_BUILD_TOOLS)
+
+    MOZ_PATH_PROG(ZIPALIGN, zipalign, :, [$ANDROID_TOOLS])
+    MOZ_PATH_PROG(DX, dx, :, [$ANDROID_BUILD_TOOLS])
+    MOZ_PATH_PROG(AAPT, aapt, :, [$ANDROID_BUILD_TOOLS])
+    MOZ_PATH_PROG(AIDL, aidl, :, [$ANDROID_BUILD_TOOLS])
+    MOZ_PATH_PROG(ADB, adb, :, [$ANDROID_PLATFORM_TOOLS])
+
+    if test -z "$ZIPALIGN" -o "$ZIPALIGN" = ":"; then
+      AC_MSG_ERROR([The program zipalign was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
+    if test -z "$DX" -o "$DX" = ":"; then
+      AC_MSG_ERROR([The program dx was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
+    if test -z "$AAPT" -o "$AAPT" = ":"; then
+      AC_MSG_ERROR([The program aapt was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
+    if test -z "$AIDL" -o "$AIDL" = ":"; then
+      AC_MSG_ERROR([The program aidl was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
+    if test -z "$ADB" -o "$ADB" = ":"; then
+      AC_MSG_ERROR([The program adb was not found.  Use --with-android-sdk={android-sdk-dir}.])
+    fi
     ;;
 esac
 
 ])
--- a/mobile/android/build.mk
+++ b/mobile/android/build.mk
@@ -9,20 +9,16 @@ installer:
 
 package:
 	@$(MAKE) -C mobile/android/installer
 
 fast-package:
 	@$(MAKE) package MOZ_FAST_PACKAGE=1
 
 ifeq ($(OS_TARGET),Android)
-# $(ADB) is defined in config/android-common.mk, but that file is not
-# in scope when this file is read, so we define it locally.
-ADB=$(ANDROID_PLATFORM_TOOLS)/adb
-
 ifneq ($(MOZ_ANDROID_INSTALL_TARGET),)
 ANDROID_SERIAL = $(MOZ_ANDROID_INSTALL_TARGET)
 endif
 ifneq ($(ANDROID_SERIAL),)
 export ANDROID_SERIAL
 else
 # Determine if there's more than one device connected
 android_devices=$(filter device,$(shell $(ADB) devices))