From: Julien HENRY Date: Tue, 10 Nov 2015 08:42:10 +0000 (+0100) Subject: SQSCANNER-1 Extract SonarQube Scanner as a standalone project X-Git-Tag: 2.5-rc1~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1%2Fhead;p=sonar-scanner-cli.git SQSCANNER-1 Extract SonarQube Scanner as a standalone project --- diff --git a/.travis.yml b/.travis.yml index 7dc0f7c..bb57a38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,11 @@ install: true script: ./travis.sh env: - - TESTS=CI - - TESTS=IT-DEV - - TESTS=IT-DEV-SQ51 - - TESTS=IT-DEV-LTS - -matrix: - fast_finish: true + matrix: + - PR_ANALYSIS=true + - RUN_ITS=true SQ_VERSION=DEV + - RUN_ITS=true SQ_VERSION=5.1.2 + - RUN_ITS=true SQ_VERSION=LTS cache: directories: diff --git a/README.md b/README.md index 59c22ce..710373c 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,10 @@ -SonarQube Runner [![Build Status](https://travis-ci.org/SonarSource/sonar-runner.svg?branch=master)](https://travis-ci.org/SonarSource/sonar-runner) +SonarQube Scanner [![Build Status](https://travis-ci.org/SonarSource/sonar-scanner-cli.svg?branch=master)](https://travis-ci.org/SonarSource/sonar-scanner-cli) ========================= -Bootstrapper of code analysis +Official SonarQube Scanner used to start code analysis. Project configuration is read from a sonar-project.properties or passed on command line. Documentation: -http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Runner +http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner Issue Tracker: -http://jira.sonarsource.com/browse/SONARUNNER - -Release: -sonar-runner-api need to be signed for use in SonarLint for Eclipse. So you need to pass following properties during perform: -mvn release:perform -Djarsigner.keystore= -Djarsigner.storepass= \ No newline at end of file +http://jira.sonarsource.com/browse/SQSCANNER diff --git a/it/pom.xml b/it/pom.xml index 8cc71a0..6b3efff 100644 --- a/it/pom.xml +++ b/it/pom.xml @@ -11,9 +11,9 @@ com.sonarsource.it - it-sonar-runner + it-sonar-scanner 1.0-SNAPSHOT - SonarSource :: IT :: SonarQube Runner + SonarSource :: IT :: SonarQube Scanner 2009 @@ -31,7 +31,7 @@ org.sonarsource.orchestrator sonar-orchestrator - 3.5 + 3.8-SNAPSHOT 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 7e9c953..1300cef 100644 --- a/it/src/test/java/com/sonar/runner/it/CacheTest.java +++ b/it/src/test/java/com/sonar/runner/it/CacheTest.java @@ -1,5 +1,5 @@ /* - * SonarSource :: IT :: SonarQube Runner + * SonarSource :: IT :: SonarQube Scanner * Copyright (C) 2009 SonarSource * sonarqube@googlegroups.com * 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 1a8802c..a9ece3b 100644 --- a/it/src/test/java/com/sonar/runner/it/JavaTest.java +++ b/it/src/test/java/com/sonar/runner/it/JavaTest.java @@ -1,5 +1,5 @@ /* - * SonarSource :: IT :: SonarQube Runner + * SonarSource :: IT :: SonarQube Scanner * Copyright (C) 2009 SonarSource * sonarqube@googlegroups.com * 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 6f2a25c..c8941b2 100644 --- a/it/src/test/java/com/sonar/runner/it/MultimoduleTest.java +++ b/it/src/test/java/com/sonar/runner/it/MultimoduleTest.java @@ -1,5 +1,5 @@ /* - * SonarSource :: IT :: SonarQube Runner + * SonarSource :: IT :: SonarQube Scanner * Copyright (C) 2009 SonarSource * sonarqube@googlegroups.com * diff --git a/it/src/test/java/com/sonar/runner/it/RunnerTestCase.java b/it/src/test/java/com/sonar/runner/it/RunnerTestCase.java index 7323a55..79a1edd 100644 --- a/it/src/test/java/com/sonar/runner/it/RunnerTestCase.java +++ b/it/src/test/java/com/sonar/runner/it/RunnerTestCase.java @@ -1,5 +1,5 @@ /* - * SonarSource :: IT :: SonarQube Runner + * SonarSource :: IT :: SonarQube Scanner * Copyright (C) 2009 SonarSource * sonarqube@googlegroups.com * diff --git a/it/src/test/java/com/sonar/runner/it/SonarRunnerTestSuite.java b/it/src/test/java/com/sonar/runner/it/SonarRunnerTestSuite.java index b219366..6157d7c 100644 --- a/it/src/test/java/com/sonar/runner/it/SonarRunnerTestSuite.java +++ b/it/src/test/java/com/sonar/runner/it/SonarRunnerTestSuite.java @@ -1,5 +1,5 @@ /* - * SonarSource :: IT :: SonarQube Runner + * SonarSource :: IT :: SonarQube Scanner * Copyright (C) 2009 SonarSource * sonarqube@googlegroups.com * diff --git a/pom.xml b/pom.xml index ab3ec7e..b54149c 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ JIRA - https://jira.sonarsource.com/browse/SONARSCANNER + https://jira.sonarsource.com/browse/SQSCANNER @@ -129,7 +129,7 @@ single - sonar-runner-${project.version} + sonar-scanner-${project.version} false \ @@ -156,7 +156,7 @@ 160000 185000 - ${project.build.directory}/sonar-runner-${project.version}.zip + ${project.build.directory}/sonar-scanner-${project.version}.zip diff --git a/src/main/assembly/bin/sonar-runner b/src/main/assembly/bin/sonar-runner index eea044a..ec2f426 100755 --- a/src/main/assembly/bin/sonar-runner +++ b/src/main/assembly/bin/sonar-runner @@ -80,7 +80,7 @@ if [ -z "$SONAR_RUNNER_HOME" ] ; then fi # check that the SONAR_RUNNER_HOME has been correctly set -if [ ! -f "$SONAR_RUNNER_HOME/lib/sonar-runner-dist-${project.version}.jar" ] ; then +if [ ! -f "$SONAR_RUNNER_HOME/lib/sonar-scanner-${project.version}.jar" ] ; then echo '$SONAR_RUNNER_HOME' does not point to a valid installation directory: $SONAR_RUNNER_HOME exit 1 fi @@ -92,7 +92,7 @@ else JAVA_CMD="`which java`" fi -JAR_FILE="${SONAR_RUNNER_HOME}"/lib/sonar-runner-dist-${project.version}.jar +JAR_FILE="${SONAR_RUNNER_HOME}"/lib/sonar-scanner-${project.version}.jar PROJECT_HOME=`pwd` #echo "Info: Using sonar-runner at $SONAR_RUNNER_HOME" diff --git a/src/main/assembly/bin/sonar-runner.bat b/src/main/assembly/bin/sonar-runner.bat index 67fa742..72d054b 100644 --- a/src/main/assembly/bin/sonar-runner.bat +++ b/src/main/assembly/bin/sonar-runner.bat @@ -58,7 +58,7 @@ goto run if "%SONAR_RUNNER_HOME:~-1%"=="\" set SONAR_RUNNER_HOME=%SONAR_RUNNER_HOME:~0,-1% @REM Check if the provided SONAR_RUNNER_HOME is a valid install dir -IF EXIST "%SONAR_RUNNER_HOME%\lib\sonar-runner-dist-${project.version}.jar" goto run +IF EXIST "%SONAR_RUNNER_HOME%\lib\sonar-scanner-${project.version}.jar" goto run echo. echo ERROR: SONAR_RUNNER_HOME exists but does not point to a valid install @@ -74,7 +74,7 @@ echo %SONAR_RUNNER_HOME% set PROJECT_HOME=%CD% -%JAVA_EXEC% -Djava.awt.headless=true %SONAR_RUNNER_OPTS% -cp "%SONAR_RUNNER_HOME%\lib\sonar-runner-dist-${project.version}.jar" "-Drunner.home=%SONAR_RUNNER_HOME%" "-Dproject.home=%PROJECT_HOME%" org.sonar.runner.cli.Main %* +%JAVA_EXEC% -Djava.awt.headless=true %SONAR_RUNNER_OPTS% -cp "%SONAR_RUNNER_HOME%\lib\sonar-scanner-${project.version}.jar" "-Drunner.home=%SONAR_RUNNER_HOME%" "-Dproject.home=%PROJECT_HOME%" org.sonar.runner.cli.Main %* if ERRORLEVEL 1 goto error goto end diff --git a/travis.sh b/travis.sh index 7629444..a4056fb 100755 --- a/travis.sh +++ b/travis.sh @@ -8,41 +8,48 @@ function installTravisTools { source ~/.local/bin/install } -case "$TESTS" in +if [ -n "${PR_ANALYSIS:-}" ] && [ "${PR_ANALYSIS}" == true ] +then + if [ "$TRAVIS_PULL_REQUEST" != "false" ] + 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 + if [ -n "$SONAR_GITHUB_OAUTH" ]; then + + # 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 + + # PR analysis + mvn verify sonar:sonar -B -e -V \ + -Dsonar.analysis.mode=issues \ + -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \ + -Dsonar.github.repository=$TRAVIS_REPO_SLUG \ + -Dsonar.github.login=$SONAR_GITHUB_LOGIN \ + -Dsonar.github.oauth=$SONAR_GITHUB_OAUTH \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.login=$SONAR_LOGIN \ + -Dsonar.password=$SONAR_PASSWD + fi + fi +else + # Regular CI (use install for ITs) + mvn install -B -e -V +fi + +if [ -n "${RUN_ITS:-}" ] && [ "${RUN_ITS}" == true ] +then -CI) installTravisTools + build_snapshot "SonarSource/orchestrator" - mvn verify -B -e -V - ;; - -IT-DEV) - installTravisTools - - build_snapshot "SonarSource/sonarqube" - - mvn install -Dsource.skip=true -Denforcer.skip=true -Danimal.sniffer.skip=true -Dmaven.test.skip=true - - cd it - mvn -DsonarRunner.version="2.5-SNAPSHOT" -Dsonar.runtimeVersion="DEV" -Dmaven.test.redirectTestOutputToFile=false install - ;; - -IT-DEV-SQ51) - installTravisTools - - mvn install -Dsource.skip=true -Denforcer.skip=true -Danimal.sniffer.skip=true -Dmaven.test.skip=true - - cd it - mvn -DsonarRunner.version="2.5-SNAPSHOT" -Dsonar.runtimeVersion="5.1.2" -Dmaven.test.redirectTestOutputToFile=false install - ;; - -IT-DEV-LTS) - installTravisTools - - mvn install -Dsource.skip=true -Denforcer.skip=true -Danimal.sniffer.skip=true -Dmaven.test.skip=true + if [ "${SQ_VERSION}" == "DEV" ] + then + build_snapshot "SonarSource/sonarqube" + fi cd it - mvn -DsonarRunner.version="2.5-SNAPSHOT" -Dsonar.runtimeVersion="4.5.5" -Dmaven.test.redirectTestOutputToFile=false install - ;; + mvn -DsonarRunner.version="2.5-SNAPSHOT" -Dsonar.runtimeVersion=$SQ_VERSION -Dmaven.test.redirectTestOutputToFile=false install -esac +fi