1#!/bin/bash 2# 3# Copyright 2020 The Hafnium Authors. 4# 5# Use of this source code is governed by a BSD-style 6# license that can be found in the LICENSE file or at 7# https://opensource.org/licenses/BSD-3-Clause. 8 9# Fail on any error. 10set -e 11# Fail on any part of a pipeline failing. 12set -o pipefail 13# Treat unset variables as an error. 14set -u 15# Display commands being run. 16set -x 17 18TIMEOUT=(timeout --foreground) 19# Set path to prebuilts used in the build. 20UNAME_S=$(uname -s | tr '[:upper:]' '[:lower:]') 21UNAME_M=$(uname -m) 22 23if [ $UNAME_M == "x86_64" ] 24then 25 UNAME_M=x64 26fi 27 28export PREBUILTS="$PWD/prebuilts/${UNAME_S}-${UNAME_M}" 29export LD_LIBRARY_PATH="$(clang --print-resource-dir)/../.." 30 31# Set output and log directories. 32PROJECT="${PROJECT:-reference}" 33OUT="out/${PROJECT}" 34# Use the gn args command to search the value of enable_assertions in the 35# args.gn config file. Use grep to take the value from within the quotes. 36ENABLE_ASSERTIONS_BUILD=$(${PREBUILTS}/gn/gn args out/reference \ 37 --list=enable_assertions --short \ 38 | grep -oP '(?<=").*(?=")') 39if [ "$ENABLE_ASSERTIONS_BUILD" == "1" ] 40then 41 BUILD_TYPE="debug" 42else 43 BUILD_TYPE="release" 44fi 45LOG_DIR_BASE="${OUT}/kokoro_log/${BUILD_TYPE}" 46