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:
-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=<path to keystore.jks> -Djarsigner.storepass=<password>
\ No newline at end of file
+http://jira.sonarsource.com/browse/SQSCANNER
</parent>
<groupId>com.sonarsource.it</groupId>
- <artifactId>it-sonar-runner</artifactId>
+ <artifactId>it-sonar-scanner</artifactId>
<version>1.0-SNAPSHOT</version>
- <name>SonarSource :: IT :: SonarQube Runner</name>
+ <name>SonarSource :: IT :: SonarQube Scanner</name>
<inceptionYear>2009</inceptionYear>
<organization>
<dependency>
<groupId>org.sonarsource.orchestrator</groupId>
<artifactId>sonar-orchestrator</artifactId>
- <version>3.5</version>
+ <version>3.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
/*
- * SonarSource :: IT :: SonarQube Runner
+ * SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*
/*
- * SonarSource :: IT :: SonarQube Runner
+ * SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*
/*
- * SonarSource :: IT :: SonarQube Runner
+ * SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*
/*
- * SonarSource :: IT :: SonarQube Runner
+ * SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*
/*
- * SonarSource :: IT :: SonarQube Runner
+ * SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*
<issueManagement>
<system>JIRA</system>
- <url>https://jira.sonarsource.com/browse/SONARSCANNER</url>
+ <url>https://jira.sonarsource.com/browse/SQSCANNER</url>
</issueManagement>
<properties>
<goal>single</goal>
</goals>
<configuration>
- <finalName>sonar-runner-${project.version}</finalName>
+ <finalName>sonar-scanner-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<escapeString>\</escapeString>
<descriptors>
<minsize>160000</minsize>
<maxsize>185000</maxsize>
<files>
- <file>${project.build.directory}/sonar-runner-${project.version}.zip</file>
+ <file>${project.build.directory}/sonar-scanner-${project.version}.zip</file>
</files>
</requireFilesSize>
</rules>
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
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"
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
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
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