2017-02-25 11:31:09 +01:00
|
|
|
#!/bin/bash
|
2017-05-20 10:16:29 +02:00
|
|
|
set -e
|
2017-02-25 11:31:09 +01:00
|
|
|
|
2017-05-20 09:55:09 +02:00
|
|
|
source .travis/common-functions.sh
|
2017-05-15 21:11:43 +02:00
|
|
|
|
|
|
|
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
|
|
|
|
echo "Building PMD Site ${VERSION} on branch ${TRAVIS_BRANCH}"
|
|
|
|
|
2017-05-20 10:43:14 +02:00
|
|
|
if ! travis_isPush; then
|
2017-05-15 21:11:43 +02:00
|
|
|
echo "Not building site, since this is not a push!"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-25 11:31:09 +01:00
|
|
|
export PING_SLEEP=30s
|
|
|
|
export BUILD_OUTPUT=/tmp/build-site.out
|
|
|
|
export PING_PID_FILE=/tmp/build-site-ping.pid
|
|
|
|
|
2017-02-27 20:35:17 +01:00
|
|
|
source .travis/background-job-funcs.sh
|
2017-02-25 11:31:09 +01:00
|
|
|
|
|
|
|
# Run the build, redirect output into the file
|
2017-05-20 22:48:02 +02:00
|
|
|
./mvnw install -DskipTests=true -B -V >> $BUILD_OUTPUT 2>&1
|
|
|
|
./mvnw site site:stage -Psite -B -V >> $BUILD_OUTPUT 2>&1
|
2017-02-25 11:31:09 +01:00
|
|
|
|
|
|
|
# The build finished without returning an error so dump a tail of the output
|
|
|
|
dump_output
|
|
|
|
|
|
|
|
# nicely terminate the ping output loop
|
|
|
|
kill_ping
|
|
|
|
|
2017-05-15 21:11:43 +02:00
|
|
|
|
|
|
|
# create pmd-doc archive
|
|
|
|
(
|
|
|
|
cd target
|
|
|
|
mv staging pmd-doc-${VERSION}
|
|
|
|
zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/
|
|
|
|
)
|
|
|
|
|
|
|
|
# Uploading pmd doc distribution to sourceforge
|
|
|
|
if [[ "$TRAVIS_TAG" != "" || "$VERSION" == *-SNAPSHOT ]]; then
|
|
|
|
rsync -avh target/pmd-doc-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$VERSION" == *-SNAPSHOT && "$TRAVIS_BRANCH" == "master" ]]; then
|
|
|
|
# Uploading snapshot site...
|
|
|
|
rsync -ah --stats --delete target/pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/
|
|
|
|
fi
|
|
|
|
|