forked from dsanmartins/rainbow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·134 lines (111 loc) · 2.63 KB
/
build.sh
File metadata and controls
executable file
·134 lines (111 loc) · 2.63 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
PROG=$0
target=install
jcctarget="javacc:javacc install"
TIMESTAMP=`date +'%Y%m%d%H%M'`
VERSION=$TIMESTAMP
function usage () {
echo "Usage $PROG [-d deployment-dir] [-t target] [-v version] [command]"
echo " -d -the deployment that you want included in the build, either relative or in the dir deployments"
echo " -t -the comma separated list of targets to include in the build, either relative or in the targets dir"
echo " -v -the version label to give the release"
echo "command -the build command to give"
}
while getopts :d:t:v: opt; do
case $opt in
d)
if [ -d "$OPTARG" ]; then
DEPLOYMENT=$OPTARG
elif [ -d "deployments/$OPTARG" ]; then
DEPLOYMENT="deployments/$OPTARG"
else
echo "'$OPTARG' not found either relative or in deployments directory"
usage
exit 1
fi
;;
t)
IFS=, read -r -a targets <<< $OPTARG
TARGETS=()
for i in "${targets[@]}"; do
if [ -d "$i" ]; then
TARGETS+=($i)
elif [ -d "targets/$i" ]; then
TARGETS+=("targets/$i")
else
echo "'$i' was not found as a target (even in targets/)"
fi
done
if [ ${#TARGETS[@]} -eq 0 ]; then
echo "None of the targets specified as an argument to -t exist; presuming error!"
usage
exit 1
fi
;;
v)
VERSION=$OPTARG"-$TIMESTAMP"
;;
\?)
usage
exit 1
;;
:)
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ ! -d "rainbow" -o ! -d "libs" ]; then
echo "FATAL: Could not find the rainbow directory containing sourc for the core Rainbow components and libraries!"
exit 1
fi
if [[ "$#" == 1 ]]; then
if [[ "$1" != "install" ]]; then
target=$1
jcctarget=$1
fi
fi
echo "Doing $target"
mkdir -p bin/lib
cd libs/
cd auxtestlib
mvn $target
cd ../incubator
mvn $target
cd ../parsec
mvn $jcctarget -DskipTests
cd ../typelib
mvn $jcctarget
cd ../eseblib
mvn $target -DskipTests
cd ../../rainbow
cd rainbow-core
mvn $target -DskipTests
cd ../rainbow-acme-model
mvn $target -DskipTests
cd ../rainbow-utility-model
mvn $target
cd ../rainbow-stitch
mvn $target
cd ../..
BUILDDIR=`pwd`
cd $DEPLOYMENT
mvn $target
if [[ "$target" == "install" ]]; then
cp target/*.jar $BUILDDIR/bin/lib
cp target/lib/* $BUILDDIR/bin/lib
cd $BUILDDIR
mkdir -p bin/targets
for i in $TARGETS; do
cp -r $i bin/targets
done
cp scripts/* bin/
cp license.html bin/
mv bin Rainbow-$VERSION
zip Rainbow-$VERSION
elif [[ "$target" == "clean" ]]; then
cd $BUILDDIR
rm -rf Rainbow-$VERSION
rm Rainbow-$VERSION.zip
fi