Java Code Examples for org.gradle.api.internal.file.FileOperations#zipTree()

The following examples show how to use org.gradle.api.internal.file.FileOperations#zipTree() . 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: FileCollectionBackedArchiveTextResource.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public FileCollectionBackedArchiveTextResource(final FileOperations fileOperations,
                                               final TemporaryFileProvider tempFileProvider,
                                               final FileCollection fileCollection,
                                               final String path, Charset charset) {
    super(tempFileProvider, new LazilyInitializedFileTree() {
        @Override
        public FileTree createDelegate() {
            File archiveFile = fileCollection.getSingleFile();
            String fileExtension = Files.getFileExtension(archiveFile.getName());
            FileTree archiveContents = fileExtension.equals("jar") || fileExtension.equals("zip")
                    ? fileOperations.zipTree(archiveFile) : fileOperations.tarTree(archiveFile);
            PatternSet patternSet = new PatternSet();
            patternSet.include(path);
            return archiveContents.matching(patternSet);
        }
        public TaskDependency getBuildDependencies() {
            return fileCollection.getBuildDependencies();
        }
    }, charset);
}
 
Example 2
Source File: FileCollectionBackedArchiveTextResource.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public FileCollectionBackedArchiveTextResource(final FileOperations fileOperations,
                                               final TemporaryFileProvider tempFileProvider,
                                               final FileCollection fileCollection,
                                               final String path, Charset charset) {
    super(tempFileProvider, new LazilyInitializedFileTree() {
        @Override
        public FileTree createDelegate() {
            File archiveFile = fileCollection.getSingleFile();
            String fileExtension = Files.getFileExtension(archiveFile.getName());
            FileTree archiveContents = fileExtension.equals("jar") || fileExtension.equals("zip")
                    ? fileOperations.zipTree(archiveFile) : fileOperations.tarTree(archiveFile);
            PatternSet patternSet = new PatternSet();
            patternSet.include(path);
            return archiveContents.matching(patternSet);
        }
        public TaskDependency getBuildDependencies() {
            return fileCollection.getBuildDependencies();
        }
    }, charset);
}