src/com/google/javascript/jscomp/CommandLineRunner.java
/**
   * Returns all the JavaScript files from the set of patterns.
   *
   * @param patterns A collection of filename patterns.
   * @param sortAlphabetically Whether the output filenames should be in alphabetical order.
   * @return The list of JS filenames found by expanding the patterns.
   */
Returns all the JavaScript files from the set of patterns.
@param patterns A collection of filename patterns.
@param sortAlphabetically Whether the output filenames should be in alphabetical order.
@return The list of JS filenames found by expanding the patterns.
Returns all the JavaScript files from the set of patterns . @param patterns A collection of filename patterns . @param sortAlphabetically Whether the output filenames should be in alphabetical order . @return The list of JS filenames found by expanding the patterns .
private static List<String> findJsFiles(Collection<String> patterns, boolean sortAlphabetically)
      throws IOException {
    Map<String, String> allJsInputs = sortAlphabetically
        ? new TreeMap<>() : new LinkedHashMap<>();
    Set<String> excludes = new HashSet<>();
    for (String pattern : patterns) {
      if (!pattern.contains("*") && !pattern.startsWith("!")) {
        File matchedFile = new File(pattern);
        if (matchedFile.isDirectory()) {
          matchPaths(new File(matchedFile, "**.js").toString(), allJsInputs, excludes);
        } else {
          Path original = Paths.get(pattern);
          String pathStringAbsolute = original.normalize().toAbsolutePath().toString();
          if (!excludes.contains(pathStringAbsolute)) {
            allJsInputs.put(pathStringAbsolute, original.toString());
          }
        }
      } else {
        matchPaths(pattern, allJsInputs, excludes);
      }
    }
    return new ArrayList<>(allJsInputs.values());
  }
private static List < String > findJsFiles ( Collection < String > patterns , boolean sortAlphabetically ) throws IOException { Map < String , String > allJsInputs = sortAlphabetically ? new TreeMap < > ( ) : new LinkedHashMap < > ( ) ; Set < String > excludes = new HashSet < > ( ) ; for ( String pattern : patterns ) { if ( ! pattern . contains ( "*" ) && ! pattern . startsWith ( "!" ) ) { File matchedFile = new File ( pattern ) ; if ( matchedFile . isDirectory ( ) ) { matchPaths ( new File ( matchedFile , "**.js" ) . toString ( ) , allJsInputs , excludes ) ; } else { Path original = Paths . get ( pattern ) ; String pathStringAbsolute = original . normalize ( ) . toAbsolutePath ( ) . toString ( ) ; if ( ! excludes . contains ( pathStringAbsolute ) ) { allJsInputs . put ( pathStringAbsolute , original . toString ( ) ) ; } } } else { matchPaths ( pattern , allJsInputs , excludes ) ; } } return new ArrayList < > ( allJsInputs . values ( ) ) ; }
Returns all the JavaScript files from the set of patterns.
Returns all the JavaScript files from the set of patterns .
// A map from normalized absolute paths to original paths. We need to return original paths to // support whitelist files that depend on them.