1#!/bin/bash 2 3# Copyright 2020 The Amber Authors. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17set -e # fail on error 18 19. /bin/using.sh # Declare the bash `using` function for configuring toolchains. 20 21set -x # show commands 22 23# Disable git's "detected dubious ownership" error - kokoro checks out the repo with a different 24# user, and we don't care about this warning. 25git config --global --add safe.directory '*' 26 27using cmake-3.17.2 28using ninja-1.10.0 29using python-3.12 30 31if [ ! -z "$COMPILER" ]; then 32 using "$COMPILER" 33fi 34 35# Possible configurations are: 36# DEBUG, RELEASE 37 38BUILD_TYPE="Debug" 39if [ $CONFIG = "RELEASE" ] 40then 41 BUILD_TYPE="RelWithDebInfo" 42fi 43 44# Make a directory for Dawn dependencies 45mkdir -p $ROOT_DIR/build/out/dawn-deps && cd $ROOT_DIR/build/out/dawn-deps 46 47# Get depot tools 48git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 49export PATH="$PWD/depot_tools:$PATH" 50 51# Clone the repo as "dawn" 52git clone https://dawn.googlesource.com/dawn dawn && cd dawn 53DAWN=$PWD 54 55# Bootstrap the gclient configuration 56cp scripts/standalone.gclient .gclient 57 58# Fetch external dependencies and toolchains with gclient 59gclient sync 60 61sudo chown -R "$(id -u):$(id -g)" build/ 62sudo chown -R "$(id -u):$(id -g)" third_party/ 63 64# Generate build files 65mkdir -p out/Release 66touch out/Release/args.gn 67gn gen out/Release 68 69# build dawn 70ninja -C out/Release 71 72cd $ROOT_DIR 73./tools/git-sync-deps 74 75cd $ROOT_DIR/build 76 77# Invoke the build. 78BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} 79echo $(date): Starting build... 80 81cmake -GNinja ..\ 82 -DCMAKE_BUILD_TYPE=$BUILD_TYPE\ 83 -DDawn_INCLUDE_DIR=$DAWN/src/include\ 84 -DDawn_GEN_INCLUDE_DIR=$DAWN/out/Release/gen/src/include\ 85 -DDawn_LIBRARY_DIR=$DAWN/out/Release 86 87echo $(date): Build everything... 88ninja 89echo $(date): Build completed. 90 91echo $(date): Starting amber_unittests... 92./amber_unittests 93echo $(date): amber_unittests completed. 94