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
|
|
|
|
2020-07-16 18:14:46 +02:00
|
|
|
VERSION=$(get_pom_version)
|
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
|
|
|
|
|
2018-05-22 20:29:13 +02:00
|
|
|
(
|
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
|
|
|
|
|
2018-05-22 20:29:13 +02:00
|
|
|
# disable fast fail, exit immediately, in this subshell
|
|
|
|
set +e
|
|
|
|
|
|
|
|
# Run the build
|
2018-09-02 12:15:45 +02:00
|
|
|
./mvnw clean package sonar:sonar -Dsonar.login=${SONAR_TOKEN} -Psonar -B -V
|
2018-05-22 20:29:13 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
)
|