Java 类org.gradle.api.internal.file.collections.DirectoryFileTree 实例源码

项目:Reer    文件:SyncCopyActionDecorator.java   
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited, preserveSpec);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
项目:Pushjet-Android    文件:SyncCopyActionDecorator.java   
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
项目:Pushjet-Android    文件:SyncCopyActionDecorator.java   
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
项目:Reer    文件:PackageListGenerator.java   
private void processDirectory(File file, final Trie.Builder builder) {
    new DirectoryFileTree(file).visit(new FileVisitor() {
        @Override
        public void visitDir(FileVisitDetails dirDetails) {
        }

        @Override
        public void visitFile(FileVisitDetails fileDetails) {
            try {
                ZipEntry zipEntry = new ZipEntry(fileDetails.getPath());
                InputStream inputStream = fileDetails.open();
                try {
                    processEntry(zipEntry, builder);
                } finally {
                    inputStream.close();
                }
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }
    });
}
项目:Reer    文件:AntFileSetBuilder.java   
@Override
public Object addToAntBuilder(final Object node, String nodeName) {
    final DynamicObject dynamicObject = new BeanDynamicObject(node);
    for (final DirectoryFileTree tree : trees) {
        if (!tree.getDir().exists()) {
            continue;
        }

        dynamicObject.invokeMethod(nodeName == null ? "fileset" : nodeName, Collections.singletonMap("dir", AntUtil.maskFilename(tree.getDir().getAbsolutePath())), new Closure<Void>(this) {
            public Object doCall(Object ignore) {
                return tree.getPatternSet().addToAntBuilder(node, null);
            }
        });
    }
    return null;
}
项目:gradle-profiling    文件:FileSystemOperationsInterceptor.java   
public static void install() {
    ByteBuddyAgent.install();

    ClassLoader targetClassLoader = File.class.getClassLoader();

    // interceptor class must be injected to the same classloader as the target class that is intercepted
    new ByteBuddy().redefine(CountFileSystemOperations.class)
            .make()
            .load(targetClassLoader,
                    ClassReloadingStrategy.fromInstalledAgent());

    new ByteBuddy().redefine(DirectoryFileTree.class)
            .visit(new AsmVisitorWrapper.ForDeclaredMethods().writerFlags(ClassWriter.COMPUTE_FRAMES)
                    .method(ElementMatchers.named("length"), Advice.to(CountFileSystemOperations.LengthMethod.class))
                    .method(ElementMatchers.named("isFile"), Advice.to(CountFileSystemOperations.IsFileMethod.class))
                    .method(ElementMatchers.named("isDirectory"), Advice.to(CountFileSystemOperations.IsDirectoryMethod.class))
                    .method(ElementMatchers.named("lastModified"), Advice.to(CountFileSystemOperations.LastModifiedMethod.class))
                    .method(ElementMatchers.named("exists"), Advice.to(CountFileSystemOperations.ExistsMethod.class))

            )
            .make()
            .load(targetClassLoader,
                    ClassReloadingStrategy.fromInstalledAgent());
}
项目:gradle-profiling    文件:DirectoryScanningInterceptor.java   
public static void install() {
    ByteBuddyAgent.install();

    ClassLoader targetClassLoader = DirectoryFileTree.class.getClassLoader();

    // interceptor class must be injected to the same classloader as the target class that is intercepted
    new ByteBuddy().redefine(CountDirectoryScans.class)
            .make()
            .load(targetClassLoader,
                    ClassReloadingStrategy.fromInstalledAgent());

    new ByteBuddy().redefine(DirectoryFileTree.class)
            .visit(new AsmVisitorWrapper.ForDeclaredMethods().writerFlags(ClassWriter.COMPUTE_FRAMES).method(ElementMatchers.named("visitFrom"), Advice.to(CountDirectoryScans.class)))
            .make()
            .load(targetClassLoader,
                    ClassReloadingStrategy.fromInstalledAgent());
}
项目:Pushjet-Android    文件:DefaultSourceDirectorySet.java   
private Set<DirectoryTree> doGetSrcDirTrees() {
    Set<DirectoryTree> result = new LinkedHashSet<DirectoryTree>();
    for (Object path : source) {
        if (path instanceof SourceDirectorySet) {
            SourceDirectorySet nested = (SourceDirectorySet) path;
            result.addAll(nested.getSrcDirTrees());
        } else {
            File srcDir = fileResolver.resolve(path);
            if (srcDir.exists() && !srcDir.isDirectory()) {
                throw new InvalidUserDataException(String.format("Source directory '%s' is not a directory.", srcDir));
            }
            result.add(new DirectoryFileTree(srcDir, patterns));
        }
    }
    return result;
}
项目:Pushjet-Android    文件:DefaultSourceDirectorySet.java   
private Set<DirectoryTree> doGetSrcDirTrees() {
    Set<DirectoryTree> result = new LinkedHashSet<DirectoryTree>();
    for (Object path : source) {
        if (path instanceof SourceDirectorySet) {
            SourceDirectorySet nested = (SourceDirectorySet) path;
            result.addAll(nested.getSrcDirTrees());
        } else {
            File srcDir = fileResolver.resolve(path);
            if (srcDir.exists() && !srcDir.isDirectory()) {
                throw new InvalidUserDataException(String.format("Source directory '%s' is not a directory.", srcDir));
            }
            result.add(new DirectoryFileTree(srcDir, patterns));
        }
    }
    return result;
}
项目:Reer    文件:DefaultClasspathSnapshotter.java   
@Override
protected void visitDirectoryTree(DirectoryFileTree directoryTree, List<DefaultFileDetails> fileTreeElements) {
    // Sort non-root elements as their order is not important
    List<DefaultFileDetails> subElements = Lists.newArrayList();
    super.visitDirectoryTree(directoryTree, subElements);
    Collections.sort(subElements, FILE_DETAILS_COMPARATOR);
    fileTreeElements.addAll(subElements);
}
项目:Reer    文件:CompositeFileCollection.java   
@Override
protected Collection<DirectoryFileTree> getAsFileTrees() {
    List<DirectoryFileTree> fileTree = new ArrayList<DirectoryFileTree>();
    for (FileCollection source : getSourceCollections()) {
        AbstractFileCollection collection = (AbstractFileCollection) source;
        fileTree.addAll(collection.getAsFileTrees());
    }
    return fileTree;
}
项目:Reer    文件:AbstractFileCollection.java   
/**
 * Returns this collection as a set of {@link DirectoryFileTree} instances.
 */
protected Collection<DirectoryFileTree> getAsFileTrees() {
    List<DirectoryFileTree> fileTrees = new ArrayList<DirectoryFileTree>();
    for (File file : getFiles()) {
        if (file.isFile()) {
            fileTrees.add(new FileBackedDirectoryFileTree(file));
        }
    }
    return fileTrees;
}
项目:Pushjet-Android    文件:DefaultSourceDirectorySet.java   
@Override
public void resolve(FileCollectionResolveContext context) {
    for (DirectoryTree directoryTree : getSrcDirTrees()) {
        if (directoryTree.getDir().isDirectory()) {
            context.add(((DirectoryFileTree) directoryTree).filter(filter));
        }
    }
}
项目:Pushjet-Android    文件:DefaultSourceDirectorySet.java   
@Override
public void resolve(FileCollectionResolveContext context) {
    for (DirectoryTree directoryTree : getSrcDirTrees()) {
        if (directoryTree.getDir().isDirectory()) {
            context.add(((DirectoryFileTree) directoryTree).filter(filter));
        }
    }
}
项目:Reer    文件:AbstractFileCollectionSnapshotter.java   
@Override
public void visitDirectoryTree(DirectoryFileTree directoryTree) {
    AbstractFileCollectionSnapshotter.this.visitDirectoryTree(directoryTree, fileTreeElements);
}
项目:Reer    文件:AbstractFileCollectionSnapshotter.java   
protected void visitDirectoryTree(DirectoryFileTree directoryTree, List<DefaultFileDetails> fileTreeElements) {
    directoryTree.visit(new FileVisitorImpl(fileTreeElements));
}
项目:Reer    文件:AntFileSetBuilder.java   
public AntFileSetBuilder(Iterable<DirectoryFileTree> trees) {
    this.trees = trees;
}
项目:Reer    文件:DefaultSourceDirectorySet.java   
@Override
public void visitContents(FileCollectionResolveContext context) {
    for (DirectoryTree directoryTree : doGetSrcDirTrees()) {
        context.add(((DirectoryFileTree) directoryTree).filter(filter));
    }
}
项目:Reer    文件:AntFileCollectionMatchingTaskBuilder.java   
public AntFileCollectionMatchingTaskBuilder(Iterable<DirectoryFileTree> fileTrees) {
    this.fileTrees = fileTrees;
}
项目:Pushjet-Android    文件:TarFileTree.java   
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
项目:Pushjet-Android    文件:ZipFileTree.java   
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
项目:Pushjet-Android    文件:TarFileTree.java   
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
项目:Pushjet-Android    文件:ZipFileTree.java   
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
项目:Reer    文件:FileCollectionVisitor.java   
void visitDirectoryTree(DirectoryFileTree directoryTree);