This repository has been archived by the owner on Jan 24, 2021. It is now read-only.
forked from SonarSource/sonarlint-eclipse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·61 lines (48 loc) · 2.26 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -euo pipefail
CURRENT_VERSION=`mvn help:evaluate -Dtycho.mode=maven -Dexpression="project.version" | grep -v '^\[\|Download\w\+\:'`
RELEASE_VERSION=`echo $CURRENT_VERSION | sed "s/-.*//g"`
NEW_VERSION="$RELEASE_VERSION.$BUILD_ID"
echo "NEW_VERSION=$NEW_VERSION" >> build.properties
echo "Replacing version $CURRENT_VERSION with $NEW_VERSION"
mvn org.eclipse.tycho:tycho-versions-plugin:0.26.0:set-version -Dtycho.mode=maven -DnewVersion=$NEW_VERSION -B -e
export PROJECT_VERSION=$NEW_VERSION
if [ "${GITHUB_BRANCH}" == "master" ] && [ "$IS_PULLREQUEST" == "false" ]; then
echo '======= Build, deploy and analyze master'
# Fetch all commit history so that SonarQube has exact blame information
# for issue auto-assignment
# This command can fail with "fatal: --unshallow on a complete repository does not make sense"
# if there are not enough commits in the Git repository (even if Travis executed git clone --depth 50).
# For this reason errors are ignored with "|| true"
git fetch --unshallow || true
mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy sonar:sonar \
-Pdeploy-sonarsource,coverage,sign \
-Dsonarsource.keystore.path=$SONARSOURCE_KEYSTORE_PATH \
-Dsonarsource.keystore.password=$SONARSOURCE_KEYSTORE_PASS \
-Dtycho.disableP2Mirrors=true \
-Dmaven.test.redirectTestOutputToFile=false \
-Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.projectVersion=$CURRENT_VERSION \
-B -e -V $*
elif [ "$IS_PULLREQUEST" != "false" ] && [ -n "${GITHUB_TOKEN-}" ]; then
echo '======= Build and analyze pull request'
echo '======= with deploy'
mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy sonar:sonar \
-Pdeploy-sonarsource \
-Dtycho.disableP2Mirrors=true \
-Dmaven.test.redirectTestOutputToFile=false \
-Dsonar.analysis.mode=issues \
-Dsonar.github.pullRequest=$PULL_REQUEST \
-Dsonar.github.repository=$GITHUB_REPO \
-Dsonar.github.oauth=$GITHUB_TOKEN \
-Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.login=$SONAR_TOKEN \
-B -e -V $*
else
echo '======= Build, no analysis, no deploy'
mvn verify \
-Dmaven.test.redirectTestOutputToFile=false \
-Dtycho.disableP2Mirrors=true \
-B -e -V $*
fi