forked from ontop/ontop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-release.sh
executable file
·213 lines (167 loc) · 6.5 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
#!/usr/bin/env bash
########################################################################
#
# Ontop build script
#
# <xiao(a)inf.unibz.it>
#
# Build Requirements
# - Java 8
# - Maven
# - git
# - git-lfs
#
########################################################################
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" -ne "8" ]]; then
echo "ERROR: Java 8 is required for building Ontop! Current Java version: $JAVA_VER"
exit 1
fi
echo '$ mvn -version'
mvn -version || { echo "ERROR: maven is not installed!" ; exit 1 ; }
echo ""
echo "$ git --version"
git --version || exit 1
echo ""
echo "$ git lfs env"
git lfs env || { echo "ERROR: git-lfs is not installed or not configured!" ; 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}/ontop-build-dependencies
if [ -d "${ONTOP_DEP_HOME}" ] && [ -f "${ONTOP_DEP_HOME}/.git" ]
then
echo ""
echo "========================================="
echo " Starting Ontop build script ... "
echo "-----------------------------------------"
echo ""
else
echo "ERROR: git submodule 'ontop-build-dependencies' is missing or uninitiated!"
echo "Please run 'git submodule init && git submodule update'"
exit 1
fi
# location for protege clean folder
PROTEGE_COPY_FILENAME=Protege-5.0.0-platform-independent
PROTEGE_MAIN_FOLDER_NAME=Protege-5.0.0
PROTEGE_MAIN_PLUGIN=ontop-protege-plugin
# location and name for jetty distribution (should be ZIP)
JETTY_COPY_FILENAME=jetty-distribution-8.1.9
JETTY_INNER_FOLDERNAME=jetty-distribution-8.1.9
# name of the wars for sesame and workbench WEB-APPs (these have to be already customized with stylesheets)
OPENRDF_SESAME_FILENAME=openrdf-sesame
OPENRDF_WORKBENCH_FILENAME=openrdf-workbench
ONTOP_SESAME_WEBAPPS=ontop-sesame-webapps
# folder names of the output
PROTEGE_DIST=ontop-protege
QUEST_SESAME_DIST=ontop-sesame
QUEST_JETTY_DIST=ontop-jetty
ONTOP_DIST=ontop-dist
# jar name of the pretege plugin
PROTEGE_PLUGIN_NAME=it.unibz.inf.ontop.protege
#
# Start building the packages
#
cd ${BUILD_ROOT}
echo ""
echo "========================================="
echo " Cleaning "
echo "-----------------------------------------"
echo ""
mvn clean
echo ""
echo "========================================="
echo " Compiling "
echo "-----------------------------------------"
echo ""
mvn install -DskipTests || exit 1
VERSION=$(cat ${BUILD_ROOT}/obdalib-core/target/classes/version.properties | sed 's/version=\(.*\)/\1/')
#
echo ""
echo "========================================="
echo " Building Protege distribution package "
echo "-----------------------------------------"
echo ""
rm -fr ${BUILD_ROOT}/ontop-protege/dist
cd ${BUILD_ROOT}/ontop-protege/
mvn bundle:bundle -DskipTests || exit 1
rm -fr ${BUILD_ROOT}/quest-distribution/${PROTEGE_DIST}
mkdir ${BUILD_ROOT}/quest-distribution/${PROTEGE_DIST}
cp target/${PROTEGE_PLUGIN_NAME}-${VERSION}.jar \
${BUILD_ROOT}/quest-distribution/${PROTEGE_DIST}/${PROTEGE_PLUGIN_NAME}-${VERSION}.jar
cp ${ONTOP_DEP_HOME}/${PROTEGE_COPY_FILENAME}.zip ${BUILD_ROOT}/quest-distribution/${PROTEGE_DIST}/ || exit 1
cd ${BUILD_ROOT}/quest-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}/quest-distribution
# Packing the sesame distribution
#
echo ""
echo "========================================="
echo " Building Sesame distribution package "
echo "-----------------------------------------"
echo ""
rm -fr ${QUEST_SESAME_DIST}
mkdir -p ${QUEST_SESAME_DIST}/WEB-INF/lib
mvn assembly:assembly -DskipTests || exit 1
cp target/ontop-distribution-${VERSION}-sesame-bin.jar ${QUEST_SESAME_DIST}/WEB-INF/lib/ontop-distribution-${VERSION}.jar || exit 1
unzip -q -d ${QUEST_SESAME_DIST}/WEB-INF/lib/ target/ontop-distribution-${VERSION}-dependencies.zip || exit 1
cp ${ONTOP_DEP_HOME}/${OPENRDF_SESAME_FILENAME}.war ${QUEST_SESAME_DIST}/
cp ${ONTOP_DEP_HOME}/${OPENRDF_WORKBENCH_FILENAME}.war ${QUEST_SESAME_DIST}/
cd ${QUEST_SESAME_DIST}
echo ""
echo "[INFO] Adding QuestSesame and dependency JARs to openrdf-sesame.war"
jar -uf ${OPENRDF_SESAME_FILENAME}.war WEB-INF/lib/* || exit 1
echo "[INFO] Adding QuestSesame and dependency JARs to openrdf-workbench.war"
jar -uf ${OPENRDF_WORKBENCH_FILENAME}.war WEB-INF/lib/* || exit 1
zip ${ONTOP_SESAME_WEBAPPS}-${VERSION}.zip ${OPENRDF_SESAME_FILENAME}.war ${OPENRDF_WORKBENCH_FILENAME}.war || exit 1
rm -fr WEB-INF
cd ${BUILD_ROOT}/quest-distribution
# Packaging the sesame jetty distribution
#
echo ""
echo "========================================="
echo " Building Jetty distribution package "
echo "-----------------------------------------"
rm -fr ${QUEST_JETTY_DIST}
mkdir ${QUEST_JETTY_DIST}
cp ${ONTOP_DEP_HOME}/${JETTY_COPY_FILENAME}.zip ${QUEST_JETTY_DIST}/ontop-jetty-bundle-${VERSION}.zip || exit 1
JETTY_FOLDER=${JETTY_INNER_FOLDERNAME}
cd ${QUEST_JETTY_DIST}
mkdir -p ${JETTY_INNER_FOLDERNAME}/webapps
cp ${BUILD_ROOT}/quest-distribution/${QUEST_SESAME_DIST}/${OPENRDF_SESAME_FILENAME}.war ${JETTY_FOLDER}/webapps
cp ${BUILD_ROOT}/quest-distribution/${QUEST_SESAME_DIST}/${OPENRDF_WORKBENCH_FILENAME}.war ${JETTY_FOLDER}/webapps
zip ontop-jetty-bundle-${VERSION}.zip ${JETTY_FOLDER}/webapps/* || exit 1
rm -fr ${JETTY_FOLDER}
cd ${BUILD_ROOT}/quest-distribution
# Packaging the OWL-API distribution
#
echo ""
echo "========================================="
echo " Building Ontop distribution package "
echo "-----------------------------------------"
rm -fr ${ONTOP_DIST}
mkdir ${ONTOP_DIST}
echo "[INFO] Copying files..."
cp target/ontop-distribution-${VERSION}-bin.zip ${ONTOP_DIST}/ontop-distribution-${VERSION}.zip
echo ""
echo "========================================="
echo " Done. "
echo "-----------------------------------------"
echo ""