org.gradle.api.internal.file.collections.DirectoryFileTree Java Examples

The following examples show how to use org.gradle.api.internal.file.collections.DirectoryFileTree. 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: SyncCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
}
 
Example #2
Source File: DefaultSourceDirectorySet.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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;
}
 
Example #3
Source File: SyncCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
}
 
Example #4
Source File: DefaultSourceDirectorySet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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;
}
 
Example #5
Source File: DefaultSourceDirectorySet.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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;
}
 
Example #6
Source File: SyncCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
}
 
Example #7
Source File: SyncCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
}
 
Example #8
Source File: DefaultSourceDirectorySet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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;
}
 
Example #9
Source File: DefaultSourceDirectorySet.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void resolve(FileCollectionResolveContext context) {
    for (DirectoryTree directoryTree : getSrcDirTrees()) {
        if (directoryTree.getDir().isDirectory()) {
            context.add(((DirectoryFileTree) directoryTree).filter(filter));
        }
    }
}
 
Example #10
Source File: DefaultSourceDirectorySet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void resolve(FileCollectionResolveContext context) {
    for (DirectoryTree directoryTree : getSrcDirTrees()) {
        if (directoryTree.getDir().isDirectory()) {
            context.add(((DirectoryFileTree) directoryTree).filter(filter));
        }
    }
}
 
Example #11
Source File: DefaultSourceDirectorySet.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void resolve(FileCollectionResolveContext context) {
    for (DirectoryTree directoryTree : getSrcDirTrees()) {
        if (directoryTree.getDir().isDirectory()) {
            context.add(((DirectoryFileTree) directoryTree).filter(filter));
        }
    }
}
 
Example #12
Source File: DefaultSourceDirectorySet.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void resolve(FileCollectionResolveContext context) {
    for (DirectoryTree directoryTree : getSrcDirTrees()) {
        if (directoryTree.getDir().isDirectory()) {
            context.add(((DirectoryFileTree) directoryTree).filter(filter));
        }
    }
}
 
Example #13
Source File: ArchiveFileTree.java    From gradle-plugins with MIT License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return directoryFileTreeFactory.create(getExpandedDir());
}
 
Example #14
Source File: ZipFileTree.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
 
Example #15
Source File: TarFileTree.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
 
Example #16
Source File: ZipFileTree.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
 
Example #17
Source File: TarFileTree.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
 
Example #18
Source File: TarFileTree.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
 
Example #19
Source File: ArchiveFileTree.java    From gradle-plugins with MIT License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return directoryFileTreeFactory.create(getExpandedDir());
}
 
Example #20
Source File: ZipFileTree.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
 
Example #21
Source File: TarFileTree.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}
 
Example #22
Source File: ZipFileTree.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DirectoryFileTree getMirror() {
    return new DirectoryFileTree(tmpDir);
}