1#!/bin/bash 2# Copyright 2016 The gRPC 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# 16# This script is invoked by build_and_run_docker.sh inside a docker 17# container. You should never need to call this script on your own. 18 19set -e 20 21if [ "${RELATIVE_COPY_PATH}" == "" ] 22then 23 mkdir -p /var/local/git 24 git clone "${EXTERNAL_GIT_ROOT}" /var/local/git/grpc 25 # clone gRPC submodules, use data from locally cloned submodules where possible 26 # TODO: figure out a way to eliminate this following shellcheck suppressions 27 # shellcheck disable=SC2016,SC1004 28 (cd "${EXTERNAL_GIT_ROOT}" && git submodule foreach 'git clone ${EXTERNAL_GIT_ROOT}/${name} /var/local/git/grpc/${name}') 29 (cd /var/local/git/grpc && git submodule init) 30else 31 mkdir -p "/var/local/git/grpc/${RELATIVE_COPY_PATH}" 32 cp -r "${EXTERNAL_GIT_ROOT}/${RELATIVE_COPY_PATH}"/* "/var/local/git/grpc/${RELATIVE_COPY_PATH}" 33fi 34 35cd /var/local/git/grpc 36 37# whatever is written to the reports/ dir will be made available outside of the docker container. 38ln -s "${EXTERNAL_GIT_ROOT}/reports" reports 39# if OUTPUT_DIR is specified, whatever is written to ./${OUTPUT_DIR}/ will be made available outside of the docker container. 40if [ "${OUTPUT_DIR}" != "" ] 41then 42 ln -s "${EXTERNAL_GIT_ROOT}/${OUTPUT_DIR}" "${OUTPUT_DIR}" 43fi 44 45exit_code=0 46${DOCKER_RUN_SCRIPT_COMMAND} || exit_code=$? 47 48if [ -x "$(command -v ccache)" ] 49then 50 ccache --show-stats || true 51fi 52 53exit $exit_code 54