Browse Source

SQSCANNER-1 Extract SonarQube Scanner as a standalone project

tags/2.5-rc1
Julien HENRY 8 years ago
parent
commit
7b6c311c7d

+ 5
- 7
.travis.yml View File

@@ -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:

+ 4
- 8
README.md View File

@@ -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=<path to keystore.jks> -Djarsigner.storepass=<password>
http://jira.sonarsource.com/browse/SQSCANNER

+ 3
- 3
it/pom.xml View File

@@ -11,9 +11,9 @@
</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>
@@ -31,7 +31,7 @@
<dependency>
<groupId>org.sonarsource.orchestrator</groupId>
<artifactId>sonar-orchestrator</artifactId>
<version>3.5</version>
<version>3.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>

+ 1
- 1
it/src/test/java/com/sonar/runner/it/CacheTest.java View File

@@ -1,5 +1,5 @@
/*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*

+ 1
- 1
it/src/test/java/com/sonar/runner/it/JavaTest.java View File

@@ -1,5 +1,5 @@
/*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*

+ 1
- 1
it/src/test/java/com/sonar/runner/it/MultimoduleTest.java View File

@@ -1,5 +1,5 @@
/*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*

+ 1
- 1
it/src/test/java/com/sonar/runner/it/RunnerTestCase.java View File

@@ -1,5 +1,5 @@
/*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*

+ 1
- 1
it/src/test/java/com/sonar/runner/it/SonarRunnerTestSuite.java View File

@@ -1,5 +1,5 @@
/*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com
*

+ 3
- 3
pom.xml View File

@@ -36,7 +36,7 @@

<issueManagement>
<system>JIRA</system>
<url>https://jira.sonarsource.com/browse/SONARSCANNER</url>
<url>https://jira.sonarsource.com/browse/SQSCANNER</url>
</issueManagement>

<properties>
@@ -129,7 +129,7 @@
<goal>single</goal>
</goals>
<configuration>
<finalName>sonar-runner-${project.version}</finalName>
<finalName>sonar-scanner-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<escapeString>\</escapeString>
<descriptors>
@@ -156,7 +156,7 @@
<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>

+ 2
- 2
src/main/assembly/bin/sonar-runner View File

@@ -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"

+ 2
- 2
src/main/assembly/bin/sonar-runner.bat View File

@@ -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


+ 39
- 32
travis.sh View File

@@ -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

Loading…
Cancel
Save