diff options
author | David Rautureau <david.rautureau@sonarsource.com> | 2018-02-08 15:01:19 +0100 |
---|---|---|
committer | David Rautureau <david.rautureau@sonarsource.com> | 2018-03-09 11:33:38 +0100 |
commit | 1a17e4302e4b63de6b4ce7c049441803b9471524 (patch) | |
tree | 031bcfbf302c7909c5b45a7c31f1bbc00a2fce34 /travis.sh | |
parent | 21fbe3697bdb6e66016ef8d0bea49da574e02e7d (diff) | |
download | sonarqube-1a17e4302e4b63de6b4ce7c049441803b9471524.tar.gz sonarqube-1a17e4302e4b63de6b4ce7c049441803b9471524.zip |
Move To Gradle
Diffstat (limited to 'travis.sh')
-rwxr-xr-x | travis.sh | 126 |
1 files changed, 21 insertions, 105 deletions
diff --git a/travis.sh b/travis.sh index 7c1acf457ea..eaf9879c83c 100755 --- a/travis.sh +++ b/travis.sh @@ -23,22 +23,6 @@ function installJdk8 { export PATH=$JAVA_HOME/bin:$PATH } -# -# Maven 3.2.5 is installed by default on Travis. Maven 3.5 is preferred. -# -function installMaven { - echo "Setup Maven" - mkdir -p ~/maven - pushd ~/maven > /dev/null - if [ ! -d "apache-maven-3.5" ]; then - echo "Download Maven 3.5" - curl -sSL https://archive.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz | tar zx -C ~/maven - fi - popd > /dev/null - export M2_HOME=~/maven/apache-maven-3.5.0 - export PATH=$M2_HOME/bin:$PATH -} - function installNode { set +u source ~/.nvm/nvm.sh && nvm install 8 @@ -46,61 +30,6 @@ function installNode { } # -# Replaces the version defined in sources, usually x.y-SNAPSHOT, -# by a version identifying the build. -# The build version is composed of 4 fields, including the semantic version and -# the build number provided by Travis. -# -# Exported variables: -# - INITIAL_VERSION: version as defined in pom.xml -# - 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 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 -SNAPSHOT or -RC - without_suffix=`echo $INITIAL_VERSION | sed "s/-.*//g"` - - IFS=$'.' - fields_count=`echo $without_suffix | wc -w` - unset IFS - if [ $fields_count -lt 3 ]; then - export BUILD_VERSION="$without_suffix.0.$TRAVIS_BUILD_NUMBER" - else - export BUILD_VERSION="$without_suffix.$TRAVIS_BUILD_NUMBER" - fi - - 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 - - echo "Build Version : $BUILD_VERSION" - echo "Project Version: $PROJECT_VERSION" -} - -# # Configure Maven settings and install some script utilities # function configureTravis { @@ -134,14 +63,10 @@ case "$TARGET" in BUILD) installJdk8 - installMaven installNode - fixBuildVersion - - # Minimal Maven settings - export MAVEN_OPTS="-Xmx1G -Xms128m" - MAVEN_ARGS="-T 1C -Dmaven.test.redirectTestOutputToFile=false -Dsurefire.useFile=false -B -e -V -DbuildVersion=$BUILD_VERSION -Dtests.es.logger.level=WARN -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" + # Used by Next + export INITIAL_VERSION=$(cat gradle.properties | grep version | awk -F= '{print $2}') # Fetch all commit history so that SonarQube has exact blame information # for issue auto-assignment @@ -153,27 +78,22 @@ BUILD) if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo 'Build and analyze master' - mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy \ - $MAVEN_ARGS \ - -Pdeploy-sonarsource,release - - mvn sonar:sonar \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.login=$SONAR_TOKEN \ - -Dsonar.projectVersion=$INITIAL_VERSION \ - -Dsonar.analysis.buildNumber=$BUILD_NUMBER \ - -Dsonar.analysis.pipeline=$BUILD_NUMBER \ - -Dsonar.analysis.sha1=$GIT_COMMIT \ - -Dsonar.analysis.repository=$TRAVIS_REPO_SLUG + ./gradlew --no-daemon --console plain \ + -DbuildNumber=$BUILD_NUMBER \ + build sonarqube artifactoryPublish -PjacocoEnabled=true -Prelease=true \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.login=$SONAR_TOKEN \ + -Dsonar.projectVersion=$INITIAL_VERSION \ + -Dsonar.analysis.buildNumber=$BUILD_NUMBER \ + -Dsonar.analysis.pipeline=$BUILD_NUMBER \ + -Dsonar.analysis.sha1=$GIT_COMMIT \ + -Dsonar.analysis.repository=$TRAVIS_REPO_SLUG elif [[ "$TRAVIS_BRANCH" == "branch-"* ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo 'Build release branch' - - mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy \ - $MAVEN_ARGS \ - -Pdeploy-sonarsource,release - - mvn sonar:sonar \ + ./gradlew --no-daemon --console plain \ + -DbuildNumber=$BUILD_NUMBER \ + build sonarqube artifactoryPublish -PjacocoEnabled=true -Prelease=true \ -Dsonar.host.url=$SONAR_HOST_URL \ -Dsonar.login=$SONAR_TOKEN \ -Dsonar.branch.name=$TRAVIS_BRANCH \ @@ -185,13 +105,9 @@ BUILD) elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN:-}" ]; then echo 'Build and analyze internal pull request' - - mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy \ - $MAVEN_ARGS \ - -Dsource.skip=true \ - -Pdeploy-sonarsource,release - - mvn sonar:sonar \ + ./gradlew --no-daemon --console plain \ + -DbuildNumber=$BUILD_NUMBER \ + build sonarqube artifactoryPublish -PjacocoEnabled=true -Prelease=true \ -Dsonar.host.url=$SONAR_HOST_URL \ -Dsonar.login=$SONAR_TOKEN \ -Dsonar.analysis.buildNumber=$BUILD_NUMBER \ @@ -207,10 +123,10 @@ BUILD) else echo 'Build feature branch or external pull request' - mvn deploy $MAVEN_ARGS -Pdeploy-sonarsource,release + ./gradlew --no-daemon --console plain \ + -DbuildNumber=$BUILD_NUMBER -Prelease=true \ + build artifactoryPublish fi - - ./run-integration-tests.sh "Lite" "" ;; WEB_TESTS) |