pmd/.travis/build-sonar.sh

34 lines
896 B
Bash
Raw Normal View History

#!/bin/bash
set -e
2018-05-24 19:20:12 +02:00
source .travis/logger.sh
source .travis/common-functions.sh
VERSION=$(get_pom_version)
log_info "Building PMD Sonar ${VERSION} on branch ${TRAVIS_BRANCH}"
if ! travis_isPush; then
echo "Not updating sonar, since this is not a push!"
exit 0
fi
(
2018-09-02 12:31:11 +02:00
# for sonar, we need to use java10, until sonarjava 5.8.0 is released (Sept. 2018)
JAVA_HOME=$(bash ./install-jdk.sh -F 10 -L GPL -W $HOME/jdk --emit-java-home | tail --lines 1)
export JAVA_HOME
export PATH=${JAVA_HOME}/bin:$PATH
# disable fast fail, exit immediately, in this subshell
set +e
# Run the build
./mvnw clean package sonar:sonar -Dsonar.login=${SONAR_TOKEN} -Psonar -B -V
if [ $? -ne 0 ]; then
log_error "Error updating sonar..."
else
log_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
fi
true
)