1#!/bin/bash 2# Copyright 2018 The Amber Authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16set -e # fail on error 17set -x # display commands 18 19BUILD_ROOT="$PWD" 20SRC="$PWD/github/amber" 21 22# Disable git's "detected dubious ownership" error - kokoro checks out the repo with a different 23# user, and we don't care about this warning. 24git config --global --add safe.directory '*' 25 26# NDK Path 27export ANDROID_NDK="$BUILD_ROOT/android-ndk-r25b" 28 29# Get NINJA. 30wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip 31unzip -q ninja-linux.zip 32export PATH="$PWD:$PATH" 33 34# Get Android NDK. 35wget -q https://dl.google.com/android/repository/android-ndk-r25b-linux.zip 36unzip -q android-ndk-r25b-linux.zip 37# ANDROID_NDK is set earlier. 38 39cd "$SRC" 40./tools/git-sync-deps 41./tools/update_build_version.py . samples/ third_party/ 42./tools/update_vk_wrappers.py . . 43 44mkdir -p build/libs build/app 45cd "$SRC/build" 46 47# Invoke the build. 48 49echo "$(date): Starting ndk-build for android_test ..." 50"$ANDROID_NDK/ndk-build" \ 51 -C "$SRC/android_test" \ 52 NDK_PROJECT_PATH=. \ 53 "NDK_LIBS_OUT=$(pwd)/libs" \ 54 "NDK_APP_OUT=$(pwd)/app" \ 55 -j8 56 57echo "$(date): ndk-build for android_test completed." 58 59echo "$(date): Starting ndk-build for samples ..." 60"$ANDROID_NDK/ndk-build" \ 61 -C "$SRC/samples" \ 62 NDK_PROJECT_PATH=. \ 63 "NDK_LIBS_OUT=$(pwd)/libs" \ 64 "NDK_APP_OUT=$(pwd)/app" \ 65 -j8 66echo "$(date): ndk-build for samples completed." 67