Ejemplo n.º 1
0
  private static ImmutableSet<PathOrGlobMatcher> extractIgnorePaths(
      final Path root, Config config) {
    ImmutableSet.Builder<PathOrGlobMatcher> builder = ImmutableSet.builder();

    builder.add(new PathOrGlobMatcher(root, ".idea"));

    final String projectKey = "project";
    final String ignoreKey = "ignore";

    String buckdDirProperty = System.getProperty(BUCK_BUCKD_DIR_KEY, ".buckd");
    if (!Strings.isNullOrEmpty(buckdDirProperty)) {
      builder.add(new PathOrGlobMatcher(root, buckdDirProperty));
    }

    Path cacheDir = getCacheDir(root, config.getValue("cache", "dir"));
    builder.add(new PathOrGlobMatcher(cacheDir));

    builder.addAll(
        FluentIterable.from(config.getListWithoutComments(projectKey, ignoreKey))
            .transform(
                new Function<String, PathOrGlobMatcher>() {
                  @Nullable
                  @Override
                  public PathOrGlobMatcher apply(String input) {
                    // We don't really want to ignore the output directory when doing things like
                    // filesystem
                    // walks, so return null
                    if (BuckConstant.BUCK_OUTPUT_DIRECTORY.equals(input)) {
                      return null; // root.getFileSystem().getPathMatcher("glob:**");
                    }

                    if (GLOB_CHARS.matcher(input).find()) {
                      return new PathOrGlobMatcher(
                          root.getFileSystem().getPathMatcher("glob:" + input), input);
                    }
                    return new PathOrGlobMatcher(root, input);
                  }
                })
            // And now remove any null patterns
            .filter(Predicates.<PathOrGlobMatcher>notNull())
            .toList());

    return builder.build();
  }
Ejemplo n.º 2
0
 public ImmutableList<String> getListWithoutComments(String section, String field) {
   return config.getListWithoutComments(section, field);
 }