aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-07-22 09:51:55 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-07-22 09:56:29 +0200
commitd34d7b471485298abc3c268b171882c73fbd778d (patch)
tree60e5e98ff34455ea7e3e8b9262dea8a95fea4853 /sonar-batch/src
parentd2a6cb9963b8c6dd89620a7c50fcdc5b5645ec75 (diff)
downloadsonarqube-d34d7b471485298abc3c268b171882c73fbd778d.tar.gz
sonarqube-d34d7b471485298abc3c268b171882c73fbd778d.zip
SONAR-5477 Load global referentials earlier
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java9
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java12
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java42
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/referential/DefaultGlobalReferentialsLoader.java67
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java28
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/referential/GlobalReferentialsLoader.java28
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/referential/GlobalReferentialsProvider.java30
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java4
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/measure/DefaultMetricFinder.java6
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java6
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan2/ProjectScanContainer.java2
11 files changed, 180 insertions, 54 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java
index daa6210cd1f..d7d866f3d79 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BootstrapContainer.java
@@ -36,7 +36,10 @@ import org.sonar.batch.components.PastSnapshotFinderByDays;
import org.sonar.batch.components.PastSnapshotFinderByPreviousAnalysis;
import org.sonar.batch.components.PastSnapshotFinderByPreviousVersion;
import org.sonar.batch.components.PastSnapshotFinderByVersion;
+import org.sonar.batch.referential.DefaultGlobalReferentialsLoader;
import org.sonar.batch.referential.DefaultProjectReferentialsLoader;
+import org.sonar.batch.referential.GlobalReferentialsLoader;
+import org.sonar.batch.referential.GlobalReferentialsProvider;
import org.sonar.batch.referential.ProjectReferentialsLoader;
import org.sonar.batch.settings.DefaultSettingsReferential;
import org.sonar.batch.settings.SettingsReferential;
@@ -103,13 +106,17 @@ public class BootstrapContainer extends ComponentContainer {
HttpDownloader.class,
UriReader.class,
new FileCacheProvider(),
- System2.INSTANCE);
+ System2.INSTANCE,
+ new GlobalReferentialsProvider());
if (getComponentByType(SettingsReferential.class) == null) {
add(DefaultSettingsReferential.class);
}
if (getComponentByType(PluginsReferential.class) == null) {
add(DefaultPluginsReferential.class);
}
+ if (getComponentByType(GlobalReferentialsLoader.class) == null) {
+ add(DefaultGlobalReferentialsLoader.class);
+ }
if (getComponentByType(ProjectReferentialsLoader.class) == null) {
add(DefaultProjectReferentialsLoader.class);
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java
index e7fd8427a2d..c29b5aa98bc 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java
@@ -31,6 +31,8 @@ import org.sonar.batch.bootstrapper.EnvironmentInformation;
import org.sonar.batch.scan.DeprecatedProjectReactorBuilder;
import org.sonar.batch.scan.ProjectReactorBuilder;
import org.sonar.batch.scan.ScanTask;
+import org.sonar.batch.scan.measure.DefaultMetricFinder;
+import org.sonar.batch.scan.measure.DeprecatedMetricFinder;
import org.sonar.batch.tasks.ListTask;
import org.sonar.batch.tasks.Tasks;
import org.sonar.core.permission.PermissionFacade;
@@ -54,11 +56,21 @@ public class TaskContainer extends ComponentContainer {
installCoreTasks();
installTaskExtensions();
installComponentsUsingTaskExtensions();
+ addCoreComponents();
for (Object component : components) {
add(component);
}
}
+ private void addCoreComponents() {
+ // Metrics
+ if (!getParent().getComponentByType(AnalysisMode.class).isSensorMode()) {
+ add(DeprecatedMetricFinder.class);
+ }
+ add(DefaultMetricFinder.class);
+
+ }
+
void installCoreTasks() {
add(new TaskProperties(taskProperties, getParent().getComponentByType(BootstrapProperties.class).property(CoreProperties.ENCRYPTION_SECRET_KEY_PATH)));
add(
diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java
index 70a509bb22f..5eaa1ee13a4 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java
@@ -35,7 +35,9 @@ import org.sonar.batch.bootstrap.PluginsReferential;
import org.sonar.batch.bootstrapper.Batch;
import org.sonar.batch.bootstrapper.EnvironmentInformation;
import org.sonar.batch.protocol.input.ActiveRule;
+import org.sonar.batch.protocol.input.GlobalReferentials;
import org.sonar.batch.protocol.input.ProjectReferentials;
+import org.sonar.batch.referential.GlobalReferentialsLoader;
import org.sonar.batch.referential.ProjectReferentialsLoader;
import org.sonar.batch.scan.filesystem.InputFileCache;
import org.sonar.batch.scan2.AnalyzerIssueCache;
@@ -65,7 +67,8 @@ public class BatchMediumTester {
}
public static class BatchMediumTesterBuilder {
- private final FakeProjectReferentialsLoader refProvider = new FakeProjectReferentialsLoader();
+ private final FakeGlobalReferentialsLoader globalRefProvider = new FakeGlobalReferentialsLoader();
+ private final FakeProjectReferentialsLoader projectRefProvider = new FakeProjectReferentialsLoader();
private final FakeSettingsReferential settingsReferential = new FakeSettingsReferential();
private final FackPluginsReferential pluginsReferential = new FackPluginsReferential();
private final Map<String, String> bootstrapProperties = new HashMap<String, String>();
@@ -92,12 +95,12 @@ public class BatchMediumTester {
}
public BatchMediumTesterBuilder registerMetric(Metric<?> metric) {
- refProvider.add(metric);
+ globalRefProvider.add(metric);
return this;
}
public BatchMediumTesterBuilder addQProfile(String language, String name) {
- refProvider.addQProfile(language, name);
+ projectRefProvider.addQProfile(language, name);
return this;
}
@@ -113,7 +116,7 @@ public class BatchMediumTester {
}
public BatchMediumTesterBuilder activateRule(ActiveRule activeRule) {
- refProvider.addActiveRule(activeRule);
+ projectRefProvider.addActiveRule(activeRule);
return this;
}
@@ -134,7 +137,8 @@ public class BatchMediumTester {
new EnvironmentInformation("mediumTest", "1.0"),
builder.settingsReferential,
builder.pluginsReferential,
- builder.refProvider,
+ builder.globalRefProvider,
+ builder.projectRefProvider,
new DefaultDebtModel())
.setBootstrapProperties(builder.bootstrapProperties)
.build();
@@ -228,23 +232,18 @@ public class BatchMediumTester {
}
- private static class FakeProjectReferentialsLoader implements ProjectReferentialsLoader {
+ private static class FakeGlobalReferentialsLoader implements GlobalReferentialsLoader {
private int metricId = 1;
- private ProjectReferentials ref = new ProjectReferentials();
+ private GlobalReferentials ref = new GlobalReferentials();
@Override
- public ProjectReferentials load(ProjectReactor reactor, Settings settings, Languages languages) {
+ public GlobalReferentials load() {
return ref;
}
- public FakeProjectReferentialsLoader addQProfile(String language, String name) {
- ref.addQProfile(new org.sonar.batch.protocol.input.QProfile(name, name, language, new Date()));
- return this;
- }
-
- public FakeProjectReferentialsLoader add(Metric metric) {
+ public FakeGlobalReferentialsLoader add(Metric metric) {
ref.metrics().add(new org.sonar.batch.protocol.input.Metric(metricId,
metric.key(),
metric.getType().name(),
@@ -259,6 +258,21 @@ public class BatchMediumTester {
metricId++;
return this;
}
+ }
+
+ private static class FakeProjectReferentialsLoader implements ProjectReferentialsLoader {
+
+ private ProjectReferentials ref = new ProjectReferentials();
+
+ @Override
+ public ProjectReferentials load(ProjectReactor reactor, Settings settings, Languages languages) {
+ return ref;
+ }
+
+ public FakeProjectReferentialsLoader addQProfile(String language, String name) {
+ ref.addQProfile(new org.sonar.batch.protocol.input.QProfile(name, name, language, new Date()));
+ return this;
+ }
public FakeProjectReferentialsLoader addActiveRule(ActiveRule activeRule) {
ref.addActiveRule(activeRule);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultGlobalReferentialsLoader.java b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultGlobalReferentialsLoader.java
new file mode 100644
index 00000000000..ec7e93382eb
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultGlobalReferentialsLoader.java
@@ -0,0 +1,67 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.batch.referential;
+
+import org.sonar.api.measures.Metric;
+import org.sonar.batch.protocol.input.GlobalReferentials;
+import org.sonar.jpa.session.DatabaseSessionFactory;
+
+import java.util.Collection;
+
+/**
+ * TODO This is currently implemented by accessing DB but should be replaced by WS call
+ */
+public class DefaultGlobalReferentialsLoader implements GlobalReferentialsLoader {
+
+ private static final String ENABLED = "enabled";
+
+ private final DatabaseSessionFactory sessionFactory;
+
+ public DefaultGlobalReferentialsLoader(DatabaseSessionFactory sessionFactory) {
+ this.sessionFactory = sessionFactory;
+ }
+
+ @Override
+ public GlobalReferentials load() {
+ GlobalReferentials ref = new GlobalReferentials();
+ for (Metric m : sessionFactory.getSession().getResults(Metric.class, ENABLED, true)) {
+ Boolean optimizedBestValue = m.isOptimizedBestValue();
+ Boolean qualitative = m.getQualitative();
+ Boolean userManaged = m.getUserManaged();
+ ref.metrics().add(
+ new org.sonar.batch.protocol.input.Metric(m.getId(), m.getKey(),
+ m.getType().name(),
+ m.getDescription(),
+ m.getDirection(),
+ m.getName(),
+ qualitative != null ? m.getQualitative() : false,
+ userManaged != null ? m.getUserManaged() : false,
+ m.getWorstValue(),
+ m.getBestValue(),
+ optimizedBestValue != null ? optimizedBestValue : false));
+ }
+
+ return ref;
+ }
+
+ private Collection<Metric> doFindAll() {
+ return sessionFactory.getSession().getResults(Metric.class, ENABLED, true);
+ }
+}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java
index 558308bb8cb..3ca6ff97634 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java
@@ -24,7 +24,6 @@ import com.google.common.collect.ListMultimap;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.config.Settings;
-import org.sonar.api.measures.Metric;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.rules.Rule;
@@ -41,12 +40,9 @@ import org.sonar.core.qualityprofile.db.ActiveRuleDto;
import org.sonar.core.qualityprofile.db.ActiveRuleParamDto;
import org.sonar.core.qualityprofile.db.QualityProfileDao;
import org.sonar.core.qualityprofile.db.QualityProfileDto;
-import org.sonar.jpa.session.DatabaseSessionFactory;
import javax.annotation.CheckForNull;
-import java.util.Collection;
-
/**
* TODO This is currently implemented by accessing DB but should be replaced by WS call
*/
@@ -54,14 +50,12 @@ public class DefaultProjectReferentialsLoader implements ProjectReferentialsLoad
private static final String ENABLED = "enabled";
- private final DatabaseSessionFactory sessionFactory;
private final QualityProfileDao qualityProfileDao;
private final ActiveRuleDao activeRuleDao;
private final RuleFinder ruleFinder;
- public DefaultProjectReferentialsLoader(DatabaseSessionFactory sessionFactory, QualityProfileDao qualityProfileDao,
+ public DefaultProjectReferentialsLoader(QualityProfileDao qualityProfileDao,
ActiveRuleDao activeRuleDao, RuleFinder ruleFinder) {
- this.sessionFactory = sessionFactory;
this.qualityProfileDao = qualityProfileDao;
this.activeRuleDao = activeRuleDao;
this.ruleFinder = ruleFinder;
@@ -70,22 +64,6 @@ public class DefaultProjectReferentialsLoader implements ProjectReferentialsLoad
@Override
public ProjectReferentials load(ProjectReactor reactor, Settings settings, Languages languages) {
ProjectReferentials ref = new ProjectReferentials();
- for (Metric m : sessionFactory.getSession().getResults(Metric.class, ENABLED, true)) {
- Boolean optimizedBestValue = m.isOptimizedBestValue();
- Boolean qualitative = m.getQualitative();
- Boolean userManaged = m.getUserManaged();
- ref.metrics().add(
- new org.sonar.batch.protocol.input.Metric(m.getId(), m.getKey(),
- m.getType().name(),
- m.getDescription(),
- m.getDirection(),
- m.getName(),
- qualitative != null ? m.getQualitative() : false,
- userManaged != null ? m.getUserManaged() : false,
- m.getWorstValue(),
- m.getBestValue(),
- optimizedBestValue != null ? optimizedBestValue : false));
- }
String defaultName = settings.getString(ModuleQProfiles.SONAR_PROFILE_PROP);
@@ -158,10 +136,6 @@ public class DefaultProjectReferentialsLoader implements ProjectReferentialsLoad
return get(language, profileName);
}
- protected Collection<Metric> doFindAll() {
- return sessionFactory.getSession().getResults(Metric.class, ENABLED, true);
- }
-
public QProfile get(String language, String name) {
QualityProfileDto dto = qualityProfileDao.getByNameAndLanguage(name, language);
if (dto == null) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/referential/GlobalReferentialsLoader.java b/sonar-batch/src/main/java/org/sonar/batch/referential/GlobalReferentialsLoader.java
new file mode 100644
index 00000000000..d355867d433
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/referential/GlobalReferentialsLoader.java
@@ -0,0 +1,28 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.batch.referential;
+
+import org.sonar.batch.protocol.input.GlobalReferentials;
+
+public interface GlobalReferentialsLoader {
+
+ GlobalReferentials load();
+
+}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/referential/GlobalReferentialsProvider.java b/sonar-batch/src/main/java/org/sonar/batch/referential/GlobalReferentialsProvider.java
new file mode 100644
index 00000000000..87da7f92d65
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/referential/GlobalReferentialsProvider.java
@@ -0,0 +1,30 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.batch.referential;
+
+import org.picocontainer.injectors.ProviderAdapter;
+import org.sonar.batch.protocol.input.GlobalReferentials;
+
+public class GlobalReferentialsProvider extends ProviderAdapter {
+
+ public GlobalReferentials provide(GlobalReferentialsLoader loader) {
+ return loader.load();
+ }
+}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java
index 911aede44cc..9c2b46bf9b8 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java
@@ -70,8 +70,6 @@ import org.sonar.batch.rule.RulesProvider;
import org.sonar.batch.scan.filesystem.InputFileCache;
import org.sonar.batch.scan.maven.FakeMavenPluginExecutor;
import org.sonar.batch.scan.maven.MavenPluginExecutor;
-import org.sonar.batch.scan.measure.DefaultMetricFinder;
-import org.sonar.batch.scan.measure.DeprecatedMetricFinder;
import org.sonar.batch.scan.measure.MeasureCache;
import org.sonar.batch.source.HighlightableBuilder;
import org.sonar.batch.source.SymbolizableBuilder;
@@ -192,8 +190,6 @@ public class ProjectScanContainer extends ComponentContainer {
// Measures
MeasureCache.class,
- DeprecatedMetricFinder.class,
- DefaultMetricFinder.class,
PastMeasuresLoader.class,
// Rules
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DefaultMetricFinder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DefaultMetricFinder.java
index 4881bf8a6cd..aac335178f5 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DefaultMetricFinder.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DefaultMetricFinder.java
@@ -24,7 +24,7 @@ import com.google.common.collect.Maps;
import org.sonar.api.batch.measure.Metric;
import org.sonar.api.batch.measure.MetricFinder;
import org.sonar.api.measures.Metric.ValueType;
-import org.sonar.batch.protocol.input.ProjectReferentials;
+import org.sonar.batch.protocol.input.GlobalReferentials;
import java.util.Collection;
import java.util.List;
@@ -34,8 +34,8 @@ public class DefaultMetricFinder implements MetricFinder {
private Map<String, Metric> metricsByKey = Maps.newLinkedHashMap();
- public DefaultMetricFinder(ProjectReferentials projectReferentials) {
- for (org.sonar.batch.protocol.input.Metric metric : projectReferentials.metrics()) {
+ public DefaultMetricFinder(GlobalReferentials globalReferentials) {
+ for (org.sonar.batch.protocol.input.Metric metric : globalReferentials.metrics()) {
metricsByKey.put(metric.key(), new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), ValueType.valueOf(metric.valueType())).create());
}
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java
index 3f1ab39668d..7242f61c8ad 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/DeprecatedMetricFinder.java
@@ -24,7 +24,7 @@ import com.google.common.collect.Maps;
import org.sonar.api.measures.Metric;
import org.sonar.api.measures.Metric.ValueType;
import org.sonar.api.measures.MetricFinder;
-import org.sonar.batch.protocol.input.ProjectReferentials;
+import org.sonar.batch.protocol.input.GlobalReferentials;
import java.util.Collection;
import java.util.List;
@@ -35,8 +35,8 @@ public final class DeprecatedMetricFinder implements MetricFinder {
private Map<String, Metric> metricsByKey = Maps.newLinkedHashMap();
private Map<Integer, Metric> metricsById = Maps.newLinkedHashMap();
- public DeprecatedMetricFinder(ProjectReferentials projectReferentials) {
- for (org.sonar.batch.protocol.input.Metric metric : projectReferentials.metrics()) {
+ public DeprecatedMetricFinder(GlobalReferentials globalReferentials) {
+ for (org.sonar.batch.protocol.input.Metric metric : globalReferentials.metrics()) {
Metric hibernateMetric = new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), ValueType.valueOf(metric.valueType()))
.create()
.setDirection(metric.direction())
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/ProjectScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/ProjectScanContainer.java
index a2b602f166a..91b11ce80da 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan2/ProjectScanContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/ProjectScanContainer.java
@@ -44,7 +44,6 @@ import org.sonar.batch.scan.ProjectSettings;
import org.sonar.batch.scan.filesystem.InputFileCache;
import org.sonar.batch.scan.maven.FakeMavenPluginExecutor;
import org.sonar.batch.scan.maven.MavenPluginExecutor;
-import org.sonar.batch.scan.measure.DefaultMetricFinder;
public class ProjectScanContainer extends ComponentContainer {
public ProjectScanContainer(ComponentContainer taskContainer) {
@@ -96,7 +95,6 @@ public class ProjectScanContainer extends ComponentContainer {
DefaultLanguagesReferential.class,
// Measures
- DefaultMetricFinder.class,
AnalyzerMeasureCache.class,
// file system