diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-06-03 14:51:14 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-06-03 14:51:14 +0200 |
commit | 1d73764b9a1e81f66d3dbeebb2fd6bdc1e05952b (patch) | |
tree | 6fa7f66b4793b2d815429f6f70a83710c52e2013 /sonar-batch | |
parent | 890614057c6ea18de733343689e8739550b82fef (diff) | |
download | sonarqube-1d73764b9a1e81f66d3dbeebb2fd6bdc1e05952b.tar.gz sonarqube-1d73764b9a1e81f66d3dbeebb2fd6bdc1e05952b.zip |
Allow to manually define source files to analyze
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java | 17 | ||||
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrapper/ProjectDefinition.java | 4 |
2 files changed, 17 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 baa4e2394ec..632ee139c8c 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java +++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectFileSystem2.java @@ -21,6 +21,7 @@ package org.sonar.batch; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import org.apache.commons.io.FileUtils; import org.apache.maven.project.MavenProject; import org.sonar.api.batch.bootstrap.ProjectDefinition; @@ -31,6 +32,7 @@ import org.sonar.api.utils.SonarException; import java.io.File; import java.io.IOException; +import java.util.Collections; import java.util.List; /** @@ -84,6 +86,7 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { } } + @Override public List<File> getSourceDirs() { List<File> unfiltered; if (pom != null) { @@ -106,7 +109,7 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { if (pom != null) { pom.getCompileSourceRoots().add(0, dir.getAbsolutePath()); } else { - def.addSourceDir(dir.getAbsolutePath()); + def.addSourceDirs(dir.getAbsolutePath()); } return this; } @@ -114,6 +117,7 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { /** * Maven can modify test directories during Sonar execution - see MavenPhaseExecutor. */ + @Override public List<File> getTestDirs() { List<File> unfiltered; if (pom != null) { @@ -136,7 +140,7 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { if (pom != null) { pom.getTestCompileSourceRoots().add(0, dir.getAbsolutePath()); } else { - def.addTestDir(dir.getAbsolutePath()); + def.addTestDirs(dir.getAbsolutePath()); } return this; } @@ -168,4 +172,13 @@ public class DefaultProjectFileSystem2 extends DefaultProjectFileSystem { return dir; } + @Override + protected List<File> getInitialSourceFiles() { + return resolvePaths(def.getSourceFiles()); + } + + @Override + protected List<File> getInitialTestFiles() { + return resolvePaths(def.getTestFiles()); + } } diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/ProjectDefinition.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/ProjectDefinition.java index e24d078f172..f3fbe726c9f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/ProjectDefinition.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/ProjectDefinition.java @@ -62,7 +62,7 @@ public class ProjectDefinition { } public void addSourceDir(String path) { - target.addSourceDir(path); + target.addSourceDirs(path); } public List<String> getTestDirs() { @@ -74,7 +74,7 @@ public class ProjectDefinition { * It can be absolute or relative to project directory. */ public void addTestDir(String path) { - target.addTestDir(path); + target.addTestDirs(path); } public List<String> getBinaries() { |