2017-02-27 20:35:17 +01:00
|
|
|
#!/bin/bash
|
2017-05-20 10:16:29 +02:00
|
|
|
set -e
|
2017-02-27 20:35:17 +01:00
|
|
|
|
2018-05-24 19:20:12 +02:00
|
|
|
source .travis/logger.sh
|
2018-06-20 20:57:27 +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)
|
2018-05-24 19:18:57 +02:00
|
|
|
log_info "Building PMD Sonar ${VERSION} on branch ${TRAVIS_BRANCH}"
|
2017-05-15 21:11:43 +02:00
|
|
|
|
2017-05-20 10:43:14 +02:00
|
|
|
if ! travis_isPush; then
|
2017-05-15 21:11:43 +02:00
|
|
|
echo "Not updating sonar, since this is not a push!"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2017-10-01 14:08:07 +02:00
|
|
|
#
|
|
|
|
# for java9: enable all modules.
|
|
|
|
# sonar plugin seems to need java.xml.bind module
|
2018-02-18 21:47:50 +01:00
|
|
|
echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > ${HOME}/.mavenrc
|
2017-05-15 21:11:43 +02:00
|
|
|
|
2018-05-22 20:29:13 +02:00
|
|
|
(
|
|
|
|
# disable fast fail, exit immediately, in this subshell
|
|
|
|
set +e
|
|
|
|
|
|
|
|
# Run the build
|
|
|
|
./mvnw clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONAR_TOKEN} -B -V
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
2018-05-24 19:18:57 +02:00
|
|
|
log_error "Error updating sonar..."
|
2018-05-22 20:29:13 +02:00
|
|
|
else
|
2018-05-24 19:18:57 +02:00
|
|
|
log_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
|
2018-05-22 20:29:13 +02:00
|
|
|
fi
|
|
|
|
true
|
|
|
|
)
|