@Test public void getJavaSourceTreeExcludesOutputFolder() throws IOException { Project project = ProjectBuilder.builder().withProjectDir(testFolder.getRoot()).build(); File javaFile = addTaskWithSourceFile(project, "compileJava", "input/TestClass.java", JavaCompile.class); File outputFile = addTaskWithSourceFile(project, "compileJavaccGenerated", "output/Generated.java", JavaCompile.class); CompilerInputOutputConfiguration configuration = builder .withInputDirectory(inputDirectory) .withOutputDirectory(outputDirectory) .withJavaCompileTasks(project.getTasks().withType(JavaCompile.class)) .build(); FileTree javaSourceTree = configuration.getJavaSourceTree(); assertThat(javaSourceTree, contains(javaFile.getCanonicalFile())); assertThat(javaSourceTree, not(contains(outputFile.getCanonicalFile()))); }
@Override public FileTree getJavaSourceTree() { FileTree javaSourceTree = null; for (JavaCompile task : javaCompileTasks) { if (javaSourceTree == null) { javaSourceTree = task.getSource(); } else { javaSourceTree = javaSourceTree.plus(task.getSource()); } } return excludeOutputDirectory(javaSourceTree); }
JavaccCompilerInputOutputConfiguration implements CompilerInputOutputConfiguration { @Override public FileTree getJavaSourceTree() { FileTree javaSourceTree = null; for (JavaCompile task : javaCompileTasks) { if (javaSourceTree == null) { javaSourceTree = task.getSource(); } else { javaSourceTree = javaSourceTree.plus(task.getSource()); } } return excludeOutputDirectory(javaSourceTree); } }
JavaccCompilerInputOutputConfiguration implements CompilerInputOutputConfiguration { @Override public FileTree getJavaSourceTree() { FileTree javaSourceTree = null; for (JavaCompile task : javaCompileTasks) { if (javaSourceTree == null) { javaSourceTree = task.getSource(); } else { javaSourceTree = javaSourceTree.plus(task.getSource()); } } return excludeOutputDirectory(javaSourceTree); } JavaccCompilerInputOutputConfiguration(File inputDirectory, File outputDirectory, FileTree source, TaskCollection<JavaCompile> javaCompileTasks); }
JavaccCompilerInputOutputConfiguration implements CompilerInputOutputConfiguration { @Override public FileTree getJavaSourceTree() { FileTree javaSourceTree = null; for (JavaCompile task : javaCompileTasks) { if (javaSourceTree == null) { javaSourceTree = task.getSource(); } else { javaSourceTree = javaSourceTree.plus(task.getSource()); } } return excludeOutputDirectory(javaSourceTree); } JavaccCompilerInputOutputConfiguration(File inputDirectory, File outputDirectory, FileTree source, TaskCollection<JavaCompile> javaCompileTasks); @Override File getOutputDirectory(); @Override File getInputDirectory(); @Override File getTempOutputDirectory(); @Override FileTree getSource(); @Override FileTree getCompleteSourceTree(); @Override FileTree getJavaSourceTree(); }
JavaccCompilerInputOutputConfiguration implements CompilerInputOutputConfiguration { @Override public FileTree getJavaSourceTree() { FileTree javaSourceTree = null; for (JavaCompile task : javaCompileTasks) { if (javaSourceTree == null) { javaSourceTree = task.getSource(); } else { javaSourceTree = javaSourceTree.plus(task.getSource()); } } return excludeOutputDirectory(javaSourceTree); } JavaccCompilerInputOutputConfiguration(File inputDirectory, File outputDirectory, FileTree source, TaskCollection<JavaCompile> javaCompileTasks); @Override File getOutputDirectory(); @Override File getInputDirectory(); @Override File getTempOutputDirectory(); @Override FileTree getSource(); @Override FileTree getCompleteSourceTree(); @Override FileTree getJavaSourceTree();  }