aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-04-27 15:39:59 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-04-27 15:40:08 +0400
commit70c03e6ac1e0f24277655f9e7666142d9418d270 (patch)
tree5ed11a7c494df28a3da19f1354e04eda14760a76 /sonar-batch
parent91b014e384b0c4d776c807cbd27dc92a70e708d3 (diff)
downloadsonarqube-70c03e6ac1e0f24277655f9e7666142d9418d270.tar.gz
sonarqube-70c03e6ac1e0f24277655f9e7666142d9418d270.zip
SONAR-2266 ProjectFileSystem should return only existing source and test directories
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java
index 1270074570c..00c85b67ccb 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java
@@ -19,6 +19,8 @@
*/
package org.sonar.batch;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
import org.apache.commons.io.FileUtils;
import org.apache.maven.project.MavenProject;
import org.sonar.api.resources.DefaultProjectFileSystem;
@@ -83,12 +85,14 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem {
}
public List<File> getSourceDirs() {
+ List<File> unfiltered;
if (pom != null) {
// Maven can modify source directories during Sonar execution - see MavenPhaseExecutor.
- return resolvePaths(pom.getCompileSourceRoots());
+ unfiltered = resolvePaths(pom.getCompileSourceRoots());
} else {
- return resolvePaths(def.getSourceDirs());
+ unfiltered = resolvePaths(def.getSourceDirs());
}
+ return ImmutableList.copyOf(Iterables.filter(unfiltered, DIRECTORY_EXISTS));
}
/**
@@ -111,12 +115,14 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem {
* Maven can modify test directories during Sonar execution - see MavenPhaseExecutor.
*/
public List<File> getTestDirs() {
+ List<File> unfiltered;
if (pom != null) {
// Maven can modify test directories during Sonar execution - see MavenPhaseExecutor.
- return resolvePaths(pom.getTestCompileSourceRoots());
+ unfiltered = resolvePaths(pom.getTestCompileSourceRoots());
} else {
- return resolvePaths(def.getTestDirs());
+ unfiltered = resolvePaths(def.getTestDirs());
}
+ return ImmutableList.copyOf(Iterables.filter(unfiltered, DIRECTORY_EXISTS));
}
/**