]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Fix compatibility with sonar 3.5 tasks
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 9 Apr 2013 16:25:34 +0000 (18:25 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 9 Apr 2013 16:25:34 +0000 (18:25 +0200)
sonar-runner-batch/pom.xml
sonar-runner-batch/src/main/java/org/sonar/runner/batch/IsolatedLauncher.java

index 32a4f6ce438ac01da2af819c00ae107bfc4ca528..747787df098361430c1cb911271615b104890ef1 100644 (file)
@@ -11,7 +11,7 @@
   <name>Sonar Runner - Batch</name>
 
   <properties>
-    <sonarBatchVersion>3.0</sonarBatchVersion>
+    <sonarBatchVersion>3.5</sonarBatchVersion>
   </properties>
 
   <dependencies>
index eee9da7673c55dac435bf587365564920b0f5d20..825c0e1a5908b97469a9c83c9aeb82b779ea257a 100644 (file)
@@ -32,6 +32,7 @@ import org.sonar.batch.bootstrapper.EnvironmentInformation;
 
 import java.io.InputStream;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 /**
@@ -46,17 +47,21 @@ public class IsolatedLauncher {
 
   Batch createBatch(Properties properties, List<Object> extensions) {
     ProjectReactor projectReactor = null;
+    initLogging(properties);
+    EnvironmentInformation env = new EnvironmentInformation(properties.getProperty("sonarRunner.userAgent"), properties.getProperty("sonarRunner.userAgentVersion"));
+    Batch.Builder builder = Batch.builder()
+        .setEnvironment(env)
+        .addComponents(extensions);
+
     String task = properties.getProperty("sonar.task", "scan");
     if ("scan".equals(task)) {
       Properties propsClone = new Properties();
       propsClone.putAll(properties);
       projectReactor = new ProjectReactorBuilder(propsClone).build();
+    } else {
+      // only on sonar 3.5+... in theory
+      builder.setGlobalProperties((Map)properties);
     }
-    initLogging(properties);
-    EnvironmentInformation env = new EnvironmentInformation(properties.getProperty("sonarRunner.userAgent"), properties.getProperty("sonarRunner.userAgentVersion"));
-    Batch.Builder builder = Batch.builder()
-      .setEnvironment(env)
-      .addComponents(extensions);
 
     if (projectReactor != null) {
       builder.setProjectReactor(projectReactor);