コード例 #1
0
  private FileTree getCompleteSourceTree() {
    FileTree javaccTaskSourceTree = getSource();
    FileTree javaTasksSourceTree = getJavaSourceTree();
    FileTree completeSourceTree = null;

    if (javaTasksSourceTree == null) {
      completeSourceTree = javaccTaskSourceTree;
    } else {
      completeSourceTree = javaccTaskSourceTree.plus(javaTasksSourceTree);
    }

    return excludeOutputDirectory(completeSourceTree);
  }
コード例 #2
0
  private FileTree getJavaSourceTree() {
    FileTree javaSourceTree = null;
    TaskCollection<JavaCompile> javaCompileTasks =
        this.getProject().getTasks().withType(JavaCompile.class);

    for (JavaCompile task : javaCompileTasks) {
      if (javaSourceTree == null) {
        javaSourceTree = task.getSource();
      } else {
        javaSourceTree = javaSourceTree.plus(task.getSource());
      }
    }

    return excludeOutputDirectory(javaSourceTree);
  }
コード例 #3
0
  private FileTree excludeOutputDirectory(FileTree sourceTree) {
    if (sourceTree == null) {
      return null;
    }

    Spec<File> outputDirectoryFilter =
        new Spec<File>() {

          @Override
          public boolean isSatisfiedBy(File file) {
            return file.getAbsolutePath().contains(getOutputDirectory().getAbsolutePath());
          }
        };

    sourceTree = sourceTree.minus(sourceTree.filter(outputDirectoryFilter)).getAsFileTree();
    return sourceTree;
  }
コード例 #4
0
 public void execute(final CopySpecResolver specResolver) {
   FileTree source = specResolver.getSource();
   source.visit(new CopyFileVisitorImpl(specResolver, action, instantiator, fileSystem));
 }