]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
SQSCANNER-1 Extract SonarQube Scanner as a standalone project 1/head
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 10 Nov 2015 08:42:10 +0000 (09:42 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 10 Nov 2015 13:32:00 +0000 (14:32 +0100)
12 files changed:
.travis.yml
README.md
it/pom.xml
it/src/test/java/com/sonar/runner/it/CacheTest.java
it/src/test/java/com/sonar/runner/it/JavaTest.java
it/src/test/java/com/sonar/runner/it/MultimoduleTest.java
it/src/test/java/com/sonar/runner/it/RunnerTestCase.java
it/src/test/java/com/sonar/runner/it/SonarRunnerTestSuite.java
pom.xml
src/main/assembly/bin/sonar-runner
src/main/assembly/bin/sonar-runner.bat
travis.sh

index 7dc0f7c02da7adf84fb96b48982eb923327e7274..bb57a380af8432a8aa63aff936cdf9c6382f1cee 100644 (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:
index 59c22ce4a9a16a15eb87833fad320e4c21570a3b..710373c6be6ad04e23df4ac9d11970e4ee1a2f94 100644 (file)
--- 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=<path to keystore.jks> -Djarsigner.storepass=<password>
\ No newline at end of file
+http://jira.sonarsource.com/browse/SQSCANNER
index 8cc71a0c1f3d049428cfb9aa427fe14ed8901719..6b3efff0619d8a73d4b66faa74479074c4e574f4 100644 (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>
index 7e9c9532de55a90a3188aa45573e4771529277ca..1300cefbebae2aa0cf8f2042182dc74edaaaaf43 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * SonarSource :: IT :: SonarQube Runner
+ * SonarSource :: IT :: SonarQube Scanner
  * Copyright (C) 2009 SonarSource
  * sonarqube@googlegroups.com
  *
index 1a8802c921426ed6f4f570ce94095b3488305f3f..a9ece3ba1a0e3d2781a2176305cec8e52dc427a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * SonarSource :: IT :: SonarQube Runner
+ * SonarSource :: IT :: SonarQube Scanner
  * Copyright (C) 2009 SonarSource
  * sonarqube@googlegroups.com
  *
index 6f2a25ca83993ff6f3a8549047cc5c0c31ff0ec6..c8941b2fa6fbfd51502ec58d288465ae10a3d777 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * SonarSource :: IT :: SonarQube Runner
+ * SonarSource :: IT :: SonarQube Scanner
  * Copyright (C) 2009 SonarSource
  * sonarqube@googlegroups.com
  *
index 7323a55b801d022ecaa74c72b92b84cfd66aa927..79a1edd61c443c7dfb4f0bf304562594f60c659b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * SonarSource :: IT :: SonarQube Runner
+ * SonarSource :: IT :: SonarQube Scanner
  * Copyright (C) 2009 SonarSource
  * sonarqube@googlegroups.com
  *
index b2193662368ae1897c1f4fcfaf74f3e6d5808c2c..6157d7c0afbf752e3844693a77a65368c924bf40 100644 (file)
@@ -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 ab3ec7e939f61366344fd6548d7dc6e351e830a7..b54149c36df8bb0c6a7d965a62d33617de019210 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -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>
               <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>
index eea044a7785073ade84e929fad22e9f061c53d1e..ec2f4268d1b5986afc05ed9288de592534a93b76 100755 (executable)
@@ -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"
index 67fa74296b7a9528b0bfc07c207bd5e14223e793..72d054bbc38ee4802d84938fcc059cd33865d764 100644 (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
 
index 762944492cafa882d02e147b620aa8e4bc060b5a..a4056fba42e82f25a0c4d0b8d6fc534ca414d59d 100755 (executable)
--- 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