#! /bin/sh # Copyright 2018 Google Inc. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. usage() { cat >&2 < /dev/null || usage command -v python > /dev/null || usage for ARCH in $*; do case $ARCH in arm|arm64|x86|x64);; *) usage;; esac; done set -x # Verbose set -e # Exit immediately # check if OUTPUT_DIR was set in the environment. if [ -z "${APK_OUTPUT_DIR}" ]; then APK_OUTPUT_DIR=out/skqp fi cd "$(dirname "$0")/../.." python tools/skqp/download_model if [ -z "$SKQP_EXTRA_MODELS" ]; then python tools/skqp/remove_unneeded_assets fi python tools/skqp/setup_resources APP=skqp LIB=libskqp_app.so find platform_tools/android/apps/$APP -name $LIB -exec rm {} + if [ $# -eq 0 ]; then set -- arm arm64 x86 x64 fi for ARCH in $*; do BUILD="${APK_OUTPUT_DIR}-${ARCH}" if [ "$SKQP_DEBUG" ]; then python tools/skqp/generate_gn_args $BUILD-debug "$ANDROID_NDK" --arch "$ARCH" --debug else python tools/skqp/generate_gn_args $BUILD "$ANDROID_NDK" --arch "$ARCH" fi bin/gn gen $BUILD ninja -C $BUILD $LIB case $ARCH in arm) NATIVE=armeabi-v7a ;; arm64) NATIVE=arm64-v8a ;; x86) NATIVE=x86 ;; x64) NATIVE=x86_64 ;; *) usage ;; esac DST=platform_tools/android/apps/$APP/src/main/libs/$NATIVE mkdir -p $DST cp -a $BUILD/$LIB $DST/$LIB done ( cd platform_tools/android apps/gradlew -p apps/$APP -P suppressNativeBuild :$APP:assembleUniversalDebug ) mkdir -p $APK_OUTPUT_DIR cp platform_tools/android/apps/$APP/build/outputs/apk/$APP-universal-debug.apk "${APK_OUTPUT_DIR}/"