1#! /bin/sh
2
3# Copyright 2018 Google Inc.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7set -e
8
9ANDROID_NDK="$1"
10
11if ! [ -d "$ANDROID_NDK" ] || ! [ -x "${ANDROID_NDK}/ndk-build" ]; then
12    printf "\nUsage:\n  %s ANDROID_NDK_PATH\n" "$0" >&2
13    exit 1
14fi
15
16case ":${PATH}:" in
17    */depot_tools:*) ;;
18    *)
19        printf '\ndepot_tools should be in your $PATH.\n' >&2
20        exit 1;;
21esac
22
23if ! [ -d "$ANDROID_HOME" ] || ! [ -x "${ANDROID_HOME}/platform-tools/adb" ]; then
24    printf '\n$ANDROID_HOME not set or is broken.\n' >&2
25    exit 1
26fi
27
28set -x
29
30ARCH=${SKQP_ARCH:-arm}
31
32cd "$(dirname "$0")/../.."
33
34BUILD=out/skqp-${ARCH}
35
36python tools/skqp/generate_gn_args $BUILD "$ANDROID_NDK" $ARCH
37
38GIT_SYNC_DEPS_QUIET=Y tools/git-sync-deps
39
40bin/gn gen $BUILD
41
42rm -rf $BUILD/gen
43
44platform_tools/android/bin/android_build_app -C $BUILD skqp
45
46set +x
47
48printf '\n\nAPK built: "%s/skqp.apk"\n\n' "$(pwd)/$BUILD"
49
50