From da546c5d9cb6ba740d2839497c5382d0b0861c05 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 9 Apr 2013 18:25:34 +0200 Subject: [PATCH] Fix compatibility with sonar 3.5 tasks --- sonar-runner-batch/pom.xml | 2 +- .../org/sonar/runner/batch/IsolatedLauncher.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sonar-runner-batch/pom.xml b/sonar-runner-batch/pom.xml index 32a4f6c..747787d 100644 --- a/sonar-runner-batch/pom.xml +++ b/sonar-runner-batch/pom.xml @@ -11,7 +11,7 @@ Sonar Runner - Batch - 3.0 + 3.5 diff --git a/sonar-runner-batch/src/main/java/org/sonar/runner/batch/IsolatedLauncher.java b/sonar-runner-batch/src/main/java/org/sonar/runner/batch/IsolatedLauncher.java index eee9da7..825c0e1 100644 --- a/sonar-runner-batch/src/main/java/org/sonar/runner/batch/IsolatedLauncher.java +++ b/sonar-runner-batch/src/main/java/org/sonar/runner/batch/IsolatedLauncher.java @@ -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 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); -- 2.39.5