Mercurial > dive4elements > river
comparison contrib/make_flys_release/make_release.sh @ 8523:e3f032870e7a
Release script: build binaries for publication when tagging and slightly mavenize the whole process.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 19 Dec 2014 20:50:29 +0100 |
parents | de8be181fa87 |
children | 25f9ab25affd |
comparison
equal
deleted
inserted
replaced
8522:48cce699e387 | 8523:e3f032870e7a |
---|---|
36 -?, --help Show this message | 36 -?, --help Show this message |
37 -w The working directory to use (do not use spaces in path) | 37 -w The working directory to use (do not use spaces in path) |
38 Default: $DEFAULT_WD | 38 Default: $DEFAULT_WD |
39 -t Tag the current default branch as "VERSION" | 39 -t Tag the current default branch as "VERSION" |
40 -o, --oracle Release is for oracle. | 40 -o, --oracle Release is for oracle. |
41 Suitable jar-files for JDBC driver and | 41 Suitable jar-file for JDBC driver has to be given with |
42 hibernate-spatial have to be given with the | 42 the environment variable ORACLE_JDBC |
43 environment variables ORACLE_JDBC and ORACLE_HIBERNATE | |
44 VERSION must be in the format MAYOR.MINOR.PATCH or default | 43 VERSION must be in the format MAYOR.MINOR.PATCH or default |
45 EOF | 44 EOF |
46 exit 0 | 45 exit 0 |
47 } | 46 } |
48 # --backend-db-url Url of database backend. Default: $BACKENDURL | 47 # --backend-db-url Url of database backend. Default: $BACKENDURL |
108 hg clone $FLYS_HG_REPO river | 107 hg clone $FLYS_HG_REPO river |
109 else | 108 else |
110 echo "Updating sources / Reverting changes" | 109 echo "Updating sources / Reverting changes" |
111 cd $FLYS_SOURCE_DIR | 110 cd $FLYS_SOURCE_DIR |
112 for repo in $REPOS; do | 111 for repo in $REPOS; do |
113 cd $repo && hg pull && hg revert -a && hg up && cd $FLYS_SOURCE_DIR | 112 cd $repo && hg purge && hg revert -a && hg pull -u && cd - |
114 done; | 113 done; |
115 fi | 114 fi |
116 | 115 |
117 if [ "$DO_TAG" = "TRUE" ]; then | 116 if [ "$DO_TAG" = "TRUE" ]; then |
118 echo "Tagging version $VERSION" | 117 echo "INFO: Tagging version $VERSION" |
119 for repo in $REPOS; do | 118 for repo in $REPOS; do |
120 cd $repo | 119 cd $repo |
121 CHANGESET=$(hg log -l1 |head -1 | awk -F: '{print $3}') | 120 CHANGESET=$(hg log -l1 |head -1 | awk -F: '{print $3}') |
122 echo "" | 121 echo "" |
123 echo "Do you really want to tag $repo rev: $CHANGESET as Version $VERSION?" | 122 echo "Do you really want to tag $repo rev: $CHANGESET as Version $VERSION?" |
147 hg up "$VERSION" | 146 hg up "$VERSION" |
148 fi | 147 fi |
149 cd $FLYS_SOURCE_DIR | 148 cd $FLYS_SOURCE_DIR |
150 done | 149 done |
151 | 150 |
152 rm -rf "$WORK_DIR/server" "$WORK_DIR/client" | 151 |
152 if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then | |
153 echo "INFO: download OpenLayers-2.11 for client" | |
154 cd $FLYS_SOURCE_DIR | |
155 wget "https://github.com/openlayers/openlayers/releases/download/release-2.11/OpenLayers-2.11.tar.gz" | |
156 tar xvfz OpenLayers-2.11.tar.gz | |
157 # TODO: Remove more superfluous OpenLayers stuff. | |
158 rm -rf OpenLayers-2.11/doc | |
159 rm -rf OpenLayers-2.11/tests | |
160 rm -rf OpenLayers-2.11/examples | |
161 cd $WORK_DIR | |
162 fi | |
163 cp -r $FLYS_SOURCE_DIR/OpenLayers-2.11 \ | |
164 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/ | |
165 | |
166 | |
167 echo "INFO: Downloading smartGWT" | |
168 mvn com.isomorphic:isc-maven-plugin:install -Dproduct=SMARTGWT -Dlicense=LGPL \ | |
169 -DbuildNumber=4.1p -DbuildDate=2014-12-13 -Dworkdir=$WORK_DIR | |
170 | |
171 echo "INFO: compile sources" | |
172 mvn -f $FLYS_SOURCE_DIR/framework/pom.xml clean compile install | |
173 mvn -f $FLYS_SOURCE_DIR/river/backend/pom.xml clean compile install | |
174 mvn -f $FLYS_SOURCE_DIR/river/artifacts/pom.xml clean compile | |
175 mvn -f $FLYS_SOURCE_DIR/http-client/pom.xml clean compile install | |
176 # gwt-client has to be compiled later to allow custom CLIENT_CONF | |
177 | |
178 echo "INFO: create h2 database for artifacts and datacage" | |
179 cd $FLYS_SOURCE_DIR/river/artifacts | |
180 rm -rf artifactsdb datacagedb | |
181 $FLYS_SOURCE_DIR/framework/artifact-database/bin/createArtifacts.sh | |
182 $FLYS_SOURCE_DIR/river/artifacts/bin/createDatacage.sh | |
183 cd - | |
184 | |
185 echo "INFO: download WSPLGEN" | |
153 cd $WORK_DIR | 186 cd $WORK_DIR |
154 mkdir -p "$WORK_DIR/server/bin/lib/own" | 187 wget \ |
155 mkdir "$WORK_DIR/server/shapefiles" | 188 https://wald.intevation.org/frs/download.php/1496/wsplgen-linux-64bit-static.gz \ |
156 mkdir "$WORK_DIR/client" | 189 https://wald.intevation.org/frs/download.php/1498/wsplgen-linux-32bit-static.gz |
190 gunzip wsplgen-linux-64bit-static.gz wsplgen-linux-32bit-static.gz | |
191 chmod +x wsplgen-linux-* | |
192 cp wsplgen-linux-32bit-static $FLYS_SOURCE_DIR/river/artifacts/bin/wsplgen | |
193 cd - | |
194 | |
195 if [ "$DO_TAG" = "TRUE" ]; then | |
196 echo "INFO: Building packages for publication" | |
197 cd $FLYS_SOURCE_DIR/river/artifacts | |
198 mvn package assembly:single | |
199 mv target/river-artifacts-1.0-SNAPSHOT-bin.tar.bz2 \ | |
200 $WORK_DIR/d4e-river-$VERSION.tar.bz2 && cd .. | |
201 cd gwt-client && mvn clean compile package | |
202 mv target/gwt-client-1.0-SNAPSHOT.war \ | |
203 $WORK_DIR/d4e-river-$VERSION.war && cd .. | |
204 fi | |
157 | 205 |
158 | 206 |
159 echo "INFO: Preparing configuration of web client" | 207 echo "INFO: Preparing configuration of web client" |
160 | 208 |
161 #Needs to be done before the tomcat replacement below | 209 #Needs to be done before the tomcat replacement below |
175 echo "INFO: copy custom java script client configuration to target destination" | 223 echo "INFO: copy custom java script client configuration to target destination" |
176 cp $CLIENT_CONF \ | 224 cp $CLIENT_CONF \ |
177 $FLYS_SOURCE_DIR/river/gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml | 225 $FLYS_SOURCE_DIR/river/gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml |
178 fi | 226 fi |
179 | 227 |
180 if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then | 228 if [ -n $DGM_PATH ]; then |
181 echo "INFO: download OpenLayers-2.11 for client" | 229 sed -i -e "s@<dgm-path>.*</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \ |
182 cd $FLYS_SOURCE_DIR | 230 $FLYS_SOURCE_DIR/river/artifacts/doc/conf/conf.xml |
183 wget "https://github.com/openlayers/openlayers/releases/download/release-2.11/OpenLayers-2.11.tar.gz" | 231 fi |
184 tar xvfz OpenLayers-2.11.tar.gz | 232 |
185 # TODO: Remove more superfluous OpenLayers stuff. | 233 if [ -n $WIKI_URL ]; then |
186 rm -rf OpenLayers-2.11/doc | 234 sed -i -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \ |
187 rm -rf OpenLayers-2.11/tests | 235 $FLYS_SOURCE_DIR/river/artifacts/doc/conf/conf.xml |
188 rm -rf OpenLayers-2.11/examples | 236 fi |
189 cd $WORK_DIR | 237 |
190 fi | 238 if [ -d $SERVER_CONF ]; then |
191 cp -r $FLYS_SOURCE_DIR/OpenLayers-2.11 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/ | 239 echo "INFO: copy custom server configuration to target destination" |
192 | 240 cp -R $SERVER_CONF/* $FLYS_SOURCE_DIR/river/artifacts/doc/conf/ |
193 echo "INFO: Downloading smartGWT" | 241 for file in `find $FLYS_SOURCE_DIR/river/artifacts/doc/conf -type f`; do |
194 mvn com.isomorphic:isc-maven-plugin:install -Dproduct=SMARTGWT -Dlicense=LGPL \ | 242 sed -i -e "s@D4E_VERSION@${VERSION}@g" $file |
195 -DbuildNumber=4.1p -DbuildDate=2014-12-13 -Dworkdir=$WORK_DIR | 243 done |
244 fi | |
245 | |
196 | 246 |
197 echo "INFO: compile and build sources" | 247 echo "INFO: compile and build sources" |
198 mvn -f $FLYS_SOURCE_DIR/framework/pom.xml clean compile package install | 248 cp $WORK_DIR/wsplgen-linux-64bit-static \ |
199 mvn -f $FLYS_SOURCE_DIR/river/backend/pom.xml clean compile package install | 249 $FLYS_SOURCE_DIR/river/artifacts/bin/wsplgen |
200 mvn -f $FLYS_SOURCE_DIR/river/artifacts/pom.xml clean compile package dependency:copy-dependencies install | |
201 mvn -f $FLYS_SOURCE_DIR/http-client/pom.xml clean compile package install | |
202 mvn -f $FLYS_SOURCE_DIR/river/gwt-client/pom.xml clean compile package | |
203 | |
204 # remove unused Version of JFreeChart (it's a dependency of JasperReports | |
205 # that prevents diagram generation in D4E river) | |
206 rm $FLYS_SOURCE_DIR/river/artifacts/target/dependency/jfreechart-1.0.12.jar | |
207 | |
208 echo "INFO: copy dependencies and libs" | |
209 cp $FLYS_SOURCE_DIR/framework/artifact-database/target/artifact-database-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ | |
210 cp $FLYS_SOURCE_DIR/framework/artifacts/target/artifacts-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ | |
211 cp $FLYS_SOURCE_DIR/framework/artifacts-common/target/artifacts-common-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ | |
212 cp $FLYS_SOURCE_DIR/river/backend/target/river-backend-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ | |
213 cp $FLYS_SOURCE_DIR/river/artifacts/target/river-artifacts-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ | |
214 cp $FLYS_SOURCE_DIR/river/gwt-client/target/gwt-client-1.0-SNAPSHOT.war $WORK_DIR/client/flys-${VERSION}.war | |
215 cp $FLYS_SOURCE_DIR/river/artifacts/target/dependency/* $WORK_DIR/server/bin/lib/ | |
216 | |
217 echo "INFO: copy scripts and libraries to target destination" | |
218 cp ${FLYS_SOURCE_DIR}/river/artifacts/bin/run.sh $WORK_DIR/server/bin/ | |
219 cp ${SCRIPT_DIR}/libs/* $WORK_DIR/server/bin/lib/ | |
220 | |
221 echo "INFO: download WSPLGEN" | |
222 wget https://wald.intevation.org/frs/download.php/1496/wsplgen-linux-64bit-static.gz | |
223 gunzip wsplgen-linux-64bit-static.gz | |
224 echo "16d60047aa114d69e9435dbbe56b6981b4e1c445 wsplgen-linux-64bit-static" | \ | |
225 sha1sum -c | |
226 mv wsplgen-linux-64bit-static $WORK_DIR/server/bin/wsplgen | |
227 chmod +x $WORK_DIR/server/bin/wsplgen | |
228 | 250 |
229 if [ "$BUILD_ORACLE" = "TRUE" ]; then | 251 if [ "$BUILD_ORACLE" = "TRUE" ]; then |
230 echo "INFO: remove PostgreSQL and PostGIS libraries" | |
231 rm $WORK_DIR/server/bin/lib/postg* | |
232 rm $WORK_DIR/server/bin/lib/hibernate-spatial-postgis* | |
233 if [ ! -f $ORACLE_JDBC ]; then | 252 if [ ! -f $ORACLE_JDBC ]; then |
234 echo "Could not find oracle jdbc in $ORACLE_JDBC" | 253 echo "Could not find oracle jdbc in $ORACLE_JDBC" |
235 echo "Please make sure that the ORACLE_JDBC variable is set correctly" | 254 echo "Please make sure that the ORACLE_JDBC variable is set correctly" |
236 exit 1 | 255 exit 1 |
237 fi | 256 fi |
238 if [ ! -f $ORACLE_HIBERNATE ]; then | 257 mvn install:install-file -DgroupId=ojdbc -DartifactId=ojdbc \ |
239 echo "Could not find hibernate-spatial-oracle in $ORACLE_HIBERNATE" | 258 -Dversion=0 -Dpackaging=jar -Dfile=$ORACLE_JDBC -DgeneratePom=true |
240 echo "Please make sure that the ORACLE_HIBERNATE variable is set correctly" | 259 mvn -f $FLYS_SOURCE_DIR/river/backend/pom-oracle.xml clean compile install |
241 exit 1 | 260 mvn -f $FLYS_SOURCE_DIR/river/artifacts/pom-oracle.xml \ |
242 fi | 261 package assembly:single |
243 cp $ORACLE_HIBERNATE $ORACLE_JDBC $WORK_DIR/server/bin/lib/ | |
244 else | 262 else |
245 echo "INFO: remove Oracle libraries" | 263 mvn -f $FLYS_SOURCE_DIR/river/artifacts/pom.xml package assembly:single |
246 rm -f $WORK_DIR/server/bin/lib/hibernate-spatial-oracle-1.1.jar | 264 fi |
247 rm -f $WORK_DIR/server/bin/lib/ojdbc* | 265 mvn -f $FLYS_SOURCE_DIR/river/gwt-client/pom.xml clean compile package |
248 fi | 266 |
249 | 267 |
250 | 268 echo "INFO: create tarball" |
251 echo "INFO: copy default server configuration to target destination" | |
252 cp -R $FLYS_SOURCE_DIR/river/artifacts/doc/conf $WORK_DIR/server/ | |
253 | |
254 if [ -n $DGM_PATH ]; then | |
255 sed -i -e "s@<dgm-path>/path/to/rivers/</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \ | |
256 $WORK_DIR/server/conf/conf.xml | |
257 fi | |
258 | |
259 if [ -n $WIKI_URL ]; then | |
260 sed -i -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \ | |
261 $WORK_DIR/server/conf/conf.xml | |
262 fi | |
263 | |
264 if [ -d $SERVER_CONF ]; then | |
265 echo "INFO: copy custom server configuration to target destination" | |
266 cp -R $SERVER_CONF/* $WORK_DIR/server/conf/ | |
267 for file in `find $WORK_DIR/server/conf -type f`; do | |
268 sed -i -e "s@D4E_VERSION@${VERSION}@g" $file | |
269 done | |
270 fi | |
271 | |
272 | |
273 echo "INFO: create h2 database for artifacts and datacage" | |
274 mkdir $WORK_DIR/artifactsdb | |
275 mkdir $WORK_DIR/datacagedb | |
276 | |
277 cp $FLYS_SOURCE_DIR/framework/artifact-database/doc/schema-h2.sql $WORK_DIR/artifactsdb/artifacts-h2.sql | |
278 cp $FLYS_SOURCE_DIR/river/artifacts/doc/conf/datacage.sql $WORK_DIR/datacagedb/datacage.sql | |
279 | |
280 cd $WORK_DIR | 269 cd $WORK_DIR |
281 $SCRIPT_DIR/h2/createArtifacts.sh $WORK_DIR/artifactsdb/artifacts-h2.sql | 270 mv $FLYS_SOURCE_DIR/river/artifacts/target/river-artifacts-1.0-SNAPSHOT-bin.tar \ |
282 $SCRIPT_DIR/h2/createDatacage.sh $WORK_DIR/datacagedb/datacage.sql | 271 flys-$VERSION.tar |
283 cd - | 272 mv $FLYS_SOURCE_DIR/river/gwt-client/target/gwt-client-1.0-SNAPSHOT.war \ |
284 | 273 flys-${VERSION}.war |
285 mv $WORK_DIR/artifactsdb $WORK_DIR/server/ | 274 tar -rf flys-$VERSION.tar flys-${VERSION}.war |
286 mv $WORK_DIR/datacagedb $WORK_DIR/server/ | |
287 | 275 |
288 if [ -f $INSTALL ]; then | 276 if [ -f $INSTALL ]; then |
289 echo "INFO: prepare custom installation script" | 277 echo "INFO: prepare custom installation script" |
290 cp $INSTALL $WORK_DIR | 278 cp $INSTALL . |
291 sed -i "s/D4E_VERSION/$VERSION/g" $WORK_DIR/`basename $INSTALL` | 279 sed -i "s/D4E_VERSION/$VERSION/g" ./`basename $INSTALL` |
292 fi | 280 tar -rf flys-$VERSION.tar `basename $INSTALL` |
293 | 281 fi |
294 echo "INFO: create tarball" | 282 |
295 if [ -d "$WORK_DIR/flys-$VERSION" ]; then | 283 ## TODO: tag with maven and include basedir with correct name in assembly ## |
296 echo "INFO: removing old directory" | 284 rm -rf flys-$VERSION && mkdir flys-$VERSION |
297 rm -rf "$WORK_DIR/flys-$VERSION" | 285 tar -xf flys-$VERSION.tar -C flys-$VERSION |
298 fi | |
299 | |
300 mkdir $WORK_DIR/flys-$VERSION | |
301 mv $WORK_DIR/server $WORK_DIR/client $WORK_DIR/flys-$VERSION | |
302 if [ -n $INSTALL ]; then | |
303 mv $WORK_DIR/`basename $INSTALL` $WORK_DIR/flys-$VERSION | |
304 fi | |
305 cd $WORK_DIR | |
306 tar cfz flys-$VERSION.tar.gz flys-$VERSION | 286 tar cfz flys-$VERSION.tar.gz flys-$VERSION |
307 #echo "INFO: cleanup" | 287 ## |
308 #rm -r $WORK_DIR/flys-$VERSION | 288 |
309 | 289 if [ "$DO_TAG" = "TRUE" ]; then |
290 echo "Binary-packages for publication:" | |
291 echo "_ $WORK_DIR/d4e-river-$VERSION.tar.bz2" | |
292 echo "_ $WORK_DIR/d4e-river-$VERSION.war" | |
293 fi | |
310 echo "DONE: $WORK_DIR/flys-$VERSION.tar.gz" | 294 echo "DONE: $WORK_DIR/flys-$VERSION.tar.gz" |
311 echo "Changelog: $WORK_DIR/changes_$OLD_REV-$VERSION.txt" | 295 echo "Changelog: $WORK_DIR/changes_$OLD_REV-$VERSION.txt" |