Search in sources :

Example 1 with FileTreeInternal

use of org.gradle.api.internal.file.FileTreeInternal in project gradle by gradle.

the class CacheBackedTaskHistoryRepository method getDeclaredOutputFilePaths.

private static ImmutableSet<String> getDeclaredOutputFilePaths(final TaskProperties taskProperties, final StringInterner stringInterner) {
    final ImmutableSet.Builder<String> declaredOutputFilePaths = ImmutableSortedSet.naturalOrder();
    FileCollectionInternal outputFiles = (FileCollectionInternal) taskProperties.getOutputFiles();
    outputFiles.visitRootElements(new FileCollectionVisitor() {

        @Override
        public void visitCollection(FileCollectionInternal fileCollection) {
            addAllPaths(fileCollection, declaredOutputFilePaths, stringInterner);
        }

        @Override
        public void visitTree(FileTreeInternal fileTree) {
            DeprecationLogger.nagUserOfDeprecated("Adding file trees which are not directory trees as output files");
            addAllPaths(fileTree, declaredOutputFilePaths, stringInterner);
        }

        @Override
        public void visitDirectoryTree(DirectoryFileTree directoryTree) {
            addPath(directoryTree.getDir(), declaredOutputFilePaths, stringInterner);
        }
    });
    return declaredOutputFilePaths.build();
}
Also used : FileCollectionVisitor(org.gradle.api.internal.file.FileCollectionVisitor) ImmutableSet(com.google.common.collect.ImmutableSet) FileCollectionInternal(org.gradle.api.internal.file.FileCollectionInternal) DirectoryFileTree(org.gradle.api.internal.file.collections.DirectoryFileTree) FileTreeInternal(org.gradle.api.internal.file.FileTreeInternal)

Aggregations

ImmutableSet (com.google.common.collect.ImmutableSet)1 FileCollectionInternal (org.gradle.api.internal.file.FileCollectionInternal)1 FileCollectionVisitor (org.gradle.api.internal.file.FileCollectionVisitor)1 FileTreeInternal (org.gradle.api.internal.file.FileTreeInternal)1 DirectoryFileTree (org.gradle.api.internal.file.collections.DirectoryFileTree)1