Home | History | Annotate | Download | only in src

Lines Matching refs:File

5  * you may not use this file except in compliance with the License.
17 import java.io.File;
37 public final SortedSet<File> sourceRoots;
40 public final List<File> jarFiles;
43 public final SortedSet<File> excludedDirs;
46 public final File toolDirectory;
48 /** File name used for excluded path files. */
56 this.toolDirectory = new File("development/tools/idegen");
68 List<File> jarFiles = new ArrayList<File>(500);
69 SortedSet<File> excludedDirs = new TreeSet<File>();
70 SortedSet<File> sourceRoots = new TreeSet<File>();
72 traverse(new File("."), sourceRoots, jarFiles, excludedDirs, excludes);
91 File globalExcludes = new File(toolDirectory, EXCLUDED_PATHS);
96 File googleExcludes = new File("./vendor/google/" + EXCLUDED_PATHS);
101 // Look for user-specific excluded-paths file in current directory.
102 File localExcludes = new File(EXCLUDED_PATHS);
114 private static void traverse(File directory, Set<File> sourceRoots,
115 Collection<File> jarFiles, Collection<File> excludedDirs,
119 * we encounter the first .java file, but it appears we have nested
126 File[] files = directory.listFiles();
130 for (File file : files) {
132 String path = file.getPath().substring(2);
137 // Only parse one .java file per directory.
140 File sourceRoot = rootOf(file);
152 jarFiles.add(file);
154 Log.debug("Skipped: " + file);
161 if (file.isDirectory()) {
165 excludedDirs.add(file);
167 traverse(file, sourceRoots, jarFiles, excludedDirs,
175 * Determines the source root for a given .java file. Returns null
176 * if the file doesn't have a package or if the file isn't in the
179 private static File rootOf(File javaFile) throws IOException {
187 String packagePath = packageName.replace('.', File.separatorChar);
188 File parent = javaFile.getParentFile();
195 return new File(parentPath.substring(
200 * Reads a Java file and parses out the package name. Returns null if none
203 private static String parsePackageName(File file) throws IOException {
204 BufferedReader in = new BufferedReader(new FileReader(file));
226 public SortedSet<File> excludesUnderSourceRoots() {
229 SortedSet<File> picked = new TreeSet<File>();
230 for (File sourceRoot : sourceRoots) {
232 SortedSet<File> tailSet = excludedDirs.tailSet(sourceRoot);
233 for (File file : tailSet) {
234 if (file.getPath().startsWith(sourcePath)) {
235 picked.add(file);
245 * Reads a list of regular expressions from a file, one per line, and adds
249 * @param file containing regular expressions, one per line
250 * @param patterns collection to add compiled patterns from file to
252 public static void parseFile(File file, Collection<Pattern> patterns)
254 BufferedReader in = new BufferedReader(new FileReader(file));