org.gradle.api.file.EmptyFileVisitor Java Examples

The following examples show how to use org.gradle.api.file.EmptyFileVisitor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PathKeyFileStore.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Set<? extends LocallyAvailableResource> search(String pattern) {
    if (!getBaseDir().exists()) {
        return Collections.emptySet();
    }

    final Set<LocallyAvailableResource> entries = new HashSet<LocallyAvailableResource>();
    findFiles(pattern).visit(new EmptyFileVisitor() {
        public void visitFile(FileVisitDetails fileDetails) {
            final File file = fileDetails.getFile();
            // We cannot clean in progress markers, or in progress files here because
            // the file system visitor stuff can't handle the file system mutating while visiting
            if (!isInProgressMarkerFile(file) && !isInProgressFile(file)) {
                entries.add(entryAt(file));
            }
        }
    });

    return entries;
}
 
Example #2
Source File: PathKeyFileStore.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Set<? extends LocallyAvailableResource> search(String pattern) {
    if (!getBaseDir().exists()) {
        return Collections.emptySet();
    }

    final Set<LocallyAvailableResource> entries = new HashSet<LocallyAvailableResource>();
    findFiles(pattern).visit(new EmptyFileVisitor() {
        public void visitFile(FileVisitDetails fileDetails) {
            final File file = fileDetails.getFile();
            // We cannot clean in progress markers, or in progress files here because
            // the file system visitor stuff can't handle the file system mutating while visiting
            if (!isInProgressMarkerFile(file) && !isInProgressFile(file)) {
                entries.add(entryAt(file));
            }
        }
    });

    return entries;
}
 
Example #3
Source File: PathKeyFileStore.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Set<? extends LocallyAvailableResource> search(String pattern) {
    if (!getBaseDir().exists()) {
        return Collections.emptySet();
    }

    final Set<LocallyAvailableResource> entries = new HashSet<LocallyAvailableResource>();
    findFiles(pattern).visit(new EmptyFileVisitor() {
        public void visitFile(FileVisitDetails fileDetails) {
            final File file = fileDetails.getFile();
            // We cannot clean in progress markers, or in progress files here because
            // the file system visitor stuff can't handle the file system mutating while visiting
            if (!isInProgressMarkerFile(file) && !isInProgressFile(file)) {
                entries.add(entryAt(file));
            }
        }
    });

    return entries;
}
 
Example #4
Source File: PathKeyFileStore.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Set<? extends LocallyAvailableResource> search(String pattern) {
    if (!getBaseDir().exists()) {
        return Collections.emptySet();
    }

    final Set<LocallyAvailableResource> entries = new HashSet<LocallyAvailableResource>();
    findFiles(pattern).visit(new EmptyFileVisitor() {
        public void visitFile(FileVisitDetails fileDetails) {
            final File file = fileDetails.getFile();
            // We cannot clean in progress markers, or in progress files here because
            // the file system visitor stuff can't handle the file system mutating while visiting
            if (!isInProgressMarkerFile(file) && !isInProgressFile(file)) {
                entries.add(entryAt(file));
            }
        }
    });

    return entries;
}
 
Example #5
Source File: ExtractAnnotations.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
private Pair<Collection<CompilationUnitDeclaration>, INameEnvironment> parseSources() {
    final List<ICompilationUnit> sourceUnits = Lists.newArrayListWithExpectedSize(100);

    getSource().visit(new EmptyFileVisitor() {
        @Override
        public void visitFile(FileVisitDetails fileVisitDetails) {
            File file = fileVisitDetails.getFile();
            String path = file.getPath();
            if (path.endsWith(DOT_JAVA) && file.isFile()) {
                char[] contents = new char[0];
                try {
                    contents = Util.getFileCharContent(file, encoding);
                    ICompilationUnit unit = new CompilationUnit(contents, path, encoding);
                    sourceUnits.add(unit);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }

    });

    Map<ICompilationUnit, CompilationUnitDeclaration> outputMap = Maps.newHashMapWithExpectedSize(((ArrayList<ICompilationUnit>) sourceUnits).size());
    List<String> jars = Lists.newArrayList();
    if (bootClasspath != null) {
        ((ArrayList<String>) jars).addAll(bootClasspath);
    }

    if (getClasspath() != null) {
        for (File jar : getClasspath()) {
            ((ArrayList<String>) jars).add(jar.getPath());
        }

    }


    CompilerOptions options = EcjParser.createCompilerOptions();
    options.docCommentSupport = true;// So I can find @hide

    // Note: We can *not* set options.ignoreMethodBodies=true because it disables
    // type attribution!

    long level = getLanguageLevel(getSourceCompatibility());
    options.sourceLevel = level;
    options.complianceLevel = options.sourceLevel;
    // We don't generate code, but just in case the parser consults this flag
    // and makes sure that it's not greater than the source level:
    options.targetJDK = options.sourceLevel;
    options.originalComplianceLevel = options.sourceLevel;
    options.originalSourceLevel = options.sourceLevel;
    options.inlineJsrBytecode = true;// >= 1.5

    INameEnvironment environment = EcjParser.parse(options, sourceUnits, jars, outputMap, null);
    Collection<CompilationUnitDeclaration> parsedUnits = ((HashMap<ICompilationUnit, CompilationUnitDeclaration>) outputMap).values();
    return Pair.of(parsedUnits, environment);
}