From 21a6d13a2bf1045607eb9fb6bf1da580f5d0ec4b Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Tue, 29 Apr 2014 19:09:58 +0000 Subject: [PATCH] Improve Android scripts: * android_gdbserver: - Don't complain if $GDB_TMP_DIR already exists - Since $GDB_TMP_DIR/gdb.setup might already exist, overwrite the file. * android_run_skia: - Move resource files onto the device. - Change to tmp directory before executing program. * android_make, android_setup: - stop assuming PWD is skia source directory. NOTRY=true R=djsollen@google.com, scroggo@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/254923003 git-svn-id: http://skia.googlecode.com/svn/trunk@14442 2bbb7eff-a529-9590-31e7-b0007b416f81 --- platform_tools/android/bin/android_gdb_exe | 20 ++++++++++++-------- platform_tools/android/bin/android_gdbserver | 2 +- platform_tools/android/bin/android_make | 3 ++- platform_tools/android/bin/android_run_skia | 9 ++++++++- platform_tools/android/bin/android_setup.sh | 6 ++++-- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/platform_tools/android/bin/android_gdb_exe b/platform_tools/android/bin/android_gdb_exe index 920a16b38a..64be9bbd38 100755 --- a/platform_tools/android/bin/android_gdb_exe +++ b/platform_tools/android/bin/android_gdb_exe @@ -25,15 +25,19 @@ PORT=5039 # Set up gdb commands GDBSETUP=$GDB_TMP_DIR/gdb.setup -echo "file $GDB_TMP_DIR/skia_launcher" >> $GDBSETUP -echo "target remote :$PORT" >> $GDBSETUP -echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP -echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP +{ + echo "file ${GDB_TMP_DIR}/skia_launcher" + echo "target remote :${PORT}" + echo "set solib-absolute-prefix ${GDB_TMP_DIR}" + echo "set solib-search-path ${GDB_TMP_DIR} + + # The apps shared library symbols are not loaded by default so we + # load them here." + echo "break launch_app" + echo "continue" + echo "sharedLibrary ${APP_NAME}" +} > $GDBSETUP -# The apps shared library symbols are not loaded by default so we load them here -echo "break launch_app" >> $GDBSETUP -echo "continue" >> $GDBSETUP -echo "sharedLibrary $APP_NAME" >> $GDBSETUP # Launch gdb client echo "Entering gdb client shell" diff --git a/platform_tools/android/bin/android_gdbserver b/platform_tools/android/bin/android_gdbserver index 3508c50c9b..837b97ae6f 100755 --- a/platform_tools/android/bin/android_gdbserver +++ b/platform_tools/android/bin/android_gdbserver @@ -19,7 +19,7 @@ fi # We need the debug symbols from these files GDB_TMP_DIR=$(pwd)/android_gdb_tmp -mkdir $GDB_TMP_DIR +mkdir -p $GDB_TMP_DIR echo "Copying symbol files" SYSTEM_LIBRARY_PATH=/system/lib diff --git a/platform_tools/android/bin/android_make b/platform_tools/android/bin/android_make index 572f4a1331..9601db9b17 100755 --- a/platform_tools/android/bin/android_make +++ b/platform_tools/android/bin/android_make @@ -11,7 +11,8 @@ rm -f .android_config SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") source $SCRIPT_DIR/android_setup.sh -GYP_GENERATORS=ninja-android ./gyp_skia +SKIA_SRC_DIR=$(cd "${SCRIPT_DIR}/../../.."; pwd) +GYP_GENERATORS=ninja-android "${SKIA_SRC_DIR}/gyp_skia" ninja -C $SKIA_OUT/$BUILDTYPE ${APP_ARGS[@]} # Write the device id into the .android_config file. This tells diff --git a/platform_tools/android/bin/android_run_skia b/platform_tools/android/bin/android_run_skia index ebcc041c2d..62e837ce0b 100755 --- a/platform_tools/android/bin/android_run_skia +++ b/platform_tools/android/bin/android_run_skia @@ -13,6 +13,13 @@ then exit 1 fi +( + SKIA_SRC_DIR=$(cd ${SCRIPT_DIR}/../../..; pwd) + cd "$SKIA_SRC_DIR" + for resource in $(find resources -type f); do + adb_push_if_needed "$resource" "/data/local/tmp/${resource}" + done +) adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/skia_launcher" /data/local/tmp if [ -f "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" ]; then # Does not exist for builds with static skia. @@ -22,7 +29,7 @@ adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" /data/local STATUS_FILENAME="/data/local/tmp/.skia_tmp_$(date +%s%N)" $ADB ${DEVICE_SERIAL} shell \ - "/data/local/tmp/skia_launcher ${APP_ARGS[@]}; echo \$? > ${STATUS_FILENAME}" + "cd /data/local/tmp; ./skia_launcher ${APP_ARGS[@]}; echo \$? > ${STATUS_FILENAME}" if [ -z "$($ADB $DEVICE_SERIAL shell 'if [ -f $STATUS_FILENAME ]; then echo exists; fi')" ]; then exit 1 fi diff --git a/platform_tools/android/bin/android_setup.sh b/platform_tools/android/bin/android_setup.sh index 6438b44aed..a9b2c7955c 100755 --- a/platform_tools/android/bin/android_setup.sh +++ b/platform_tools/android/bin/android_setup.sh @@ -146,9 +146,11 @@ setup_device() { source $SCRIPT_DIR/utils/setup_toolchain.sh DEFINES="${DEFINES} android_toolchain=${TOOLCHAIN_TYPE}" - exportVar GYP_DEFINES "$DEFINES $GYP_DEFINES" - exportVar SKIA_OUT "${SKIA_OUT:-out/config/android-${TARGET_DEVICE}}" + + SKIA_SRC_DIR=$(cd "${SCRIPT_DIR}/../../.."; pwd) + DEFAULT_SKIA_OUT="${SKIA_SRC_DIR}/out/config/android-${TARGET_DEVICE}" + exportVar SKIA_OUT "${SKIA_OUT:-${DEFAULT_SKIA_OUT}}" } # adb_pull_if_needed(android_src, host_dst)