diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-01-24 01:42:22 +0300 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-01-24 01:54:29 +0300 |
commit | fe9937de8631f275d52a00db06eb92a0ab668a37 (patch) | |
tree | e8039bbdd982e362679cdf0e82da3a643c4e6d9f /sonar-plugin-api | |
parent | 6b5035087075113699015583fd4d76b75bf36894 (diff) | |
download | sonarqube-fe9937de8631f275d52a00db06eb92a0ab668a37.tar.gz sonarqube-fe9937de8631f275d52a00db06eb92a0ab668a37.zip |
SONAR-2126: Partially revert previous changes
* Maven can modify source directories during Sonar execution
via see MavenPhaseExecutor.
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultProjectFileSystem.java | 15 | ||||
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/test/MavenTestUtils.java | 6 |
2 files changed, 10 insertions, 11 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultProjectFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultProjectFileSystem.java index 45c1bbcabec..08ef181bf1d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultProjectFileSystem.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultProjectFileSystem.java @@ -51,7 +51,6 @@ public class DefaultProjectFileSystem implements ProjectFileSystem { private File basedir; private File buildDir; - private List<File> sourceDirs = Lists.newArrayList(); private List<File> testDirs = Lists.newArrayList(); public DefaultProjectFileSystem(Project project) { @@ -98,27 +97,33 @@ public class DefaultProjectFileSystem implements ProjectFileSystem { return resolvePath(project.getConfiguration().getString("project.build.outputDirectory")); } + /** + * Maven can modify source directories during Sonar execution - see MavenPhaseExecutor. + */ public List<File> getSourceDirs() { - return sourceDirs; + return resolvePaths(project.getPom().getCompileSourceRoots()); } public DefaultProjectFileSystem addSourceDir(File dir) { if (dir == null) { throw new IllegalArgumentException("Can not add null to project source dirs"); } - sourceDirs.add(dir); + project.getPom().getCompileSourceRoots().add(0, dir.getAbsolutePath()); return this; } + /** + * Maven can modify test directories during Sonar execution - see MavenPhaseExecutor. + */ public List<File> getTestDirs() { - return testDirs; + return resolvePaths(project.getPom().getTestCompileSourceRoots()); } public DefaultProjectFileSystem addTestDir(File dir) { if (dir == null) { throw new IllegalArgumentException("Can not add null to project test dirs"); } - testDirs.add(dir); + project.getPom().getTestCompileSourceRoots().add(0, dir.getAbsolutePath()); return this; } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/test/MavenTestUtils.java b/sonar-plugin-api/src/test/java/org/sonar/api/test/MavenTestUtils.java index 3afd4569eb8..cd193541562 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/test/MavenTestUtils.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/test/MavenTestUtils.java @@ -69,12 +69,6 @@ public final class MavenTestUtils { .setConfiguration(new MapConfiguration(pom.getProperties())); DefaultProjectFileSystem fs = new DefaultProjectFileSystem(project); project.setFileSystem(fs); - for (File dir : fs.resolvePaths(project.getPom().getCompileSourceRoots())) { - fs.addSourceDir(dir); - } - for (File dir : fs.resolvePaths(project.getPom().getTestCompileSourceRoots())) { - fs.addTestDir(dir); - } project.getConfiguration().setProperty("project.build.outputDirectory", pom.getBuild().getOutputDirectory()); if (pom.getReporting() != null) { project.getConfiguration().setProperty("project.reporting.outputDirectory", pom.getReporting().getOutputDirectory()); |