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