diff options
Diffstat (limited to 'sonar-scanner-engine/src/main')
33 files changed, 25 insertions, 94 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/EnvironmentInformation.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/EnvironmentInformation.java index d9b86aa2c23..917a2ad621a 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/EnvironmentInformation.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/EnvironmentInformation.java @@ -19,14 +19,11 @@ */ package org.sonar.batch.bootstrapper; -import org.sonar.api.batch.ScannerSide; - /** * Describes execution environment. * * @since 2.6 */ -@ScannerSide public class EnvironmentInformation { private String key; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/DefaultFileLinesContext.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/DefaultFileLinesContext.java index ea3130d2ecd..7ef71bbb221 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/DefaultFileLinesContext.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/DefaultFileLinesContext.java @@ -27,7 +27,7 @@ import java.util.Map; import java.util.Map.Entry; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.measure.MetricFinder; -import org.sonar.api.batch.sensor.SensorContext; +import org.sonar.api.batch.sensor.internal.SensorStorage; import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.FileLinesContext; @@ -38,7 +38,6 @@ import org.sonar.scanner.scan.measure.MeasureCache; import static java.util.stream.Collectors.toMap; public class DefaultFileLinesContext implements FileLinesContext { - private final SensorContext context; private final InputFile inputFile; private final MetricFinder metricFinder; private final MeasureCache measureCache; @@ -47,9 +46,10 @@ public class DefaultFileLinesContext implements FileLinesContext { * metric key -> line -> value */ private final Map<String, Map<Integer, Object>> map = new HashMap<>(); + private final SensorStorage sensorStorage; - public DefaultFileLinesContext(SensorContext context, InputFile inputFile, MetricFinder metricFinder, MeasureCache measureCache) { - this.context = context; + public DefaultFileLinesContext(SensorStorage sensorStorage, InputFile inputFile, MetricFinder metricFinder, MeasureCache measureCache) { + this.sensorStorage = sensorStorage; this.inputFile = inputFile; this.metricFinder = metricFinder; this.measureCache = measureCache; @@ -103,7 +103,7 @@ public class DefaultFileLinesContext implements FileLinesContext { Map<Integer, Object> lines = entry.getValue(); if (shouldSave(lines)) { String data = KeyValueFormat.format(optimizeStorage(metricKey, lines)); - context.newMeasure() + new DefaultMeasure<String>(sensorStorage) .on(inputFile) .forMetric(metricFinder.findByKey(metricKey)) .withValue(data) diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/DefaultFileLinesContextFactory.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/DefaultFileLinesContextFactory.java index 01c6f9a16b2..8ed50b88710 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/DefaultFileLinesContextFactory.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/DefaultFileLinesContextFactory.java @@ -22,7 +22,7 @@ package org.sonar.scanner; import javax.annotation.concurrent.Immutable; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.measure.MetricFinder; -import org.sonar.api.batch.sensor.SensorContext; +import org.sonar.api.batch.sensor.internal.SensorStorage; import org.sonar.api.measures.FileLinesContext; import org.sonar.api.measures.FileLinesContextFactory; import org.sonar.scanner.scan.measure.MeasureCache; @@ -30,19 +30,19 @@ import org.sonar.scanner.scan.measure.MeasureCache; @Immutable public class DefaultFileLinesContextFactory implements FileLinesContextFactory { - private final SensorContext sensorContext; + private final SensorStorage sensorStorage; private final MetricFinder metricFinder; private final MeasureCache measureCache; - public DefaultFileLinesContextFactory(SensorContext sensorContext, MetricFinder metricFinder, MeasureCache measureCache) { - this.sensorContext = sensorContext; + public DefaultFileLinesContextFactory(SensorStorage sensorStorage, MetricFinder metricFinder, MeasureCache measureCache) { + this.sensorStorage = sensorStorage; this.metricFinder = metricFinder; this.measureCache = measureCache; } @Override public FileLinesContext createFor(InputFile inputFile) { - return new DefaultFileLinesContext(sensorContext, inputFile, metricFinder, measureCache); + return new DefaultFileLinesContext(sensorStorage, inputFile, metricFinder, measureCache); } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ExtensionMatcher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ExtensionMatcher.java index 81eb100aeac..7fb6b2b0960 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ExtensionMatcher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ExtensionMatcher.java @@ -19,12 +19,6 @@ */ package org.sonar.scanner.bootstrap; -import org.sonar.api.batch.ScannerSide; - -/** - * @since 3.6 - */ -@ScannerSide public interface ExtensionMatcher { boolean accept(Object extension); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/MetricProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/MetricProvider.java index 34c874b6684..5d3fb8158db 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/MetricProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/MetricProvider.java @@ -22,14 +22,12 @@ package org.sonar.scanner.bootstrap; import com.google.common.collect.Lists; import java.util.List; import org.sonar.api.ExtensionProvider; -import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Metric; import org.sonar.api.measures.Metrics; @ScannerSide -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) public class MetricProvider extends ExtensionProvider { private Metrics[] factories; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginInstaller.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginInstaller.java index cf3b1ac02b7..97e7ed86939 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginInstaller.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginInstaller.java @@ -21,9 +21,7 @@ package org.sonar.scanner.bootstrap; import java.util.List; import java.util.Map; -import org.sonar.api.batch.ScannerSide; -@ScannerSide public interface PluginInstaller { /** diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java index d3180b89f35..5baf3fe4766 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java @@ -23,7 +23,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import org.apache.commons.io.FileUtils; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.utils.ZipUtils; import org.sonar.core.platform.ExplodedPlugin; import org.sonar.core.platform.PluginInfo; @@ -31,7 +30,6 @@ import org.sonar.core.platform.PluginJarExploder; import static org.sonar.core.util.FileUtils.deleteQuietly; -@ScannerSide public class ScannerPluginJarExploder extends PluginJarExploder { private final PluginFiles pluginFiles; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginPredicate.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginPredicate.java index 678640cc45b..70b918071c1 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginPredicate.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginPredicate.java @@ -29,7 +29,6 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; import javax.annotation.Nonnull; import org.sonar.api.CoreProperties; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.config.Configuration; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; @@ -37,7 +36,6 @@ import org.sonar.api.utils.log.Loggers; /** * Filters the plugins to be enabled during analysis */ -@ScannerSide public class ScannerPluginPredicate implements Predicate<String> { private static final Logger LOG = Loggers.get(ScannerPluginPredicate.class); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java index 23370fdc0f3..810a2c37a41 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java @@ -21,7 +21,6 @@ package org.sonar.scanner.bootstrap; import org.picocontainer.injectors.ProviderAdapter; import org.sonar.api.CoreProperties; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.utils.System2; import org.sonar.batch.bootstrapper.EnvironmentInformation; import org.sonarqube.ws.client.HttpConnector; @@ -31,7 +30,6 @@ import static java.lang.Integer.parseInt; import static java.lang.String.valueOf; import static org.apache.commons.lang.StringUtils.defaultIfBlank; -@ScannerSide public class ScannerWsClientProvider extends ProviderAdapter { static final int CONNECT_TIMEOUT_MS = 5_000; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/perspectives/PerspectiveBuilder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/perspectives/PerspectiveBuilder.java index 73e089604a3..b11a852803c 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/perspectives/PerspectiveBuilder.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/perspectives/PerspectiveBuilder.java @@ -20,11 +20,9 @@ package org.sonar.scanner.deprecated.perspectives; import javax.annotation.CheckForNull; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.fs.InputComponent; import org.sonar.api.component.Perspective; -@ScannerSide public abstract class PerspectiveBuilder<T extends Perspective> { private final Class<T> perspectiveClass; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/extension/ScannerCoreExtensionsInstaller.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/extension/ScannerCoreExtensionsInstaller.java index f4825292dfd..419857e2783 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/extension/ScannerCoreExtensionsInstaller.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/extension/ScannerCoreExtensionsInstaller.java @@ -20,7 +20,7 @@ package org.sonar.scanner.extension; import org.sonar.api.SonarRuntime; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; import org.sonar.core.extension.CoreExtensionRepository; import org.sonar.core.extension.CoreExtensionsInstaller; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssueCache.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssueCache.java index fc2196ef53d..8ff0a0f5526 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssueCache.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssueCache.java @@ -20,7 +20,6 @@ package org.sonar.scanner.issue; import java.util.Collection; -import org.sonar.api.batch.ScannerSide; import org.sonar.scanner.issue.tracking.TrackedIssue; import org.sonar.scanner.storage.Storage; import org.sonar.scanner.storage.Storages; @@ -28,7 +27,6 @@ import org.sonar.scanner.storage.Storages; /** * Shared issues among all project modules */ -@ScannerSide public class IssueCache { // component key -> issue key -> issue diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/AbstractPatternInitializer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/AbstractPatternInitializer.java index 8d26bed1a9a..51058404811 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/AbstractPatternInitializer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/AbstractPatternInitializer.java @@ -24,12 +24,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; import org.apache.commons.lang.StringUtils; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.config.Configuration; import static com.google.common.base.MoreObjects.firstNonNull; -@ScannerSide public abstract class AbstractPatternInitializer { private Configuration settings; private List<IssuePattern> multicriteriaPatterns; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/IssueTransition.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/IssueTransition.java index dabba413c6c..737a4f6614a 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/IssueTransition.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/IssueTransition.java @@ -25,7 +25,6 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.fs.InputComponent; import org.sonar.api.batch.fs.internal.DefaultInputComponent; import org.sonar.core.util.CloseableIterator; @@ -38,7 +37,6 @@ import org.sonar.scanner.report.ReportPublisher; import org.sonar.scanner.scan.filesystem.InputComponentStore; import org.sonar.scanner.util.ProgressReport; -@ScannerSide public class IssueTransition { private final IssueCache issueCache; private final InputComponentStore inputComponentStore; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/ServerIssueRepository.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/ServerIssueRepository.java index be8c7908ff2..96acb3c1d94 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/ServerIssueRepository.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/ServerIssueRepository.java @@ -19,8 +19,6 @@ */ package org.sonar.scanner.issue.tracking; -import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.fs.InputComponent; import org.sonar.api.batch.fs.internal.AbstractProjectOrModule; import org.sonar.api.batch.fs.internal.DefaultInputComponent; @@ -34,8 +32,6 @@ import org.sonar.scanner.scan.filesystem.InputComponentStore; import org.sonar.scanner.storage.Storage; import org.sonar.scanner.storage.Storages; -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) -@ScannerSide public class ServerIssueRepository { private static final Logger LOG = Loggers.get(ServerIssueRepository.class); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/ServerLineHashesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/ServerLineHashesLoader.java index 291b28ba8e9..717e27b0c1e 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/ServerLineHashesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/ServerLineHashesLoader.java @@ -19,9 +19,6 @@ */ package org.sonar.scanner.issue.tracking; -import org.sonar.api.batch.ScannerSide; - -@ScannerSide public interface ServerLineHashesLoader { String[] getLineHashes(String fileKey); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/AnalysisObserver.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/AnalysisObserver.java index 59ce0f1422f..69c396540bc 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/AnalysisObserver.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/AnalysisObserver.java @@ -20,7 +20,7 @@ package org.sonar.scanner.mediumtest; import org.sonar.api.ExtensionPoint; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; import org.sonar.scanner.scan.ProjectScanContainer; @ScannerSide diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/platform/DefaultServer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/platform/DefaultServer.java index 8b53ab5e86d..dfe4993d31b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/platform/DefaultServer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/platform/DefaultServer.java @@ -24,7 +24,6 @@ import java.util.Date; import org.apache.commons.lang.StringUtils; import org.sonar.api.CoreProperties; import org.sonar.api.SonarRuntime; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.config.Configuration; import org.sonar.api.platform.Server; import org.sonar.api.utils.DateUtils; @@ -32,7 +31,6 @@ import org.sonar.scanner.bootstrap.ScannerWsClient; import static org.apache.commons.lang.StringUtils.trimToEmpty; -@ScannerSide public class DefaultServer extends Server { private final Configuration settings; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/PostJobOptimizer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/PostJobOptimizer.java index 9bcf56bb6ca..dda587711a3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/PostJobOptimizer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/PostJobOptimizer.java @@ -21,11 +21,9 @@ package org.sonar.scanner.postjob; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.postjob.internal.DefaultPostJobDescriptor; import org.sonar.api.config.Configuration; -@ScannerSide public class PostJobOptimizer { private static final Logger LOG = LoggerFactory.getLogger(PostJobOptimizer.class); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java index c0d091e824b..5c60eb4e2d2 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java @@ -32,7 +32,6 @@ import java.util.TreeSet; import org.apache.commons.lang.StringUtils; import org.sonar.api.CoreProperties; import org.sonar.api.batch.AnalysisMode; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.fs.internal.AbstractProjectOrModule; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.batch.fs.internal.InputModuleHierarchy; @@ -48,7 +47,6 @@ import org.sonar.scanner.scan.filesystem.InputComponentStore; import static java.util.stream.Collectors.toList; -@ScannerSide public class AnalysisContextReportPublisher { private static final String KEY_VALUE_FORMAT = " - %s=%s"; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java index ed2453601d1..2483a1dadc0 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java @@ -36,7 +36,6 @@ import javax.annotation.Nullable; import okhttp3.HttpUrl; import org.apache.commons.io.FileUtils; import org.picocontainer.Startable; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.fs.internal.InputModuleHierarchy; import org.sonar.api.platform.Server; import org.sonar.api.utils.MessageException; @@ -63,7 +62,6 @@ import static org.sonar.scanner.scan.branch.BranchType.LONG; import static org.sonar.scanner.scan.branch.BranchType.PULL_REQUEST; import static org.sonar.scanner.scan.branch.BranchType.SHORT; -@ScannerSide public class ReportPublisher implements Startable { private static final Logger LOG = Loggers.get(ReportPublisher.class); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/ContextPropertiesCache.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/ContextPropertiesCache.java index 60aaaa6d46c..9d363ce09a1 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/ContextPropertiesCache.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/ContextPropertiesCache.java @@ -19,14 +19,11 @@ */ package org.sonar.scanner.repository; -import static com.google.common.base.Preconditions.checkArgument; - import java.util.HashMap; import java.util.Map; -import org.sonar.api.batch.ScannerSide; +import static com.google.common.base.Preconditions.checkArgument; -@ScannerSide public class ContextPropertiesCache { private final Map<String, String> props = new HashMap<>(); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/language/LanguagesRepository.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/language/LanguagesRepository.java index f5492eb47f6..23a71432d9e 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/language/LanguagesRepository.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/language/LanguagesRepository.java @@ -20,17 +20,13 @@ package org.sonar.scanner.repository.language; import java.util.Collection; - import javax.annotation.CheckForNull; import javax.annotation.concurrent.Immutable; -import org.sonar.api.batch.ScannerSide; - /** * Languages repository * @since 4.4 */ -@ScannerSide @Immutable public interface LanguagesRepository { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java index 2199bd3de38..58ef061c2c0 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java @@ -23,9 +23,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.scan.filesystem.FileExclusions; -import org.sonar.core.extension.CoreExtensionsInstaller; import org.sonar.core.platform.ComponentContainer; -import org.sonar.scanner.DefaultFileLinesContextFactory; import org.sonar.scanner.bootstrap.ExtensionInstaller; import org.sonar.scanner.bootstrap.SensorExtensionDictionnary; import org.sonar.scanner.deprecated.perspectives.ScannerPerspectives; @@ -33,11 +31,9 @@ import org.sonar.scanner.phases.SensorsExecutor; import org.sonar.scanner.scan.filesystem.DefaultModuleFileSystem; import org.sonar.scanner.scan.filesystem.ModuleInputComponentStore; import org.sonar.scanner.sensor.DefaultSensorContext; -import org.sonar.scanner.sensor.DefaultSensorStorage; import org.sonar.scanner.sensor.SensorOptimizer; import static org.sonar.api.batch.InstantiationStrategy.PER_PROJECT; -import static org.sonar.core.extension.CoreExtensionsInstaller.noExtensionFilter; import static org.sonar.scanner.bootstrap.ExtensionUtils.isDeprecatedScannerSide; import static org.sonar.scanner.bootstrap.ExtensionUtils.isInstantiationStrategy; @@ -73,19 +69,14 @@ public class ModuleScanContainer extends ComponentContainer { SensorOptimizer.class, - DefaultSensorStorage.class, DefaultSensorContext.class, SensorExtensionDictionnary.class, // Perspectives - ScannerPerspectives.class, - - DefaultFileLinesContextFactory.class); + ScannerPerspectives.class); } private void addExtensions() { - CoreExtensionsInstaller coreExtensionsInstaller = getComponentByType(CoreExtensionsInstaller.class); - coreExtensionsInstaller.install(this, noExtensionFilter(), t -> isInstantiationStrategy(t, PER_PROJECT)); ExtensionInstaller pluginInstaller = getComponentByType(ExtensionInstaller.class); pluginInstaller.install(this, e -> isDeprecatedScannerSide(e) && isInstantiationStrategy(e, PER_PROJECT)); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java index 34024ba5c50..578f8d120de 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java @@ -36,6 +36,7 @@ import org.sonar.core.config.ScannerProperties; import org.sonar.core.extension.CoreExtensionsInstaller; import org.sonar.core.metric.ScannerMetrics; import org.sonar.core.platform.ComponentContainer; +import org.sonar.scanner.DefaultFileLinesContextFactory; import org.sonar.scanner.ProjectAnalysisInfo; import org.sonar.scanner.analysis.AnalysisTempFolderProvider; import org.sonar.scanner.analysis.DefaultAnalysisMode; @@ -121,6 +122,7 @@ import org.sonar.scanner.scan.report.JSONReport; import org.sonar.scanner.scm.ScmChangedFilesProvider; import org.sonar.scanner.scm.ScmConfiguration; import org.sonar.scanner.scm.ScmPublisher; +import org.sonar.scanner.sensor.DefaultSensorStorage; import org.sonar.scanner.storage.Storages; import static org.sonar.api.batch.InstantiationStrategy.PER_BATCH; @@ -207,7 +209,6 @@ public class ProjectScanContainer extends ComponentContainer { IssueFilters.class, IssuePublisher.class, - // metrics DefaultMetricFinder.class, @@ -268,6 +269,10 @@ public class ProjectScanContainer extends ComponentContainer { ScmConfiguration.class, ScmPublisher.class, + // Sensors + DefaultSensorStorage.class, + DefaultFileLinesContextFactory.class, + // Filesystem DefaultProjectFileSystem.class, diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ScanProperties.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ScanProperties.java index 8dceea747fc..1da90cf6bf7 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ScanProperties.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ScanProperties.java @@ -22,7 +22,6 @@ package org.sonar.scanner.scan; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Optional; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.fs.internal.DefaultInputProject; import org.sonar.api.config.Configuration; import org.sonar.api.utils.MessageException; @@ -33,7 +32,6 @@ import static org.sonar.core.config.ScannerProperties.ORGANIZATION; /** * Properties that can be passed to the scanners and are not exposed in SonarQube. */ -@ScannerSide public class ScanProperties { public static final String METADATA_FILE_PATH_KEY = "sonar.scanner.metadataFilePath"; public static final String KEEP_REPORT_PROP_KEY = "sonar.scanner.keepReport"; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfigurationLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfigurationLoader.java index 7949d5f07b4..149afa02eda 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfigurationLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfigurationLoader.java @@ -21,11 +21,9 @@ package org.sonar.scanner.scan.branch; import java.util.Map; import java.util.function.Supplier; -import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; @ScannerSide -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) public interface BranchConfigurationLoader { BranchConfiguration load(Map<String, String> localSettings, Supplier<Map<String, String>> remoteSettingsSupplier, ProjectBranches branches, ProjectPullRequests pullRequests); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java index 587e6aedb8d..fc5b955bf36 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java @@ -21,11 +21,9 @@ package org.sonar.scanner.scan.branch; import java.util.List; import javax.annotation.Nullable; -import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; @ScannerSide -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) public interface BranchParamsValidator { void validate(List<String> validationMessages, @Nullable String deprecatedBranchName); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranchesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranchesLoader.java index a7e6a2bc1bd..b06df550dd4 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranchesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranchesLoader.java @@ -19,11 +19,9 @@ */ package org.sonar.scanner.scan.branch; -import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; @ScannerSide -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) public interface ProjectBranchesLoader { /** diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequestsLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequestsLoader.java index c5af1c53375..26a12191844 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequestsLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequestsLoader.java @@ -19,11 +19,9 @@ */ package org.sonar.scanner.scan.branch; -import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; @ScannerSide -@InstantiationStrategy(InstantiationStrategy.PER_BATCH) public interface ProjectPullRequestsLoader { /** diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/MeasureCache.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/MeasureCache.java index c6a904fdfc2..68b30bf84f9 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/MeasureCache.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/MeasureCache.java @@ -21,7 +21,6 @@ package org.sonar.scanner.scan.measure; import com.google.common.base.Preconditions; import javax.annotation.CheckForNull; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.measure.MetricFinder; import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure; import org.sonar.scanner.storage.Storage; @@ -31,7 +30,6 @@ import org.sonar.scanner.storage.Storages; /** * Cache of all measures. This cache is shared amongst all project modules. */ -@ScannerSide public class MeasureCache { private final Storage<DefaultMeasure<?>> cache; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/storage/Storages.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/storage/Storages.java index 094db8539e4..23827ebe5d0 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/storage/Storages.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/storage/Storages.java @@ -31,9 +31,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import org.picocontainer.Startable; -import org.sonar.api.batch.ScannerSide; -@ScannerSide public class Storages implements Startable { private final Map<String, Exchange> cacheMap = new HashMap<>(); private Persistit persistit; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/storage/StoragesManager.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/storage/StoragesManager.java index e69493794bd..3f1b1d9dcbe 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/storage/StoragesManager.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/storage/StoragesManager.java @@ -26,7 +26,6 @@ import java.io.File; import java.util.Properties; import org.picocontainer.Startable; import org.slf4j.LoggerFactory; -import org.sonar.api.batch.ScannerSide; import org.sonar.api.utils.TempFolder; import static org.sonar.core.util.FileUtils.deleteQuietly; @@ -36,7 +35,6 @@ import static org.sonar.core.util.FileUtils.deleteQuietly; * * @since 3.6 */ -@ScannerSide public class StoragesManager implements Startable { private File tempDir; private Persistit persistit; |