Index: platform_tools/android/bin/android_setup.sh |
diff --git a/platform_tools/android/bin/android_setup.sh b/platform_tools/android/bin/android_setup.sh |
index db1145f5d1120c043f54b683dc56ce0417c467f0..f86d62c7fe185aee13a91da84be92ce958125359 100755 |
--- a/platform_tools/android/bin/android_setup.sh |
+++ b/platform_tools/android/bin/android_setup.sh |
@@ -10,7 +10,7 @@ while (( "$#" )); do |
DEVICE_ID=$2 |
shift |
else |
- APP_ARGS="$APP_ARGS $1" |
+ APP_ARGS=("${APP_ARGS[@]}" "${1}") |
fi |
shift |
@@ -210,6 +210,7 @@ setup_device() { |
esac |
echo "The build is targeting the device: $TARGET_DEVICE" |
+ export DEVICE_ID="$TARGET_DEVICE" |
# Set up the toolchain. |
setup_toolchain |
@@ -258,6 +259,42 @@ adb_pull_if_needed() { |
fi |
} |
+# adb_push_if_needed(host_src, android_dst) |
+adb_push_if_needed() { |
+ |
+ # get adb location |
+ source $SCRIPT_DIR/utils/setup_adb.sh |
+ |
+ # read input params |
+ HOST_SRC="$1" |
+ ANDROID_DST="$2" |
+ |
+ ANDROID_LS=`$ADB shell ls -ld $ANDROID_DST` |
+ if [ "${ANDROID_LS:0:1}" == "d" ]; |
+ then |
+ ANDROID_DST="${ANDROID_DST}/$(basename ${HOST_SRC})" |
+ fi |
+ |
+ echo "ANDROID: $ANDROID_DST" |
+ |
+ ANDROID_LS=`$ADB shell ls -ld $ANDROID_DST` |
+ if [ "${ANDROID_LS:0:1}" == "-" ]; |
+ then |
+ #get the MD5 for dst and src |
+ ANDROID_MD5=`$ADB shell md5 $ANDROID_DST` |
+ HOST_MD5=`md5sum $HOST_SRC` |
+ |
+ if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; |
+ then |
+ $ADB push $HOST_SRC $ANDROID_DST |
+# else |
+# echo "md5 match of android [${ANDROID_DST}] and host [${HOST_SRC}]" |
+ fi |
+ else |
+ $ADB push $HOST_SRC $ANDROID_DST |
+ fi |
+} |
+ |
# Set up the device. |
setup_device "${DEVICE_ID}" |
if [[ "$?" != "0" ]]; then |