changeset 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 (2014-12-19)
parents 48cce699e387
children 25705fe99121
files contrib/make_flys_release/README contrib/make_flys_release/make_release.sh
diffstat 2 files changed, 104 insertions(+), 117 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/make_flys_release/README	Fri Dec 19 19:32:05 2014 +0100
+++ b/contrib/make_flys_release/README	Fri Dec 19 20:50:29 2014 +0100
@@ -27,6 +27,9 @@
              Default-Konfigurations-Dateien zu überschreiben. Die Zeichenkette
              'D4E_VERSION' wird in den so gegebenen Konfigurationsdateien durch
              die beim Aufruf des Skriptes angegebene Version ersetzt.
+CLIENT_CONF  Pfad zu einer Datei, mit der
+             gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml
+             ersetzt wird.
 
 Prozess:
 ========
--- a/contrib/make_flys_release/make_release.sh	Fri Dec 19 19:32:05 2014 +0100
+++ b/contrib/make_flys_release/make_release.sh	Fri Dec 19 20:50:29 2014 +0100
@@ -38,9 +38,8 @@
                        Default: $DEFAULT_WD
    -t                  Tag the current default branch as "VERSION"
    -o, --oracle        Release is for oracle.
-                       Suitable jar-files for JDBC driver and
-                       hibernate-spatial have to be given with the
-                       environment variables ORACLE_JDBC and ORACLE_HIBERNATE
+                       Suitable jar-file for JDBC driver has to be given with
+                       the environment variable ORACLE_JDBC
    VERSION must be in the format MAYOR.MINOR.PATCH or default
 EOF
 exit 0
@@ -110,12 +109,12 @@
     echo "Updating sources / Reverting changes"
     cd $FLYS_SOURCE_DIR
     for repo in $REPOS; do
-        cd $repo && hg pull && hg revert -a && hg up && cd $FLYS_SOURCE_DIR
+        cd $repo && hg purge && hg revert -a && hg pull -u && cd -
     done;
 fi
 
 if [ "$DO_TAG" = "TRUE" ]; then
-    echo "Tagging version $VERSION"
+    echo "INFO: Tagging version $VERSION"
     for repo in $REPOS; do
         cd $repo
         CHANGESET=$(hg log -l1 |head -1 | awk -F: '{print $3}')
@@ -149,11 +148,60 @@
     cd $FLYS_SOURCE_DIR
 done
 
-rm -rf "$WORK_DIR/server" "$WORK_DIR/client"
+
+if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then
+    echo "INFO: download OpenLayers-2.11 for client"
+    cd $FLYS_SOURCE_DIR
+    wget "https://github.com/openlayers/openlayers/releases/download/release-2.11/OpenLayers-2.11.tar.gz"
+    tar xvfz OpenLayers-2.11.tar.gz
+    # TODO: Remove more superfluous OpenLayers stuff.
+    rm -rf OpenLayers-2.11/doc
+    rm -rf OpenLayers-2.11/tests
+    rm -rf OpenLayers-2.11/examples
+    cd $WORK_DIR
+fi
+cp -r $FLYS_SOURCE_DIR/OpenLayers-2.11 \
+    $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/
+
+
+echo "INFO: Downloading smartGWT"
+mvn com.isomorphic:isc-maven-plugin:install -Dproduct=SMARTGWT -Dlicense=LGPL \
+    -DbuildNumber=4.1p -DbuildDate=2014-12-13 -Dworkdir=$WORK_DIR
+
+echo "INFO: compile sources"
+mvn -f $FLYS_SOURCE_DIR/framework/pom.xml clean compile install
+mvn -f $FLYS_SOURCE_DIR/river/backend/pom.xml clean compile install
+mvn -f $FLYS_SOURCE_DIR/river/artifacts/pom.xml clean compile
+mvn -f $FLYS_SOURCE_DIR/http-client/pom.xml clean compile install
+# gwt-client has to be compiled later to allow custom CLIENT_CONF
+
+echo "INFO: create h2 database for artifacts and datacage"
+cd $FLYS_SOURCE_DIR/river/artifacts
+rm -rf artifactsdb datacagedb
+$FLYS_SOURCE_DIR/framework/artifact-database/bin/createArtifacts.sh
+$FLYS_SOURCE_DIR/river/artifacts/bin/createDatacage.sh
+cd -
+
+echo "INFO: download WSPLGEN"
 cd $WORK_DIR
-mkdir -p "$WORK_DIR/server/bin/lib/own"
-mkdir "$WORK_DIR/server/shapefiles"
-mkdir "$WORK_DIR/client"
+wget \
+    https://wald.intevation.org/frs/download.php/1496/wsplgen-linux-64bit-static.gz \
+    https://wald.intevation.org/frs/download.php/1498/wsplgen-linux-32bit-static.gz
+gunzip wsplgen-linux-64bit-static.gz wsplgen-linux-32bit-static.gz
+chmod +x wsplgen-linux-*
+cp wsplgen-linux-32bit-static $FLYS_SOURCE_DIR/river/artifacts/bin/wsplgen
+cd -
+
+if [ "$DO_TAG" = "TRUE" ]; then
+    echo "INFO: Building packages for publication"
+    cd $FLYS_SOURCE_DIR/river/artifacts
+    mvn package assembly:single
+    mv target/river-artifacts-1.0-SNAPSHOT-bin.tar.bz2 \
+        $WORK_DIR/d4e-river-$VERSION.tar.bz2 && cd ..
+    cd gwt-client && mvn clean compile package
+    mv target/gwt-client-1.0-SNAPSHOT.war \
+        $WORK_DIR/d4e-river-$VERSION.war && cd ..
+fi
 
 
 echo "INFO: Preparing configuration of web client"
@@ -177,135 +225,71 @@
         $FLYS_SOURCE_DIR/river/gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml
 fi
 
-if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then
-    echo "INFO: download OpenLayers-2.11 for client"
-    cd $FLYS_SOURCE_DIR
-    wget "https://github.com/openlayers/openlayers/releases/download/release-2.11/OpenLayers-2.11.tar.gz"
-    tar xvfz OpenLayers-2.11.tar.gz
-    # TODO: Remove more superfluous OpenLayers stuff.
-    rm -rf OpenLayers-2.11/doc
-    rm -rf OpenLayers-2.11/tests
-    rm -rf OpenLayers-2.11/examples
-    cd $WORK_DIR
+if [ -n $DGM_PATH ]; then
+    sed -i -e "s@<dgm-path>.*</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \
+        $FLYS_SOURCE_DIR/river/artifacts/doc/conf/conf.xml
 fi
-cp -r $FLYS_SOURCE_DIR/OpenLayers-2.11 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/
 
-echo "INFO: Downloading smartGWT"
-mvn com.isomorphic:isc-maven-plugin:install -Dproduct=SMARTGWT -Dlicense=LGPL \
-    -DbuildNumber=4.1p -DbuildDate=2014-12-13 -Dworkdir=$WORK_DIR
+if [ -n $WIKI_URL ]; then
+    sed -i -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \
+        $FLYS_SOURCE_DIR/river/artifacts/doc/conf/conf.xml
+fi
+
+if [ -d $SERVER_CONF ]; then
+    echo "INFO: copy custom server configuration to target destination"
+    cp -R $SERVER_CONF/* $FLYS_SOURCE_DIR/river/artifacts/doc/conf/
+    for file in `find $FLYS_SOURCE_DIR/river/artifacts/doc/conf -type f`; do
+        sed -i -e "s@D4E_VERSION@${VERSION}@g" $file
+    done
+fi
+
 
 echo "INFO: compile and build sources"
-mvn -f $FLYS_SOURCE_DIR/framework/pom.xml clean compile package install
-mvn -f $FLYS_SOURCE_DIR/river/backend/pom.xml clean compile package install
-mvn -f $FLYS_SOURCE_DIR/river/artifacts/pom.xml clean compile package dependency:copy-dependencies install
-mvn -f $FLYS_SOURCE_DIR/http-client/pom.xml clean compile package install
-mvn -f $FLYS_SOURCE_DIR/river/gwt-client/pom.xml clean compile package
-
-# remove unused Version of JFreeChart (it's a dependency of JasperReports
-# that prevents diagram generation in D4E river)
-rm $FLYS_SOURCE_DIR/river/artifacts/target/dependency/jfreechart-1.0.12.jar
-
-echo "INFO: copy dependencies and libs"
-cp $FLYS_SOURCE_DIR/framework/artifact-database/target/artifact-database-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/
-cp $FLYS_SOURCE_DIR/framework/artifacts/target/artifacts-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/
-cp $FLYS_SOURCE_DIR/framework/artifacts-common/target/artifacts-common-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/
-cp $FLYS_SOURCE_DIR/river/backend/target/river-backend-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/
-cp $FLYS_SOURCE_DIR/river/artifacts/target/river-artifacts-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/
-cp $FLYS_SOURCE_DIR/river/gwt-client/target/gwt-client-1.0-SNAPSHOT.war $WORK_DIR/client/flys-${VERSION}.war
-cp $FLYS_SOURCE_DIR/river/artifacts/target/dependency/* $WORK_DIR/server/bin/lib/
-
-echo "INFO: copy scripts and libraries to target destination"
-cp ${FLYS_SOURCE_DIR}/river/artifacts/bin/run.sh $WORK_DIR/server/bin/
-cp ${SCRIPT_DIR}/libs/* $WORK_DIR/server/bin/lib/
-
-echo "INFO: download WSPLGEN"
-wget https://wald.intevation.org/frs/download.php/1496/wsplgen-linux-64bit-static.gz
-gunzip wsplgen-linux-64bit-static.gz
-echo "16d60047aa114d69e9435dbbe56b6981b4e1c445  wsplgen-linux-64bit-static" | \
-    sha1sum -c
-mv wsplgen-linux-64bit-static $WORK_DIR/server/bin/wsplgen
-chmod +x $WORK_DIR/server/bin/wsplgen
+cp $WORK_DIR/wsplgen-linux-64bit-static \
+    $FLYS_SOURCE_DIR/river/artifacts/bin/wsplgen
 
 if [ "$BUILD_ORACLE" = "TRUE" ]; then
-    echo "INFO: remove PostgreSQL and PostGIS libraries"
-    rm $WORK_DIR/server/bin/lib/postg*
-    rm $WORK_DIR/server/bin/lib/hibernate-spatial-postgis*
     if [ ! -f $ORACLE_JDBC ]; then
         echo "Could not find oracle jdbc in $ORACLE_JDBC"
         echo "Please make sure that the ORACLE_JDBC variable is set correctly"
         exit 1
     fi
-    if [ ! -f $ORACLE_HIBERNATE ]; then
-        echo "Could not find hibernate-spatial-oracle in $ORACLE_HIBERNATE"
-        echo "Please make sure that the ORACLE_HIBERNATE variable is set correctly"
-        exit 1
-    fi
-    cp $ORACLE_HIBERNATE $ORACLE_JDBC $WORK_DIR/server/bin/lib/
+    mvn install:install-file -DgroupId=ojdbc -DartifactId=ojdbc \
+       -Dversion=0 -Dpackaging=jar -Dfile=$ORACLE_JDBC -DgeneratePom=true
+    mvn -f $FLYS_SOURCE_DIR/river/backend/pom-oracle.xml clean compile install
+    mvn -f $FLYS_SOURCE_DIR/river/artifacts/pom-oracle.xml \
+        package assembly:single
 else
-    echo "INFO: remove Oracle libraries"
-    rm -f $WORK_DIR/server/bin/lib/hibernate-spatial-oracle-1.1.jar
-    rm -f $WORK_DIR/server/bin/lib/ojdbc*
+    mvn -f $FLYS_SOURCE_DIR/river/artifacts/pom.xml package assembly:single
 fi
+mvn -f $FLYS_SOURCE_DIR/river/gwt-client/pom.xml clean compile package
 
 
-echo "INFO: copy default server configuration to target destination"
-cp -R $FLYS_SOURCE_DIR/river/artifacts/doc/conf $WORK_DIR/server/
-
-if [ -n $DGM_PATH ]; then
-    sed -i -e "s@<dgm-path>/path/to/rivers/</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \
-        $WORK_DIR/server/conf/conf.xml
-fi
-
-if [ -n $WIKI_URL ]; then
-    sed -i -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \
-        $WORK_DIR/server/conf/conf.xml
-fi
-
-if [ -d $SERVER_CONF ]; then
-    echo "INFO: copy custom server configuration to target destination"
-    cp -R $SERVER_CONF/* $WORK_DIR/server/conf/
-    for file in `find $WORK_DIR/server/conf -type f`; do
-        sed -i -e "s@D4E_VERSION@${VERSION}@g" $file
-    done
-fi
-
-
-echo "INFO: create h2 database for artifacts and datacage"
-mkdir $WORK_DIR/artifactsdb
-mkdir $WORK_DIR/datacagedb
-
-cp $FLYS_SOURCE_DIR/framework/artifact-database/doc/schema-h2.sql $WORK_DIR/artifactsdb/artifacts-h2.sql
-cp $FLYS_SOURCE_DIR/river/artifacts/doc/conf/datacage.sql $WORK_DIR/datacagedb/datacage.sql
-
+echo "INFO: create tarball"
 cd $WORK_DIR
-$SCRIPT_DIR/h2/createArtifacts.sh $WORK_DIR/artifactsdb/artifacts-h2.sql
-$SCRIPT_DIR/h2/createDatacage.sh $WORK_DIR/datacagedb/datacage.sql
-cd -
-
-mv $WORK_DIR/artifactsdb $WORK_DIR/server/
-mv $WORK_DIR/datacagedb $WORK_DIR/server/
+mv $FLYS_SOURCE_DIR/river/artifacts/target/river-artifacts-1.0-SNAPSHOT-bin.tar \
+    flys-$VERSION.tar
+mv $FLYS_SOURCE_DIR/river/gwt-client/target/gwt-client-1.0-SNAPSHOT.war \
+    flys-${VERSION}.war
+tar -rf flys-$VERSION.tar flys-${VERSION}.war
 
 if [ -f $INSTALL ]; then
     echo "INFO: prepare custom installation script"
-    cp $INSTALL $WORK_DIR
-    sed -i "s/D4E_VERSION/$VERSION/g" $WORK_DIR/`basename $INSTALL`
-fi
-
-echo "INFO: create tarball"
-if [ -d "$WORK_DIR/flys-$VERSION" ]; then
-    echo "INFO: removing old directory"
-    rm -rf "$WORK_DIR/flys-$VERSION"
+    cp $INSTALL .
+    sed -i "s/D4E_VERSION/$VERSION/g" ./`basename $INSTALL`
+    tar -rf flys-$VERSION.tar `basename $INSTALL`
 fi
 
-mkdir $WORK_DIR/flys-$VERSION
-mv $WORK_DIR/server $WORK_DIR/client $WORK_DIR/flys-$VERSION
-if [ -n $INSTALL ]; then
-    mv $WORK_DIR/`basename $INSTALL` $WORK_DIR/flys-$VERSION
+## TODO: tag with maven and include basedir with correct name in assembly ##
+rm -rf flys-$VERSION && mkdir flys-$VERSION
+tar -xf flys-$VERSION.tar -C flys-$VERSION
+tar cfz flys-$VERSION.tar.gz flys-$VERSION
+##
+
+if [ "$DO_TAG" = "TRUE" ]; then
+    echo "Binary-packages for publication:"
+    echo "_ $WORK_DIR/d4e-river-$VERSION.tar.bz2"
+    echo "_ $WORK_DIR/d4e-river-$VERSION.war"
 fi
-cd $WORK_DIR
-tar cfz flys-$VERSION.tar.gz flys-$VERSION
-#echo "INFO: cleanup"
-#rm -r $WORK_DIR/flys-$VERSION
-
 echo "DONE: $WORK_DIR/flys-$VERSION.tar.gz"
 echo "Changelog: $WORK_DIR/changes_$OLD_REV-$VERSION.txt"

http://dive4elements.wald.intevation.org