summaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-10-16 15:36:20 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-10-16 15:36:29 +0200
commit325dc6593f008727bce103ed95b3f0abd7870465 (patch)
treec19debfb5ba5398fb199738b01bcac3a27e5e98e /sonar-batch
parent18a4c15b060d1b56f08826bf6006d08eaf2625ec (diff)
downloadsonarqube-325dc6593f008727bce103ed95b3f0abd7870465.tar.gz
sonarqube-325dc6593f008727bce103ed95b3f0abd7870465.zip
Experimental detection of source dir changes - no unit tests yet
Waiting for integration tests to pass before going further
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java7
1 files changed, 7 insertions, 0 deletions
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 b1b75858284..46f28c45b97 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
@@ -58,6 +58,7 @@ public class DefaultModuleFileSystem implements ModuleFileSystem, Startable {
private List<File> sourceFiles = Lists.newArrayList();
private List<File> testFiles = Lists.newArrayList();
private AnalysisMode analysisMode;
+ private boolean dirsChanged = false;
public DefaultModuleFileSystem(ProjectDefinition module, Settings settings, FileIndex index, ModuleFileSystemInitializer initializer, AnalysisMode analysisMode) {
this(module.getKey(), settings, index, initializer, analysisMode);
@@ -129,6 +130,7 @@ public class DefaultModuleFileSystem implements ModuleFileSystem, Startable {
@Deprecated
void addSourceDir(File dir) {
sourceDirs.add(dir);
+ dirsChanged = true;
}
/**
@@ -137,6 +139,7 @@ public class DefaultModuleFileSystem implements ModuleFileSystem, Startable {
@Deprecated
void addTestDir(File dir) {
testDirs.add(dir);
+ dirsChanged = true;
}
@Override
@@ -160,6 +163,10 @@ public class DefaultModuleFileSystem implements ModuleFileSystem, Startable {
*/
@Override
public Iterable<InputFile> inputFiles(FileQuery query) {
+ if (dirsChanged) {
+ index();
+ dirsChanged = false;
+ }
List<InputFile> result = Lists.newArrayList();
FileQueryFilter filter = new FileQueryFilter(analysisMode, query);
for (InputFile input : index.inputFiles(moduleKey)) {