Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/shaderc
Path: blob/main/kokoro/ndk-build/build.sh
1560 views
1
#!/bin/bash
2
# Copyright (c) 2021 Google LLC.
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
# Linux Build Script.
17
18
# Fail on any error.
19
set -e
20
21
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
22
ROOT_DIR="$( cd "${SCRIPT_DIR}/../.." >/dev/null 2>&1 && pwd )"
23
24
BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT}
25
26
# chown the given directory to the current user, if it exists.
27
# Docker creates files with the root user - this can upset the Kokoro artifact copier.
28
function chown_dir() {
29
dir=$1
30
if [[ -d "$dir" ]]; then
31
sudo chown -R "$(id -u):$(id -g)" "$dir"
32
fi
33
}
34
35
set +e
36
# Allow build failures
37
38
# "--privileged" is required to run ptrace in the asan builds.
39
docker run --rm -i \
40
--privileged \
41
--volume "${ROOT_DIR}:${ROOT_DIR}" \
42
--volume "${KOKORO_ARTIFACTS_DIR}:${KOKORO_ARTIFACTS_DIR}" \
43
--workdir "${ROOT_DIR}" \
44
--env SCRIPT_DIR=${SCRIPT_DIR} \
45
--env ROOT_DIR=${ROOT_DIR} \
46
--env KOKORO_ARTIFACTS_DIR="${KOKORO_ARTIFACTS_DIR}" \
47
--env BUILD_SHA="${BUILD_SHA}" \
48
--entrypoint "${SCRIPT_DIR}/build-docker.sh" \
49
"gcr.io/shaderc-build/radial-build:latest"
50
RESULT=$?
51
52
# This is important. If the permissions are not fixed, kokoro will fail
53
# to pull build artifacts, and put the build in tool-failure state, which
54
# blocks the logs.
55
chown_dir "${ROOT_DIR}/build"
56
exit $RESULT
57
58