forked from ontop/ontop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-release.sh
executable file
·237 lines (185 loc) · 7.11 KB
/
build-release.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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#!/usr/bin/env bash
########################################################################
#
# Ontop build script
#
# <xiao(a)inf.unibz.it>
#
# Build Requirements
# - Java 8
# - Maven
# - git
# - wget
#
########################################################################
# user could invoke the script as 'sh build-release.sh'
if [ ! -n "$BASH" ]; then
echo "Please run this script with bash or run it as ./$0"
exit 1
fi
if type -p java; then
JAVA=java
elif [[ -n "${JAVA_HOME}" ]] && [[ -x "${JAVA_HOME}/bin/java" ]]; then
JAVA="${JAVA_HOME}/bin/java"
else
echo "ERROR: Java is not installed!"
exit 1
fi
echo '$ java -version'
${JAVA} -version || exit 1
echo ""
JAVA_VER=$(${JAVA} -version 2>&1 | sed 's/version "\(.*\)\.\(.*\)\..*"/\2/; 1q')
#echo version "$version"
#if [[ "$JAVA_VER" != "java 8" ]]; then
# echo "ERROR: Java 8 is required for building Ontop! Current Java version: $JAVA_VER"
# exit 1
#fi
echo '$ ./mvnw -version'
./mvnw -version
echo ""
echo "$ git --version"
git --version || exit 1
echo ""
# location for the build ROOT folder (i.e. the directory of this script)
BUILD_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# location for the build dependencies home
ONTOP_DEP_HOME=${BUILD_ROOT}/build/dependencies
echo ""
echo "========================================="
echo " Starting Ontop build script ... "
echo "-----------------------------------------"
echo ""
# location for protege clean folder
PROTEGE_URL="https://github.com/protegeproject/protege-distribution/releases/download/v5.5.0/Protege-5.5.0-platform-independent.zip"
PROTEGE_COPY_FILENAME=Protege-5.5.0-platform-independent
PROTEGE_MAIN_FOLDER_NAME=Protege-5.5.0
if [ ! -f ${ONTOP_DEP_HOME}/${PROTEGE_COPY_FILENAME}.zip ] ; then
wget ${PROTEGE_URL} -P ${ONTOP_DEP_HOME} || exit 1
fi
# location and name for jetty distribution (should be ZIP)
# location for protege clean folder
JETTY_URL="https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.20.v20190813/jetty-distribution-9.4.20.v20190813.zip"
JETTY_COPY_FILENAME=jetty-distribution-9.4.20.v20190813
JETTY_INNER_FOLDERNAME=jetty-distribution-9.4.20.v20190813
if [ ! -f ${ONTOP_DEP_HOME}/${JETTY_COPY_FILENAME}.zip ] ; then
wget ${JETTY_URL} -P ${ONTOP_DEP_HOME} || exit 1
fi
# location and name for tomcat distribution (should be zip)
TOMCAT_URL="https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.zip"
TOMCAT_FILENAME=apache-tomcat-9.0.24
if [ ! -f ${ONTOP_DEP_HOME}/${TOMCAT_FILENAME}.zip ] ; then
wget ${TOMCAT_URL} -P ${ONTOP_DEP_HOME} || exit 1
fi
# folder names of the output
PROTEGE_DIST=ontop-protege
ONTOP_JETTY_DIST=ontop-jetty
ONTOP_TOMCAT_DIST=ontop-tomcat
ONTOP_CLI=ontop-cli
# jar name of the protege plugin
PROTEGE_PLUGIN_NAME=it.unibz.inf.ontop.protege
#
# Start building the packages
#
cd ${BUILD_ROOT}
echo ""
echo "========================================="
echo " Cleaning "
echo "-----------------------------------------"
echo ""
mvn clean -q
echo ""
echo "========================================="
echo " Compiling "
echo "-----------------------------------------"
echo ""
mvn install -DskipTests -q || exit 1
echo "[INFO] Compilation completed"
VERSION=$(cat ${BUILD_ROOT}/engine/system/core/target/classes/version.properties | sed 's/version=\(.*\)/\1/')
#
echo ""
echo "========================================="
echo " Building Protege distribution package "
echo "-----------------------------------------"
echo ""
cd ${BUILD_ROOT}/client/protege/
mvn bundle:bundle -DskipTests || exit 1
rm -fr ${BUILD_ROOT}/build/distribution/${PROTEGE_DIST}
mkdir -p ${BUILD_ROOT}/build/distribution/${PROTEGE_DIST}
cp target/${PROTEGE_PLUGIN_NAME}-${VERSION}.jar \
${BUILD_ROOT}/build/distribution/${PROTEGE_DIST}/${PROTEGE_PLUGIN_NAME}-${VERSION}.jar
cp ${ONTOP_DEP_HOME}/${PROTEGE_COPY_FILENAME}.zip ${BUILD_ROOT}/build/distribution/${PROTEGE_DIST}/ || exit 1
cd ${BUILD_ROOT}/build/distribution/${PROTEGE_DIST}/
mkdir -p ${PROTEGE_MAIN_FOLDER_NAME}/plugins
cp ${PROTEGE_PLUGIN_NAME}-${VERSION}.jar ${PROTEGE_MAIN_FOLDER_NAME}/plugins/
zip ${PROTEGE_COPY_FILENAME}.zip ${PROTEGE_MAIN_FOLDER_NAME}/plugins/*
mv ${PROTEGE_COPY_FILENAME}.zip ontop-protege-bundle-${VERSION}.zip
rm -fr ${PROTEGE_MAIN_FOLDER_NAME}
cd ${BUILD_ROOT}/build/distribution
# Packing the rdf4j distribution
#
echo ""
echo "========================================="
echo " Building RDF4J distribution package "
echo "-----------------------------------------"
echo ""
mkdir -p ${BUILD_ROOT}/build/distribution/ontop-webapps
cp ${BUILD_ROOT}/client/rdf4j-webapps/server/target/rdf4j-server.war ${BUILD_ROOT}/build/distribution/ontop-webapps
cp ${BUILD_ROOT}/client/rdf4j-webapps/workbench/target/rdf4j-workbench.war ${BUILD_ROOT}/build/distribution/ontop-webapps
cd ${BUILD_ROOT}/build/distribution/ontop-webapps
zip -r ontop-webapps-${VERSION}.zip *.war
cd ${BUILD_ROOT}/build/distribution
# Packaging the rdf4j jetty distribution
#
echo ""
echo "========================================="
echo " Building Jetty distribution package "
echo "-----------------------------------------"
echo ""
rm -fr ${ONTOP_JETTY_DIST}
mkdir -p ${ONTOP_JETTY_DIST}
cp ${ONTOP_DEP_HOME}/${JETTY_COPY_FILENAME}.zip ${ONTOP_JETTY_DIST}/ontop-jetty-bundle-${VERSION}.zip || exit 1
JETTY_FOLDER=${JETTY_INNER_FOLDERNAME}
cd ${ONTOP_JETTY_DIST}
mkdir -p ${JETTY_INNER_FOLDERNAME}/ontop-base/webapps
mkdir -p ${JETTY_INNER_FOLDERNAME}/ontop-base/lib/ext
cp ${BUILD_ROOT}/build/distribution/ontop-webapps/*.war ${JETTY_FOLDER}/ontop-base/webapps
cp ${BUILD_ROOT}/client/jetty/start.ini ${JETTY_FOLDER}/ontop-base
cp ${BUILD_ROOT}/client/jetty/README.md ${JETTY_FOLDER}/README_ONTOP_JETTY.md
zip -rq ontop-jetty-bundle-${VERSION}.zip ${JETTY_FOLDER}/ || exit 1
echo "[INFO] Built ontop-jetty-bundle-${VERSION}.zip"
rm -fr ${JETTY_FOLDER}
cd ${BUILD_ROOT}/build/distribution
# Packaging the tomcat distribution
#
echo ""
echo "========================================="
echo " Building Tomcat distribution package "
echo "-----------------------------------------"
echo ""
rm -fr ${ONTOP_TOMCAT_DIST}
mkdir -p ${ONTOP_TOMCAT_DIST}
cp ${ONTOP_DEP_HOME}/${TOMCAT_FILENAME}.zip ${ONTOP_TOMCAT_DIST}/ontop-tomcat-bundle-${VERSION}.zip || exit 1
cd ${ONTOP_TOMCAT_DIST}
mkdir -p ${TOMCAT_FILENAME}/webapps
cp ${BUILD_ROOT}/build/distribution/ontop-webapps/*.war ${TOMCAT_FILENAME}/webapps
zip ontop-tomcat-bundle-${VERSION}.zip ${TOMCAT_FILENAME}/webapps/* || exit 1
echo "[INFO] Built ontop-tomcat-bundle-${VERSION}.zip"
rm -fr ${TOMCAT_FILENAME}
cd ${BUILD_ROOT}/build/distribution
# Packaging the cli distribution
#
echo ""
echo "========================================="
echo " Building Ontop CLI distribution package "
echo "-----------------------------------------"
echo ""
mvn assembly:assembly
rm -fr ${ONTOP_CLI}
mkdir -p ${ONTOP_CLI}
echo "[INFO] Copying files..."
cp target/${ONTOP_CLI}-${VERSION}.zip ${ONTOP_CLI}
echo ""
echo "========================================="
echo " Done. "
echo "-----------------------------------------"
echo ""