use of org.gradle.api.resources.internal.LocalResourceAdapter in project gradle by gradle.
the class DefaultFileOperations method tarTree.
public FileTree tarTree(Object tarPath) {
File tarFile = null;
ReadableResourceInternal resource;
if (tarPath instanceof ReadableResourceInternal) {
resource = (ReadableResourceInternal) tarPath;
} else if (tarPath instanceof ReadableResource) {
// custom type
resource = new UnknownBackingFileReadableResource((ReadableResource) tarPath);
} else {
tarFile = file(tarPath);
resource = new LocalResourceAdapter(new LocalFileStandInExternalResource(tarFile, fileSystem));
}
TarFileTree tarTree = new TarFileTree(tarFile, new MaybeCompressedFileResource(resource), getExpandDir(), fileSystem, fileSystem, directoryFileTreeFactory, streamHasher);
return new FileTreeAdapter(tarTree, fileResolver.getPatternSetFactory());
}
use of org.gradle.api.resources.internal.LocalResourceAdapter in project gradle by gradle.
the class TarFileTreeTest method readsGzippedTarFile.
@Test
public void readsGzippedTarFile() {
TestFile tgz = tmpDir.getTestDirectory().file("test.tgz");
rootDir.file("subdir/file1.txt").write("content");
rootDir.file("subdir2/file2.txt").write("content");
rootDir.tgzTo(tgz);
MaybeCompressedFileResource resource = new MaybeCompressedFileResource(new LocalResourceAdapter(TestFiles.fileRepository().localResource(tgz)));
TarFileTree tree = new TarFileTree(tarFile, resource, expandDir, fileSystem(), fileSystem(), directoryFileTreeFactory(), streamHasher());
assertVisits(tree, toList("subdir/file1.txt", "subdir2/file2.txt"), toList("subdir", "subdir2"));
assertSetContainsForAllTypes(tree, toList("subdir/file1.txt", "subdir2/file2.txt"));
}
use of org.gradle.api.resources.internal.LocalResourceAdapter in project gradle by gradle.
the class TarFileTreeTest method readsBzippedTarFile.
@Test
public void readsBzippedTarFile() {
TestFile tbz2 = tmpDir.getTestDirectory().file("test.tbz2");
rootDir.file("subdir/file1.txt").write("content");
rootDir.file("subdir2/file2.txt").write("content");
rootDir.tbzTo(tbz2);
MaybeCompressedFileResource resource = new MaybeCompressedFileResource(new LocalResourceAdapter(TestFiles.fileRepository().localResource(tbz2)));
TarFileTree tree = new TarFileTree(tarFile, resource, expandDir, fileSystem(), fileSystem(), directoryFileTreeFactory(), streamHasher());
assertVisits(tree, toList("subdir/file1.txt", "subdir2/file2.txt"), toList("subdir", "subdir2"));
assertSetContainsForAllTypes(tree, toList("subdir/file1.txt", "subdir2/file2.txt"));
}
Aggregations