diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-07-27 17:48:35 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-07-27 18:23:48 +0200 |
commit | 85bfbe28689b4276a04eeeed91b205ab76e81d06 (patch) | |
tree | 87805c76ff4f940d3bfc694dcd59d0f0da78a2eb /sonar-scanner-engine/src/main | |
parent | 79a6209eaccbc7c92631fcb14752bd149f030b28 (diff) | |
download | sonarqube-85bfbe28689b4276a04eeeed91b205ab76e81d06.tar.gz sonarqube-85bfbe28689b4276a04eeeed91b205ab76e81d06.zip |
Improve org.sonar.api.SonarRuntime
* javadoc was not up-to-date
* SensorContext has a single method #runtime() instead
of #getRuntimeApiVersion() and #getRuntimeProduct()
* deprecated SonarQubeVersion does not extend SonarRuntime
* SonarRuntime becomes an interface. Implementation is
org.sonar.api.internal.SonarRuntimeImpl for unit tests.
Diffstat (limited to 'sonar-scanner-engine/src/main')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java | 11 | ||||
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java | 10 |
2 files changed, 9 insertions, 12 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java index 605a067c66f..cb98c42d047 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java @@ -21,13 +21,14 @@ package org.sonar.scanner.bootstrap; import java.util.List; import java.util.Map; - import org.sonar.api.Plugin; -import org.sonar.api.SonarProduct; import org.sonar.api.SonarQubeSide; -import org.sonar.api.internal.SonarRuntimeFactory; +import org.sonar.api.SonarQubeVersion; +import org.sonar.api.internal.ApiVersion; +import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.utils.System2; import org.sonar.api.utils.UriReader; +import org.sonar.api.utils.Version; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.core.platform.ComponentContainer; @@ -69,6 +70,7 @@ public class GlobalContainer extends ComponentContainer { } private void addBootstrapComponents() { + Version apiVersion = ApiVersion.load(System2.INSTANCE); add( // plugins BatchPluginRepository.class, @@ -78,7 +80,8 @@ public class GlobalContainer extends ComponentContainer { BatchPluginPredicate.class, ExtensionInstaller.class, - SonarRuntimeFactory.create(System2.INSTANCE, SonarProduct.SONARQUBE, SonarQubeSide.SCANNER), + new SonarQubeVersion(apiVersion), + SonarRuntimeImpl.forSonarQube(apiVersion, SonarQubeSide.SCANNER), CachesManager.class, GlobalSettings.class, new BatchWsClientProvider(), diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java index d3cb867c509..f19633527af 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java @@ -20,7 +20,6 @@ package org.sonar.scanner.sensor; import java.io.Serializable; -import org.sonar.api.SonarProduct; import org.sonar.api.SonarRuntime; import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.fs.FileSystem; @@ -100,13 +99,8 @@ public class DefaultSensorContext implements SensorContext { } @Override - public Version getRuntimeApiVersion() { - return sonarRuntime.getApiVersion(); - } - - @Override - public SonarProduct getRuntimeProduct() { - return sonarRuntime.getProduct(); + public SonarRuntime runtime() { + return sonarRuntime; } @Override |