-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild-jenkins
executable file
·79 lines (61 loc) · 1.79 KB
/
build-jenkins
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
#!/bin/sh
# Script is runing from Jenkins.
#
# determining from which directory script is executed
DIR="$( cd -P "$( dirname "$0" )" && pwd )"
# if build-jenkins uses outside bin/ dir then uncomment string below
#DIR="$DIR/bin"
# clean DerivedData and Workspace
if [ "_$CleanProject" = "_true" ]
then
echo
echo "-- PROJECT CLEANING --"
echo
DERIVEDDATA_DIR=$(grep -oE "/usr/bin/touch -c .*\.app" "$DIR/../output/build.log" 2> /dev/null| head -n1 | sed -e 's/.*\ \(.*\)\/Build\/.*/\1/')
if [ ! -d "$DERIVEDDATA_DIR" ]
then
DERIVEDDATA_DIR=$(grep "BUILD_DIR" "$DIR/../output/build.log" 2> /dev/null | head -n1 | sed "s/setenv[[:blank:]]BUILD_DIR[[:blank:]]\([[:graph:]]\)/\1/;s/\ //g;s/Build\/Products//")
fi
if [ -d "$DERIVEDDATA_DIR" ]
then
rm -rf "$DERIVEDDATA_DIR"
echo "[DEBUG] DerivedData $DERIVEDDATA_DIR is removed"
else
echo "[WARNING] DerivedData dir $DERIVEDDATA_DIR is not found"
echo
echo "[INFO] First build project and then you may clean DerivedData"
echo
fi
echo
find . -exec rm -rf {} \; 2> /dev/null
echo "[DEBUG] Workspace $WORKSPACE is removed"
echo
exit
fi
# install pods
if [ "$SKIP_PODS_INSTALL" != "true" ]
then
"${DIR}/scripts/pods.sh"
fi
# going to cintegration / bin directory
cd "${DIR}"
if [ $# -gt 0 ]
then
INIT_TYPE=$1
export INIT_TYPE
fi
# Next we will iterate over all ENV variables with names starting CIBuild
# and execute build in specified configuration
pattern="Build"
env_params=`export | grep $pattern | sed "s/^.*\($pattern.*\)=.*/\1/"`
# echo "[DEBUG $env_params]"
for i in $env_params
do
if [ `printenv $i` = "true" ]; then
param=`echo $i | sed s/^$pattern// | tr '[:upper:]' '[:lower:]'`
./build $param
if [ "$?" -ne "0" ]; then
exit 1
fi
fi
done