diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-03-06 12:39:10 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-03-06 12:39:10 +0100 |
commit | 54710d55c2a5a979f9b9abcb256466775cb2c2dd (patch) | |
tree | d7b385cdecdd784485bb45a7401302634279de9e /travis.sh | |
parent | abe0b5d895dc8b1abc60ff645a60cd3c32ee05bd (diff) | |
parent | 45e68e898f2f6d3261d0b06867694d5f094d37d7 (diff) | |
download | sonarqube-54710d55c2a5a979f9b9abcb256466775cb2c2dd.tar.gz sonarqube-54710d55c2a5a979f9b9abcb256466775cb2c2dd.zip |
Merge remote-tracking branch 'origin/branch-6.3'
Diffstat (limited to 'travis.sh')
-rwxr-xr-x | travis.sh | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/travis.sh b/travis.sh index 50aa00508e5..4e84696b946 100755 --- a/travis.sh +++ b/travis.sh @@ -61,33 +61,51 @@ function installMaven { # # Exported variables: # - INITIAL_VERSION: version as defined in pom.xml -# - PROJECT_VERSION: build version. The name of this variable is important because +# - BUILD_VERSION: version including the build number +# - PROJECT_VERSION: target Maven version. The name of this variable is important because # it's used by QA when extracting version from Artifactory build info. # -# Example +# Example of SNAPSHOT # INITIAL_VERSION=6.3-SNAPSHOT +# BUILD_VERSION=6.3.0.12345 # PROJECT_VERSION=6.3.0.12345 # +# Example of RC +# INITIAL_VERSION=6.3-RC1 +# BUILD_VERSION=6.3.0.12345 +# PROJECT_VERSION=6.3-RC1 +# +# Example of GA +# INITIAL_VERSION=6.3 +# BUILD_VERSION=6.3.0.12345 +# PROJECT_VERSION=6.3 +# function fixBuildVersion { export INITIAL_VERSION=`maven_expression "project.version"` - # remove suffix like -SNAPSHOT or -RC + # remove suffix -SNAPSHOT or -RC without_suffix=`echo $INITIAL_VERSION | sed "s/-.*//g"` - # set the third field to '0' if missing, for example 6.3 becomes 6.3.0 IFS=$'.' fields_count=`echo $without_suffix | wc -w` unset IFS if [ $fields_count -lt 3 ]; then - without_suffix="$without_suffix.0" + export BUILD_VERSION="$without_suffix.0.$TRAVIS_BUILD_NUMBER" + else + export BUILD_VERSION="$without_suffix.$TRAVIS_BUILD_NUMBER" fi - export PROJECT_VERSION="$without_suffix.$TRAVIS_BUILD_NUMBER" - - echo "Source Version: $INITIAL_VERSION" - echo "Build Version : $PROJECT_VERSION" + if [ "${INITIAL_VERSION}" == *"-SNAPSHOT" ]; then + # SNAPSHOT + export PROJECT_VERSION=$BUILD_VERSION + mvn org.codehaus.mojo:versions-maven-plugin:2.2:set -DnewVersion=$PROJECT_VERSION -DgenerateBackupPoms=false -B -e + else + # not a SNAPSHOT: milestone, RC or GA + export PROJECT_VERSION=$INITIAL_VERSION + fi - mvn org.codehaus.mojo:versions-maven-plugin:2.2:set -DnewVersion=$PROJECT_VERSION -DgenerateBackupPoms=false -B -e + echo "Build Version : $BUILD_VERSION" + echo "Project Version: $PROJECT_VERSION" } # @@ -114,7 +132,7 @@ BUILD) # Minimal Maven settings export MAVEN_OPTS="-Xmx1G -Xms128m" - MAVEN_ARGS="-Dmaven.test.redirectTestOutputToFile=false -Dsurefire.useFile=false -B -e -V -DbuildVersion=$PROJECT_VERSION" + MAVEN_ARGS="-Dmaven.test.redirectTestOutputToFile=false -Dsurefire.useFile=false -B -e -V -DbuildVersion=$BUILD_VERSION" if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo 'Build and analyze master' |