forked from garberlog/ARIS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
compile
executable file
·152 lines (140 loc) · 3.94 KB
/
compile
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash
unset CDPATH
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit 1
VERSION=$(cat libaris/src/main/resources/edu/rpi/aris/VERSION)
OPTIND=1
compile() {
echo Cleaning build directory before compiling
rm -rf build/
make clean
./gradlew clean
echo Compiling gradle and native libraries
make all
if [ "$?" -ne "0" ]; then
echo An error occurred during compiling
exit 1
fi
echo Rebuilding jars
./gradlew jar
echo Compiliation complete
}
build_update() {
if [ "$?" -ne "0" ]; then
echo "zip is required to build packages and does not appear to be present"
exit 1
fi
rm build/server-update.zip &> /dev/null
echo -n Building update zip files ...
mkdir -p build/server-update
cp -r packaging/extra/server/* build/server-update
cp -r assign-server/jars/* build/server-update
cd build/server-update || exit 1
zip -r ../server-update.zip * > /dev/null
cd ../.. || exit 1
mkdir -p build/client-update
# cp -r packaging/extra/client/* build/client-update
cp -r assign-client/jars/* build/client-update
cd build/client-update || exit 1
zip -r ../client-update.zip * > /dev/null
cd ../.. || exit 1
echo " Done"
}
build_rpm() {
echo TODO: build_rpm
}
build_deb() {
command -v dpkg &> /dev/null
if [ "$?" -ne "0" ]; then
echo "dpkg is required to build deb package and does not appear to be present"
exit 1
fi
command -v sed &> /dev/null
if [ "$?" -ne "0" ]; then
echo "sed command is required to prepare files for packaging and does not appear to be present"
exit 1
fi
echo -n Building deb package ...
rm -rf build/deb
mkdir -p build/deb
cp -r packaging/deb/* build/deb
cd build/deb || exit 1
sed -i -e "s/__version__/$VERSION/g" server/DEBIAN/control
mkdir -p server/usr/lib/aris
cp -r ../../assign-server/jars/* server/usr/lib/aris
cp -r ../../packaging/extra/server/* server/usr/lib/aris
dpkg --build server > /dev/null
mv server.deb ../aris-assign-server-$VERSION.deb
cd ../.. || exit 1
echo " Done"
}
build_win() {
echo TODO build_win
# mkdir -p build/win
# if [ ! -e build/win/launch4j/launch4j ]; then
# echo -n Downloading launch4j ...
# wget -O build/win/launch4j.tgz https://cytranet.dl.sourceforge.net/project/launch4j/launch4j-3/3.11/launch4j-3.11-linux-x64.tgz &> /dev/null
# tar -xzf build/win/launch4j.tgz -C build/win > /dev/null
# echo " Done"
# fi
# echo -n Building windows package ...
# cp packaging/win/launch4j.xml build/win
# cp logo.ico build/win
# cd build/win
# launch4j/launch4j launch4j.xml > /dev/null
# cp aris.exe ..
# cd ..
# zip -r aris-win.zip aris.exe aris-client.jar lib > /dev/null
# echo " Done"
# echo -n Preparing installer files for NSIS ...
# mkdir -p win-installer
# cp -r aris.exe aris-client.jar lib ../logo.ico ../packaging/win/installscript.nsi win-installer
# cp ../LICENSE win-installer/LICENSE.txt
# cd ..
# echo " Done"
# echo To create the installer please use NSIS to run the script located in build/win-installer
}
usage() {
echo Usage: ./compile [options]
echo " -c Compile only (default)"
echo " -r Compile and build rpm"
echo " -d Compile and build deb"
echo " -w Compile and build windows exe"
echo " -a Compile and build all packages"
}
OPTS=0
while getopts "crdwah" opt; do
OPTS=1
case "$opt" in
c)
compile
;;
r)
compile
build_update
build_rpm
;;
d)
compile
build_update
build_deb
;;
w)
compile
build_update
build_win
;;
a)
compile
build_update
build_rpm
build_deb
build_win
;;
*)
usage
;;
esac
done
if [ "$OPTS" -eq "0" ]; then
compile
fi