Bug 874132 - Part 1: Handle SDK layout differences in the Android r22 SDK. r=nalexander
authorNathan Froyd <froydnj@gmail.com>
Tue, 18 Jun 2013 09:25:15 -0700
changeset 147840 ceefba074d862107932cdade2b61d4a5875c2996
parent 147839 8416c29fecda6ecc9c5a2a68dfb9b1679823b8fb
child 147841 c0b8d909db83b58207caca47ebf7db4d3b737b0c
push id368
push userbbajaj@mozilla.com
push dateMon, 09 Sep 2013 22:57:58 +0000
treeherdermozilla-release@5a4f47ae1217 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs874132
milestone24.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 874132 - Part 1: Handle SDK layout differences in the Android r22 SDK. r=nalexander Author: Nathan Froyd <froydnj@gmail.com>
build/autoconf/android.m4
config/android-common.mk
js/src/build/autoconf/android.m4
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -300,25 +300,40 @@ case "$target" in
             AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($1 or higher required).])
         fi
     fi
 
     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
+        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_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)
     ;;
 esac
 
 ])
--- a/config/android-common.mk
+++ b/config/android-common.mk
@@ -7,18 +7,18 @@
 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_PLATFORM_TOOLS)/dx
-AAPT=$(ANDROID_PLATFORM_TOOLS)/aapt
+DX=$(ANDROID_BUILD_TOOLS)/dx
+AAPT=$(ANDROID_BUILD_TOOLS)/aapt
 APKBUILDER=$(ANDROID_SDK)/../../tools/apkbuilder
 ZIPALIGN=$(ANDROID_SDK)/../../tools/zipalign
 
 ifdef JARSIGNER
   APKBUILDER_FLAGS += -u
 endif
 
 # For Android, this defaults to $(ANDROID_SDK)/android.jar
--- a/js/src/build/autoconf/android.m4
+++ b/js/src/build/autoconf/android.m4
@@ -300,25 +300,40 @@ case "$target" in
             AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($1 or higher required).])
         fi
     fi
 
     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
+        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_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)
     ;;
 esac
 
 ])