From dc71e152efbbecb26950c24f7e5d3387a9986eaa Mon Sep 17 00:00:00 2001 From: Derek Sollenberger Date: Wed, 4 Jan 2017 14:02:52 -0500 Subject: Update Android Apps to work with GN. This also includes the removal of an old example whose instructions are not compatible with GN. BUG=skia:6009 Change-Id: I2807829ca12c19292ae0f5a7ea250ed453f9a182 Reviewed-on: https://skia-review.googlesource.com/5620 Commit-Queue: Derek Sollenberger Reviewed-by: Mike Klein --- platform_tools/android/bin/android_install_app | 21 ++---- platform_tools/android/bin/android_launch_app | 2 +- platform_tools/android/bin/android_make | 22 ------ platform_tools/android/bin/android_ninja | 1 - platform_tools/android/bin/utils/android_setup.sh | 81 +---------------------- 5 files changed, 8 insertions(+), 119 deletions(-) delete mode 100755 platform_tools/android/bin/android_make delete mode 120000 platform_tools/android/bin/android_ninja (limited to 'platform_tools/android/bin') diff --git a/platform_tools/android/bin/android_install_app b/platform_tools/android/bin/android_install_app index fe16cd5285..0c9cd54506 100755 --- a/platform_tools/android/bin/android_install_app +++ b/platform_tools/android/bin/android_install_app @@ -7,13 +7,12 @@ function print_usage { echo " Options: -f Forces the package to be installed by removing any" echo " previously installed packages" echo " -h Prints this help message" - echo " --release Install the release build of Skia" echo " -s [device_s/n] Serial number of the device to be used" } SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source $SCRIPT_DIR/android_setup.sh +source $SCRIPT_DIR/utils/android_setup.sh source $SCRIPT_DIR/utils/setup_adb.sh forceRemoval="false" @@ -24,8 +23,6 @@ for arg in ${APP_ARGS[@]}; do elif [[ "${arg}" == "-h" ]]; then print_usage exit - elif [[ "${arg}" == "-r" ]]; then - echo "DEPRECATED: -r is now a no-op" elif [[ ${arg} == '-'* ]]; then echo "ERROR: unrecognized option ${arg}" print_usage @@ -33,22 +30,14 @@ for arg in ${APP_ARGS[@]}; do fi done +APP_LC=$(echo Viewer | tr "[:upper:]" "[:lower:]") if [[ "$forceRemoval" == "true" ]]; then echo "Forcing removal of previously installed packages" - $ADB ${DEVICE_SERIAL} uninstall com.skia > /dev/null -fi - -if [[ "$BUILDTYPE" == "Release" ]]; -then - apk_suffix="release.apk" -else - apk_suffix="debug.apk" + $ADB ${DEVICE_SERIAL} uninstall org.skia.${APP_LC} > /dev/null fi -APP_LC=$(echo Viewer | tr "[:upper:]" "[:lower:]") - -echo "Installing ${APP_LC} from ${APP_LC}/build/outputs/apk/${APP_LC}-${ANDROID_ARCH}-${apk_suffix}" -$ADB ${DEVICE_SERIAL} install -r ${SCRIPT_DIR}/../apps/${APP_LC}/build/outputs/apk/${APP_LC}-${ANDROID_ARCH}-${apk_suffix} +echo "Installing ${APP_LC} from ${SKIA_OUT}/${APP_LC}.apk" +$ADB ${DEVICE_SERIAL} install -r ${SKIA_OUT}/${APP_LC}.apk diff --git a/platform_tools/android/bin/android_launch_app b/platform_tools/android/bin/android_launch_app index 0e65ba143d..46cd4b11c3 100755 --- a/platform_tools/android/bin/android_launch_app +++ b/platform_tools/android/bin/android_launch_app @@ -3,7 +3,7 @@ # android_launch_app: Launches the skia Viewer app on the device. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source $SCRIPT_DIR/android_setup.sh +source $SCRIPT_DIR/utils/android_setup.sh source $SCRIPT_DIR/utils/setup_adb.sh # TODO: check to ensure that the app exists on the device and prompt to install diff --git a/platform_tools/android/bin/android_make b/platform_tools/android/bin/android_make deleted file mode 100755 index cac0cc93c6..0000000000 --- a/platform_tools/android/bin/android_make +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Fail-fast if anything in the script fails. -set -e - -# Remove any existing .android_config file before running android_setup. If we -# did not remove this now then we would build for whatever device type was -# listed in the .android_config instead of the default device type. -rm -f .android_config - -SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") -source $SCRIPT_DIR/utils/android_setup.sh - -SKIA_SRC_DIR=$(cd "${SCRIPT_DIR}/../../.."; pwd) -echo $GN_ARGS -gn gen $SKIA_OUT --args="${GN_ARGS}" -ninja -C $SKIA_OUT ${APP_ARGS[@]} - -# Write the device id into the .android_config file. This tells -# android_run_skia the last build we completed. -echo $DEVICE_ID > .android_config - diff --git a/platform_tools/android/bin/android_ninja b/platform_tools/android/bin/android_ninja deleted file mode 120000 index 68a0fb120e..0000000000 --- a/platform_tools/android/bin/android_ninja +++ /dev/null @@ -1 +0,0 @@ -android_make \ No newline at end of file diff --git a/platform_tools/android/bin/utils/android_setup.sh b/platform_tools/android/bin/utils/android_setup.sh index a50819efa7..a63fcafe65 100755 --- a/platform_tools/android/bin/utils/android_setup.sh +++ b/platform_tools/android/bin/utils/android_setup.sh @@ -14,8 +14,8 @@ set -e IS_DEBUG="false" while (( "$#" )); do - if [[ "$1" == "-d" ]]; then - DEVICE_ID=$2 + if [[ "$1" == "-C" ]]; then + SKIA_OUT=$2 shift elif [[ "$1" == "-i" || "$1" == "--resourcePath" ]]; then RESOURCE_PATH=$2 @@ -24,14 +24,10 @@ while (( "$#" )); do elif [[ "$1" == "-s" ]]; then DEVICE_SERIAL="-s $2" shift - elif [[ "$1" == "--debug" ]]; then - IS_DEBUG="true" elif [[ "$1" == "--logcat" ]]; then LOGCAT=1 elif [[ "$1" == "--verbose" ]]; then VERBOSE="true" - elif [[ "$1" == "--vulkan" ]]; then - SKIA_VULKAN="true" else APP_ARGS=("${APP_ARGS[@]}" "${1}") fi @@ -80,77 +76,6 @@ if [ -z "$ANDROID_NDK_ROOT" ]; then fi fi -# Helper function to configure the GN defines to the appropriate values -# based on the target device. -setup_device() { - DEFINES="ndk=\"${ANDROID_NDK_ROOT}\" is_debug=${IS_DEBUG}" - - if [ $SKIA_VULKAN == "true" ]; then - DEFINES="${DEFINES} ndk_api=24" - fi - - # Setup the build variation depending on the target device - TARGET_DEVICE="$1" - - if [ -z "$TARGET_DEVICE" ]; then - if [ -f .android_config ]; then - TARGET_DEVICE=$(cat .android_config) - verbose "no target device (-d), using ${TARGET_DEVICE} from most recent build" - else - TARGET_DEVICE="arm_v7" - verbose "no target device (-d), using ${TARGET_DEVICE}" - fi - fi - - case $TARGET_DEVICE in - arm_v7 | nexus_4 | nexus_5 | nexus_6 | nexus_7 | nexus_10) - DEFINES="${DEFINES} target_cpu=\"arm\"" - GDBSERVER_DIR="${ANDROID_NDK_ROOT}/prebuilt/android-arm" - IS_64_BIT=false - ;; - arm64 | nexus_9 | nexus_5x | nexus_6p | pixel) - DEFINES="${DEFINES} target_cpu=\"arm64\"" - GDBSERVER_DIR="${ANDROID_NDK_ROOT}/prebuilt/android-arm64" - IS_64_BIT=true - ;; - x86) - DEFINES="${DEFINES} target_cpu=\"x86\"" - GDBSERVER_DIR="${ANDROID_NDK_ROOT}/prebuilt/android-x86" - IS_64_BIT=false - ;; - x86_64 | x64) - DEFINES="${DEFINES} target_cpu=\"x64\"" - GDBSERVER_DIR="${ANDROID_NDK_ROOT}/prebuilt/android-x86_64" - IS_64_BIT=true - ;; - mips) - DEFINES="${DEFINES} target_cpu=\"mipsel\"" - GDBSERVER_DIR="${ANDROID_NDK_ROOT}/prebuilt/android-mips" - IS_64_BIT=false - #DEFINES="${DEFINES} skia_resource_cache_mb_limit=32" - ;; - mips64) - DEFINES="${DEFINES} target_cpu=\"mips64el\"" - GDBSERVER_DIR="${ANDROID_NDK_ROOT}/prebuilt/android-mips64" - IS_64_BIT=true - ;; - *) - echo "ERROR: unknown device $TARGET_DEVICE" - exit 1 - ;; - esac - - verbose "The build is targeting the device: $TARGET_DEVICE" - exportVar DEVICE_ID $TARGET_DEVICE - exportVar GN_ARGS "$DEFINES" - exportVar GDBSERVER_DIR $GDBSERVER_DIR - exportVar IS_64_BIT $IS_64_BIT - - SKIA_SRC_DIR=$(cd "${UTIL_DIR}/../../../.."; pwd) - DEFAULT_SKIA_OUT="${SKIA_SRC_DIR}/out/android-${TARGET_DEVICE}" - exportVar SKIA_OUT "${SKIA_OUT:-${DEFAULT_SKIA_OUT}}" -} - # adb_pull_if_needed(android_src, host_dst) adb_pull_if_needed() { @@ -247,5 +172,3 @@ adb_push_if_needed() { # turn error checking back on set -e } - -setup_device "${DEVICE_ID}" -- cgit v1.2.3