From 378a8d9d4636d80f3421f17e8b0209742b64a3c9 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 1 Feb 2016 14:53:51 +0100 Subject: Fix build - upgrade orchestrator from 3.9-SNAPSHOT to 3.9 - use latest parent pom in integration tests - support Java 7 for analysis from Travis --- .gitignore | 1 - .sonarsource.properties | 6 +- it/pom.xml | 4 +- .../test/java/com/sonar/runner/it/CacheTest.java | 10 +-- it/src/test/java/com/sonar/runner/it/JavaTest.java | 10 +-- .../java/com/sonar/runner/it/MultimoduleTest.java | 10 +-- .../java/com/sonar/runner/it/ScannerTestCase.java | 10 +-- .../com/sonar/runner/it/SonarScannerTestSuite.java | 10 +-- pom.xml | 9 +++ travis.sh | 77 ++++++++++------------ 10 files changed, 73 insertions(+), 74 deletions(-) diff --git a/.gitignore b/.gitignore index ae31f48..6762fb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ - # ---- Maven target/ dependency-reduced-pom.xml diff --git a/.sonarsource.properties b/.sonarsource.properties index 158b890..69cc7ce 100644 --- a/.sonarsource.properties +++ b/.sonarsource.properties @@ -1,6 +1,2 @@ -# Sonarsource meta data file for this project - -# Wallboard -# teamAtSonarSource drives in which wallboard the alerting will be sent -# platform , language, infra +# Wallboard used in SonarSource offices wallboard.teamAtSonarSource=platform diff --git a/it/pom.xml b/it/pom.xml index 3c1aa0d..a1a35cd 100644 --- a/it/pom.xml +++ b/it/pom.xml @@ -6,7 +6,7 @@ org.sonarsource.parent parent - 23 + 26 @@ -31,7 +31,7 @@ org.sonarsource.orchestrator sonar-orchestrator - 3.9-SNAPSHOT + 3.9 junit diff --git a/it/src/test/java/com/sonar/runner/it/CacheTest.java b/it/src/test/java/com/sonar/runner/it/CacheTest.java index 8a7d704..a226521 100644 --- a/it/src/test/java/com/sonar/runner/it/CacheTest.java +++ b/it/src/test/java/com/sonar/runner/it/CacheTest.java @@ -1,7 +1,7 @@ /* * SonarSource :: IT :: SonarQube Scanner - * Copyright (C) 2009 SonarSource - * sonarqube@googlegroups.com + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -13,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.sonar.runner.it; diff --git a/it/src/test/java/com/sonar/runner/it/JavaTest.java b/it/src/test/java/com/sonar/runner/it/JavaTest.java index 2d0c2fb..e997a8b 100644 --- a/it/src/test/java/com/sonar/runner/it/JavaTest.java +++ b/it/src/test/java/com/sonar/runner/it/JavaTest.java @@ -1,7 +1,7 @@ /* * SonarSource :: IT :: SonarQube Scanner - * Copyright (C) 2009 SonarSource - * sonarqube@googlegroups.com + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -13,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.sonar.runner.it; diff --git a/it/src/test/java/com/sonar/runner/it/MultimoduleTest.java b/it/src/test/java/com/sonar/runner/it/MultimoduleTest.java index b09ca8d..2a7ef0a 100644 --- a/it/src/test/java/com/sonar/runner/it/MultimoduleTest.java +++ b/it/src/test/java/com/sonar/runner/it/MultimoduleTest.java @@ -1,7 +1,7 @@ /* * SonarSource :: IT :: SonarQube Scanner - * Copyright (C) 2009 SonarSource - * sonarqube@googlegroups.com + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -13,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.sonar.runner.it; diff --git a/it/src/test/java/com/sonar/runner/it/ScannerTestCase.java b/it/src/test/java/com/sonar/runner/it/ScannerTestCase.java index 6f0d851..9d8e63d 100644 --- a/it/src/test/java/com/sonar/runner/it/ScannerTestCase.java +++ b/it/src/test/java/com/sonar/runner/it/ScannerTestCase.java @@ -1,7 +1,7 @@ /* * SonarSource :: IT :: SonarQube Scanner - * Copyright (C) 2009 SonarSource - * sonarqube@googlegroups.com + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -13,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.sonar.runner.it; diff --git a/it/src/test/java/com/sonar/runner/it/SonarScannerTestSuite.java b/it/src/test/java/com/sonar/runner/it/SonarScannerTestSuite.java index 8114fcd..1cb56cc 100644 --- a/it/src/test/java/com/sonar/runner/it/SonarScannerTestSuite.java +++ b/it/src/test/java/com/sonar/runner/it/SonarScannerTestSuite.java @@ -1,7 +1,7 @@ /* * SonarSource :: IT :: SonarQube Scanner - * Copyright (C) 2009 SonarSource - * sonarqube@googlegroups.com + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -13,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.sonar.runner.it; diff --git a/pom.xml b/pom.xml index 4b601cf..6f220cd 100644 --- a/pom.xml +++ b/pom.xml @@ -183,4 +183,13 @@ + + + + it + + it + + + diff --git a/travis.sh b/travis.sh index 91903a6..5f2ca30 100755 --- a/travis.sh +++ b/travis.sh @@ -2,11 +2,12 @@ set -euo pipefail -function installTravisTools { +function configureTravis { mkdir -p ~/.local - curl -sSL https://github.com/SonarSource/travis-utils/tarball/v21 | tar zx --strip-components 1 -C ~/.local + curl -sSL https://github.com/SonarSource/travis-utils/tarball/v23 | tar zx --strip-components 1 -C ~/.local source ~/.local/bin/install } +configureTravis function strongEcho { echo "" @@ -17,56 +18,52 @@ case "$TARGET" in CI) if [ "${TRAVIS_BRANCH}" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then - strongEcho 'Build and analyze commit in master' - # this commit is master must be built and analyzed (with upload of report) - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify -Pcoverage-per-test -Dmaven.test.redirectTestOutputToFile=false -B -e -V + strongEcho 'Build, deploy and analyze master' - # Switch to java 8 as the Dory HTTPS certificate is not supported by Java 7 - export JAVA_HOME=/usr/lib/jvm/java-8-oracle - export PATH=$JAVA_HOME/bin:$PATH + SONAR_PROJECT_VERSION=`maven_expression "project.version"` + + # Do not deploy a SNAPSHOT version but the release version related to this build + set_maven_build_version $TRAVIS_BUILD_NUMBER export MAVEN_OPTS="-Xmx1G -Xms128m" - mvn sonar:sonar -B -e -V \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.login=$SONAR_TOKEN - - - elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "$GITHUB_TOKEN" ]; then - # For security reasons environment variables are not available on the pull requests - # coming from outside repositories - # http://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests - # That's why the analysis does not need to be executed if the variable SONAR_GITHUB_OAUTH is not defined. - - strongEcho 'Build and analyze pull request' - # this pull request must be built and analyzed (without upload of report) - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify -Pcoverage-per-test -Dmaven.test.redirectTestOutputToFile=false -B -e -V - - # Switch to java 8 as the Dory HTTPS certificate is not supported by Java 7 - export JAVA_HOME=/usr/lib/jvm/java-8-oracle - export PATH=$JAVA_HOME/bin:$PATH - - mvn sonar:sonar -B -e -V \ - -Dsonar.analysis.mode=issues \ + mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy sonar:sonar \ + -Pcoverage-per-test,deploy-sonarsource \ + -Dmaven.test.redirectTestOutputToFile=false \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.login=$SONAR_TOKEN \ + -Dsonar.projectVersion=$SONAR_PROJECT_VERSION \ + -B -e -V + + elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN-}" ]; then + strongEcho 'Build and analyze pull request, no deploy' + + # No need for Maven phase "install" as the generated JAR file does not need to be installed + # in Maven local repository. Phase "verify" is enough. + + mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar \ + -Dmaven.test.redirectTestOutputToFile=false \ + -Dsonar.analysis.mode=issues \ -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \ -Dsonar.github.repository=$TRAVIS_REPO_SLUG \ -Dsonar.github.oauth=$GITHUB_TOKEN \ -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.login=$SONAR_TOKEN - + -Dsonar.login=$SONAR_TOKEN \ + -B -e -V else - strongEcho 'Build, no analysis' - # Build branch, without any analysis + strongEcho 'Build, no analysis, no deploy' - # No need for Maven goal "install" as the generated JAR file does not need to be installed - # in Maven local repository - mvn verify -Dmaven.test.redirectTestOutputToFile=false -B -e -V + # No need for Maven phase "install" as the generated JAR file does not need to be installed + # in Maven local repository. Phase "verify" is enough. + + mvn verify \ + -Dmaven.test.redirectTestOutputToFile=false \ + -B -e -V fi ;; IT) - installTravisTools - if [ "${SQ_VERSION}" == "DEV" ] + if [ "${SQ_VERSION}" = "DEV" ] then build_snapshot "SonarSource/sonarqube" fi @@ -76,9 +73,7 @@ IT) cd it - build_snapshot "SonarSource/orchestrator" - - mvn -Dsonar.runtimeVersion="$SQ_VERSION" -Dmaven.test.redirectTestOutputToFile=false verify + mvn -Dsonar.runtimeVersion="$SQ_VERSION" -Dmaven.test.redirectTestOutputToFile=false verify -e -B -V ;; *) -- cgit v1.2.3