Bug 1117028 - Try to look for zipalign in all of Android build tools; r=nalexander
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 02 Jan 2015 00:30:01 -0500
changeset 222372 b1741d5e3b99530bce4b948363b900640f993b49
parent 222371 a6a42670bebb26a7d177ee3e44e36dfac1802a59
child 222373 d23b3009d77adbc23eef1278ea04fabb5c4ff962
push id10683
push usercbook@mozilla.com
push dateWed, 07 Jan 2015 13:30:50 +0000
treeherderfx-team@3a1103c584cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1117028
milestone37.0a1
Bug 1117028 - Try to look for zipalign in all of Android build tools; r=nalexander Some Android SDK installations do not have the zipalign program in the same directory as other Android build tools. For example, zipalign may be found in /build-tools/21.1.2 whereas the rest of the build tools are in /build-tools/android-4.4.
build/autoconf/android.m4
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -348,16 +348,23 @@ case "$target" in
         if test -d "$tools_directory" -a -f "$tools_directory/aapt"; 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
+    all_android_build_tools=""
+    for suffix in `ls "$android_sdk_root/build-tools" | sed -e "s,android-,999.," | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr`; do
+        tools_directory=`echo "$android_sdk_root/build-tools/$suffix" | sed -e "s,999.,android-,"`
+        if test -d "$tools_directory" -a -f "$tools_directory/aapt"; then
+            all_android_build_tools="$all_android_build_tools:$tools_directory"
+        fi
+    done
 
     if test -d "$android_build_tools" -a -f "$android_build_tools/aapt"; then
         AC_MSG_RESULT([$android_build_tools])
     else
         AC_MSG_ERROR([not found. Please check your SDK for the subdirectory of build-tools. With the current configuration, it should be in $android_sdk_root/build_tools])
     fi
 
     ANDROID_SDK="${android_sdk}"
@@ -385,17 +392,17 @@ case "$target" in
     AC_SUBST(ANDROID_COMPAT_LIB)
     if ! test -e $ANDROID_COMPAT_LIB ; then
         AC_MSG_ERROR([You must download the Android v4 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_MSG_RESULT([$ANDROID_COMPAT_LIB])
 
     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:$ANDROID_BUILD_TOOLS:$ANDROID_PLATFORM_TOOLS"
+    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])
 
     if test -z "$ZIPALIGN" -o "$ZIPALIGN" = ":"; then
       AC_MSG_ERROR([The program zipalign was not found.  Use --with-android-sdk={android-sdk-dir}.])