aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java6
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java9
2 files changed, 11 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java
index 60aa6c8b8ea..1c0149c1b99 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java
@@ -111,6 +111,9 @@ public final class PhaseExecutor {
executeInitializersPhase();
+ // Index and lock the filesystem
+ fs.index();
+
persistenceManager.setDelayedMode(true);
if (phases.isEnabled(Phases.Phase.SENSOR)) {
@@ -170,9 +173,8 @@ public final class PhaseExecutor {
private void executeMavenPhase(Project module) {
if (phases.isEnabled(Phases.Phase.MAVEN)) {
eventBus.fireEvent(new MavenPhaseEvent(true));
- mavenPhaseExecutor.execute(module);
- fs.index();
mavenPluginsConfigurator.execute(module);
+ mavenPhaseExecutor.execute(module);
eventBus.fireEvent(new MavenPhaseEvent(false));
}
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java
index 7d624ed8b89..f4e10352caf 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java
@@ -23,6 +23,8 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
import org.sonar.api.resources.Project;
@@ -47,6 +49,8 @@ import java.util.List;
*/
public class DefaultModuleFileSystem implements ModuleFileSystem {
+ private static final Logger LOG = LoggerFactory.getLogger(DefaultModuleFileSystem.class);
+
private final String moduleKey;
private final FileIndex index;
private final Settings settings;
@@ -165,7 +169,8 @@ public class DefaultModuleFileSystem implements ModuleFileSystem {
@Override
public Iterable<InputFile> inputFiles(FileQuery query) {
if (!initialized) {
- throw new SonarException("Module filesystem is not initialized");
+ LOG.warn("Accessing the filesystem before the Sensor phase is deprecated and will not be supported in the future. Please update your plugin.");
+ index.index(this);
}
List<InputFile> result = Lists.newArrayList();
FileQueryFilter filter = new FileQueryFilter(analysisMode, query);
@@ -200,7 +205,7 @@ public class DefaultModuleFileSystem implements ModuleFileSystem {
public void resetDirs(File basedir, File buildDir, List<File> sourceDirs, List<File> testDirs, List<File> binaryDirs) {
if (initialized) {
- throw new SonarException("Module filesystem is locked");
+ throw new SonarException("Module filesystem is already initialized. Modification of the filesystem are only allowed during Initializer phase.");
}
Preconditions.checkNotNull(basedir, "Basedir can't be null");
this.baseDir = basedir;