This repository was archived by the owner on Sep 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathbuild.sh
executable file
·90 lines (72 loc) · 2.07 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Builds all components.
function install_wget() {
echo "Installing wget"
apt-get install -y -qq wget
}
function install_node() {
wget --version || install_wget
echo "Installing NodeJS"
mkdir -p /tools/node
wget -nv https://nodejs.org/dist/v8.9.0/node-v8.9.0-linux-x64.tar.gz -O node.tar.gz
tar xzf node.tar.gz -C /tools/node --strip-components=1
rm node.tar.gz
export "PATH=${PATH}:/tools/node/bin"
}
function install_git() {
echo "Updating apt repository"
apt-get update -y -qq
echo "Installing git"
apt-get install -y -qq git
}
function install_rsync() {
echo "Installing rsync"
apt-get install -y -qq rsync
}
function install_prereqs() {
git version || install_git
rsync -h >/dev/null 2>&1 || install_rsync
# Use -v instead of -h to test npm installation, since -h returns non-zero
npm -v >/dev/null 2>&1 || install_node
source ./tools/initenv.sh
}
pushd $(pwd) >> /dev/null
cd $(dirname "${BASH_SOURCE[0]}")/../
install_prereqs
SRC_PATHS=(
"web"
)
BUILD_DIR=$REPO_DIR/build
LOG_FILE=$BUILD_DIR/build.log
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR
for SRC in "${SRC_PATHS[@]}"
do
echo "Building $SRC ... " | tee -a $LOG_FILE
SRC_DIR=$REPO_DIR/sources/$SRC
cd $SRC_DIR
./build.sh
if [ "$?" -ne "0" ]; then
echo "failed" | tee -a $LOG_FILE
echo "Build aborted." | tee -a $LOG_FILE
exit 1
else
echo "succeeded" | tee -a $LOG_FILE
fi
echo | tee -a $LOG_FILE
done
echo "Build completed." | tee -a $LOG_FILE
popd >> /dev/null