diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-06-25 15:53:51 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-06-25 18:01:35 +0200 |
commit | d4feed19cf6c8c8adf7fcdb037436871c962175a (patch) | |
tree | 527965c695694bff91a8c5cc70ce78f344103c04 /sonar-runner-batch | |
parent | 8d8bc9bf3d4964f71e9c0e0d719ad1416ba8c16a (diff) | |
download | sonar-scanner-cli-d4feed19cf6c8c8adf7fcdb037436871c962175a.tar.gz sonar-scanner-cli-d4feed19cf6c8c8adf7fcdb037436871c962175a.zip |
SONARUNNER-141 Remove forked mode
Diffstat (limited to 'sonar-runner-batch')
3 files changed, 17 insertions, 32 deletions
diff --git a/sonar-runner-batch/pom.xml b/sonar-runner-batch/pom.xml index 4fe84da..dc57821 100644 --- a/sonar-runner-batch/pom.xml +++ b/sonar-runner-batch/pom.xml @@ -21,12 +21,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>0.9.15</version> - <scope>provided</scope> - </dependency> - <dependency> <groupId>org.codehaus.sonar</groupId> <artifactId>sonar-batch</artifactId> <version>${sonarBatchVersion}</version> diff --git a/sonar-runner-batch/src/main/java/org/sonar/runner/batch/BatchIsolatedLauncher.java b/sonar-runner-batch/src/main/java/org/sonar/runner/batch/BatchIsolatedLauncher.java index b88ba6e..8723ed8 100644 --- a/sonar-runner-batch/src/main/java/org/sonar/runner/batch/BatchIsolatedLauncher.java +++ b/sonar-runner-batch/src/main/java/org/sonar/runner/batch/BatchIsolatedLauncher.java @@ -19,22 +19,17 @@ */ package org.sonar.runner.batch; -import org.sonar.home.log.LogListener; -import org.picocontainer.annotations.Nullable; -import com.google.common.annotations.VisibleForTesting; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; -import java.util.List; import java.util.Map; import java.util.Properties; - -import org.sonar.api.utils.SonarException; +import org.picocontainer.annotations.Nullable; import org.sonar.batch.bootstrapper.Batch; import org.sonar.batch.bootstrapper.EnvironmentInformation; +import org.sonar.batch.bootstrapper.LogOutput; /** * This class is executed within the classloader provided by the server. It contains the installed plugins and @@ -42,20 +37,11 @@ import org.sonar.batch.bootstrapper.EnvironmentInformation; */ public class BatchIsolatedLauncher implements IsolatedLauncher { - private static final String WARN = "WARN"; - private static final String DEBUG = "DEBUG"; - private static final String FALSE = "false"; - private Batch batch = null; @Override - public void start(Properties globalProperties, List<Object> extensions) { - start(globalProperties, extensions, null); - } - - @Override - public void start(Properties globalProperties, List<Object> extensions, @Nullable LogListener logListener) { - batch = createBatch(globalProperties, extensions, logListener); + public void start(Properties globalProperties, org.sonar.runner.batch.LogOutput logOutput) { + batch = createBatch(globalProperties, logOutput); batch.start(); } @@ -69,15 +55,21 @@ public class BatchIsolatedLauncher implements IsolatedLauncher { batch.executeTask((Map) properties); } - Batch createBatch(Properties properties, List<Object> extensions, @Nullable LogListener logListener) { + Batch createBatch(Properties properties, @Nullable final org.sonar.runner.batch.LogOutput logOutput) { EnvironmentInformation env = new EnvironmentInformation(properties.getProperty("sonarRunner.app"), properties.getProperty("sonarRunner.appVersion")); Batch.Builder builder = Batch.builder() .setEnvironment(env) - .addComponents(extensions) .setBootstrapProperties((Map) properties); - if (logListener != null) { - builder.setLogListener(logListener); + if (logOutput != null) { + builder.setLogOutput(new LogOutput() { + + @Override + public void log(String formattedMessage, Level level) { + logOutput.log(formattedMessage, org.sonar.runner.batch.LogOutput.Level.valueOf(level.name())); + } + + }); } return builder.build(); @@ -87,8 +79,8 @@ public class BatchIsolatedLauncher implements IsolatedLauncher { * This method exists for backward compatibility with SonarQube < 5.2. */ @Override - public void executeOldVersion(Properties properties, List<Object> extensions) { - createBatch(properties, extensions, null).execute(); + public void executeOldVersion(Properties properties) { + createBatch(properties, null).execute(); } @Override diff --git a/sonar-runner-batch/src/test/java/org/sonar/runner/batch/IsolatedLauncherTest.java b/sonar-runner-batch/src/test/java/org/sonar/runner/batch/IsolatedLauncherTest.java index 2108751..610ff75 100644 --- a/sonar-runner-batch/src/test/java/org/sonar/runner/batch/IsolatedLauncherTest.java +++ b/sonar-runner-batch/src/test/java/org/sonar/runner/batch/IsolatedLauncherTest.java @@ -19,7 +19,6 @@ */ package org.sonar.runner.batch; -import java.util.Collections; import java.util.Properties; import org.junit.Test; import org.sonar.batch.bootstrapper.Batch; @@ -38,7 +37,7 @@ public class IsolatedLauncherTest { props.setProperty("sonar.projectName", "Sample"); props.setProperty("sonar.projectVersion", "1.0"); props.setProperty("sonar.sources", "src"); - Batch batch = launcher.createBatch(props, Collections.emptyList(), null); + Batch batch = launcher.createBatch(props, null); assertThat(batch).isNotNull(); } |