Пример #1
0
  public static void touchFiles(Project project, File dir, long time, String... includes) {

    Map<String, Object> args = new HashMap<>();

    args.put("dir", dir);
    args.put("includes", Arrays.asList(includes));

    FileTree fileTree = project.fileTree(args);

    for (File file : fileTree) {
      touchFile(file, time);
    }
  }
Пример #2
0
  public static FileTree getJarsFileTree(Project project, File dir, String... excludes) {

    Map<String, Object> args = new HashMap<>();

    args.put("dir", dir);

    if (ArrayUtil.isNotEmpty(excludes)) {
      args.put("excludes", Arrays.asList(excludes));
    }

    args.put("include", "*.jar");

    return project.fileTree(args);
  }
Пример #3
0
  @InputFiles
  @SkipWhenEmpty
  public FileCollection getSourceFiles() {
    Project project = getProject();

    File sourceDir = getSourceDir();

    if (sourceDir == null) {
      return project.files();
    }

    ConfigurableFileTree configurableFileTree = project.fileTree(sourceDir);

    configurableFileTree.include(getSoySrcIncludes());
    configurableFileTree.include(getSrcIncludes());

    return configurableFileTree;
  }
Пример #4
0
  @InputFiles
  @SkipWhenEmpty
  public FileCollection getCSSFiles() {
    Project project = getProject();

    List<String> dirNames = getDirNames();
    File docrootDir = getDocrootDir();

    if (dirNames.isEmpty() || (docrootDir == null)) {
      return project.files();
    }

    Map<String, Object> args = new HashMap<>();

    args.put("dir", docrootDir);
    args.put("exclude", "**/" + _addTrailingSlash(getOutputDirName()));

    for (String dirName : dirNames) {
      dirName = dirName.replace('\\', '/');

      if (dirName.equals("/")) {
        dirName = "";
      } else {
        dirName = _removeLeadingSlash(dirName);
        dirName = _removeTrailingSlash(dirName);

        dirName += "/";
      }

      List<String> includes = new ArrayList<>(2);

      includes.add(dirName + "**/*.css");
      includes.add(dirName + "**/*.scss");

      args.put("includes", includes);
    }

    return project.fileTree(args);
  }