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

script: ./travis.sh script: ./travis.sh


env: 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: cache:
directories: directories:

+ 4
- 8
README.md View File

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: Documentation:
http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Runner
http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner


Issue Tracker: 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

</parent> </parent>


<groupId>com.sonarsource.it</groupId> <groupId>com.sonarsource.it</groupId>
<artifactId>it-sonar-runner</artifactId>
<artifactId>it-sonar-scanner</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<name>SonarSource :: IT :: SonarQube Runner</name>
<name>SonarSource :: IT :: SonarQube Scanner</name>
<inceptionYear>2009</inceptionYear> <inceptionYear>2009</inceptionYear>


<organization> <organization>
<dependency> <dependency>
<groupId>org.sonarsource.orchestrator</groupId> <groupId>org.sonarsource.orchestrator</groupId>
<artifactId>sonar-orchestrator</artifactId> <artifactId>sonar-orchestrator</artifactId>
<version>3.5</version>
<version>3.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>

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

/* /*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource * Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com * sonarqube@googlegroups.com
* *

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

/* /*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource * Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com * sonarqube@googlegroups.com
* *

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

/* /*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource * Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com * sonarqube@googlegroups.com
* *

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

/* /*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource * Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com * sonarqube@googlegroups.com
* *

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

/* /*
* SonarSource :: IT :: SonarQube Runner
* SonarSource :: IT :: SonarQube Scanner
* Copyright (C) 2009 SonarSource * Copyright (C) 2009 SonarSource
* sonarqube@googlegroups.com * sonarqube@googlegroups.com
* *

+ 3
- 3
pom.xml View File



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


<properties> <properties>
<goal>single</goal> <goal>single</goal>
</goals> </goals>
<configuration> <configuration>
<finalName>sonar-runner-${project.version}</finalName>
<finalName>sonar-scanner-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId> <appendAssemblyId>false</appendAssemblyId>
<escapeString>\</escapeString> <escapeString>\</escapeString>
<descriptors> <descriptors>
<minsize>160000</minsize> <minsize>160000</minsize>
<maxsize>185000</maxsize> <maxsize>185000</maxsize>
<files> <files>
<file>${project.build.directory}/sonar-runner-${project.version}.zip</file>
<file>${project.build.directory}/sonar-scanner-${project.version}.zip</file>
</files> </files>
</requireFilesSize> </requireFilesSize>
</rules> </rules>

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

fi fi


# check that the SONAR_RUNNER_HOME has been correctly set # 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 echo '$SONAR_RUNNER_HOME' does not point to a valid installation directory: $SONAR_RUNNER_HOME
exit 1 exit 1
fi fi
JAVA_CMD="`which java`" JAVA_CMD="`which java`"
fi 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` PROJECT_HOME=`pwd`


#echo "Info: Using sonar-runner at $SONAR_RUNNER_HOME" #echo "Info: Using sonar-runner at $SONAR_RUNNER_HOME"

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

if "%SONAR_RUNNER_HOME:~-1%"=="\" set SONAR_RUNNER_HOME=%SONAR_RUNNER_HOME:~0,-1% 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 @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.
echo ERROR: SONAR_RUNNER_HOME exists but does not point to a valid install echo ERROR: SONAR_RUNNER_HOME exists but does not point to a valid install


set PROJECT_HOME=%CD% 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 if ERRORLEVEL 1 goto error
goto end goto end



+ 39
- 32
travis.sh View File

source ~/.local/bin/install 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 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 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