]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-926 drop support in multi-lang projects of methods shouldExecuteOnProject(...
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 4 Feb 2014 16:59:40 +0000 (17:59 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 4 Feb 2014 17:00:18 +0000 (18:00 +0100)
sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java

index 987a63f51469b6d1b7d3f35d2e8d73c8d97e6922..d9ecbb18b17e5ca38499bcb193bf27b9b7695bc8 100644 (file)
@@ -50,10 +50,9 @@ public class SensorsExecutor implements BatchComponent {
   private BatchExtensionDictionnary selector;
   private final DatabaseSession session;
   private final SensorMatcher sensorMatcher;
-  private final DefaultModuleLanguages moduleLanguages;
 
   public SensorsExecutor(BatchExtensionDictionnary selector, Project project, DefaultModuleFileSystem fs, MavenPluginExecutor mavenExecutor, EventBus eventBus,
-    DatabaseSession session, SensorMatcher sensorMatcher, DefaultModuleLanguages moduleLanguages) {
+    DatabaseSession session, SensorMatcher sensorMatcher) {
     this.selector = selector;
     this.mavenExecutor = mavenExecutor;
     this.eventBus = eventBus;
@@ -61,7 +60,6 @@ public class SensorsExecutor implements BatchComponent {
     this.fs = fs;
     this.session = session;
     this.sensorMatcher = sensorMatcher;
-    this.moduleLanguages = moduleLanguages;
   }
 
   public void execute(SensorContext context) {
@@ -74,22 +72,6 @@ public class SensorsExecutor implements BatchComponent {
 
       if (sensor.shouldExecuteOnProject(module)) {
         executeSensor(context, sensor);
-      } else {
-        // For backward compatibility try to execute Sensor for each language until it is executed once (or never)
-        String oldLanguageKey = module.getLanguageKey();
-        Language oldLanguage = module.getLanguage();
-        for (Language language : moduleLanguages.languages()) {
-          module.setLanguage(language);
-          module.getConfiguration().setProperty(CoreProperties.PROJECT_LANGUAGE_PROPERTY, language.getKey());
-          if (sensor.shouldExecuteOnProject(module)) {
-            LOG.warn("Sensor {} should be updated to not depends on deprecated Project::getLanguage or Project::getLanguageKey", sensor);
-            executeSensor(context, sensor);
-            break;
-          }
-        }
-        // Restore module language
-        module.setLanguage(oldLanguage);
-        module.getConfiguration().setProperty(CoreProperties.PROJECT_LANGUAGE_PROPERTY, oldLanguageKey);
       }
     }