| OLD | NEW |
| 1 # Copyright 2015 Google Inc. | 1 # Copyright 2015 Google Inc. |
| 2 # | 2 # |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 UTIL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 6 UTIL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 7 | 7 |
| 8 if [ $PYADB ] && [ -a "$PYADB" ]; then | 8 if [ $PYADB ] && [ -a "$PYADB" ]; then |
| 9 echo "Python ADB detected, going to use that" | 9 echo "Python ADB detected, going to use that" |
| 10 ADB="python ${PYADB}" | 10 ADB="python ${PYADB}" |
| 11 return | 11 return |
| 12 fi | 12 fi |
| 13 | 13 |
| 14 if [ "$(which adb)" != "" ]; then | 14 if [ "$(which adb)" != "" ]; then |
| 15 ADB="$(which adb)" | 15 ADB="$(which adb)" |
| 16 elif [ -d "$ANDROID_SDK_ROOT" ]; then | 16 elif [ -d "$ANDROID_SDK_ROOT" ]; then |
| 17 ADB="${ANDROID_SDK_ROOT}/platform-tools/adb" | 17 ADB="${ANDROID_SDK_ROOT}/platform-tools/adb" |
| 18 else | 18 else |
| 19 echo $ANDROID_SDK_ROOT | 19 echo $ANDROID_SDK_ROOT |
| 20 echo "No ANDROID_SDK_ROOT set (check that android_setup.sh was properly source
d)" | 20 echo "No ANDROID_SDK_ROOT set (check that android_setup.sh was properly source
d)" |
| 21 exit 1 | 21 exit 1 |
| 22 fi | 22 fi |
| 23 | 23 |
| 24 if [ ! -x $ADB ]; then | 24 if [ ! -x $ADB ]; then |
| 25 echo "The adb binary is not executable" | 25 echo "The adb binary is not executable" |
| 26 exit 1 | 26 exit 1 |
| 27 fi | 27 fi |
| 28 | |
| 29 if [ $(uname) == "Linux" ]; then | |
| 30 ADB_REQUIRED="1.0.32 or 1.0.35" | |
| 31 elif [ $(uname) == "Darwin" ]; then | |
| 32 ADB_REQUIRED="1.0.31 or 1.0.32" | |
| 33 fi | |
| 34 | |
| 35 # get the version string as an array, use just the version numbers | |
| 36 ADB_VERSION="$($ADB version)" | |
| 37 ADB_VERSION=($ADB_VERSION) | |
| 38 ADB_VERSION=${ADB_VERSION[4]} | |
| 39 | |
| 40 if [[ "$ADB_REQUIRED" != *"$ADB_VERSION"* ]]; then | |
| 41 echo "WARNING: Your ADB version is out of date!" | |
| 42 echo " Expected ADB Version: ${ADB_REQUIRED}" | |
| 43 echo " Actual ADB Version: ${ADB_VERSION}" | |
| 44 fi | |
| OLD | NEW |