diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-10-02 10:07:46 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-10-02 10:08:04 +0200 |
commit | 6e1995b2ae4a6890cfdf7d71626469380e050273 (patch) | |
tree | ddaa98f0a5f88e1ca416ee6dc8a3d73c54750f23 | |
parent | 54a3802ec94abd488a7db67efb68d0e1651b0d97 (diff) | |
download | sonarqube-6e1995b2ae4a6890cfdf7d71626469380e050273.tar.gz sonarqube-6e1995b2ae4a6890cfdf7d71626469380e050273.zip |
Fix compatibility with FileFilter extensions
3 files changed, 6 insertions, 13 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectInitializer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectInitializer.java index f6ee4c48af9..f20751864cb 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectInitializer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectInitializer.java @@ -34,19 +34,16 @@ public class ProjectInitializer implements BatchComponent { private ResourceDao resourceDao; private DryRun dryRun; - private ProjectFileSystem fileSystem; private Languages languages; - public ProjectInitializer(ResourceDao resourceDao, DryRun dryRun, ProjectFileSystem fileSystem, Languages languages) { + public ProjectInitializer(ResourceDao resourceDao, DryRun dryRun, Languages languages) { this.resourceDao = resourceDao; this.dryRun = dryRun; - this.fileSystem = fileSystem; this.languages = languages; } public void execute(Project project, ProjectSettings settings) { initLanguage(project, settings); - initFileSystem(project); } private void initLanguage(Project project, ProjectSettings settings) { @@ -63,11 +60,4 @@ public class ProjectInitializer implements BatchComponent { } } - - private void initFileSystem(Project project) { - // TODO See http://jira.codehaus.org/browse/SONAR-2126 - // previously MavenProjectBuilder was responsible for creation of ProjectFileSystem - project.setFileSystem(fileSystem); - - } } 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 7afea1cad57..c7be30c73da 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 @@ -64,6 +64,9 @@ public class DefaultProjectFileSystem implements ProjectFileSystem { public DefaultProjectFileSystem(Project project, Languages languages) { this.project = project; this.languages = languages; + // TODO See http://jira.codehaus.org/browse/SONAR-2126 + // previously MavenProjectBuilder was responsible for creation of ProjectFileSystem + project.setFileSystem(this); } public DefaultProjectFileSystem(Project project, Languages languages, FileFilter... fileFilters) { diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java index fd8f9304d53..4d083fd21da 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java @@ -177,7 +177,7 @@ public class DefaultProjectFileSystemTest { public void resolvePathShouldReturnCanonicalFile() { MavenProject pom = mock(MavenProject.class); when(pom.getBasedir()).thenReturn(new File("/project")); - Project project = new Project("").setPom(pom); + Project project = new Project("foo").setPom(pom); DefaultProjectFileSystem fs = new DefaultProjectFileSystem(project, null); assertThat(fs.resolvePath(".").getAbsolutePath(), endsWith("project")); @@ -236,7 +236,7 @@ public class DefaultProjectFileSystemTest { public void shouldExcludeDirectoriesStartingWithDot() { List<File> dirs = Arrays.asList(new File("test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src")); - List<InputFile> files = new DefaultProjectFileSystem(null, null).getFiles(dirs, Collections.<File>emptyList(), false); + List<InputFile> files = new DefaultProjectFileSystem(new Project("foo"), null).getFiles(dirs, Collections.<File>emptyList(), false); assertThat(files.size(), is(1)); assertThat(files.get(0).getRelativePath(), is("org/sonar/Included.java")); } |