Search in sources :

Example 1 with StreamZipInput

use of org.gradle.api.internal.file.archive.impl.StreamZipInput in project gradle by gradle.

the class ZipHasher method fingerprintZipEntries.

private void fingerprintZipEntries(String parentName, String rootParentName, List<FileSystemLocationFingerprint> fingerprints, ZipInput input) throws IOException {
    fingerprints.add(newZipMarker(parentName));
    for (ZipEntry zipEntry : input) {
        if (zipEntry.isDirectory()) {
            continue;
        }
        String fullName = parentName.isEmpty() ? zipEntry.getName() : parentName + "/" + zipEntry.getName();
        ZipEntryContext zipEntryContext = new DefaultZipEntryContext(zipEntry, fullName, rootParentName);
        if (isZipFile(zipEntry.getName())) {
            zipEntryContext.getEntry().withInputStream((ZipEntry.InputStreamAction<Void>) inputStream -> {
                fingerprintZipEntries(fullName, rootParentName, fingerprints, new StreamZipInput(inputStream));
                return null;
            });
        } else {
            fingerprintZipEntry(zipEntryContext, fingerprints);
        }
    }
}
Also used : Hashing(org.gradle.internal.hash.Hashing) LoggerFactory(org.slf4j.LoggerFactory) ZipInput(org.gradle.api.internal.file.archive.ZipInput) ResourceHasher(org.gradle.internal.fingerprint.hashing.ResourceHasher) RegularFileSnapshotContextHasher(org.gradle.internal.fingerprint.hashing.RegularFileSnapshotContextHasher) Lists(com.google.common.collect.Lists) Locale(java.util.Locale) FileZipInput(org.gradle.api.internal.file.archive.impl.FileZipInput) FileSystemLocationFingerprint(org.gradle.internal.fingerprint.FileSystemLocationFingerprint) Nullable(javax.annotation.Nullable) ImmutableSet(com.google.common.collect.ImmutableSet) Logger(org.slf4j.Logger) ZipEntryContext(org.gradle.internal.fingerprint.hashing.ZipEntryContext) Set(java.util.Set) IOException(java.io.IOException) FingerprintHashingStrategy(org.gradle.internal.fingerprint.FingerprintHashingStrategy) Hasher(org.gradle.internal.hash.Hasher) HashCode(org.gradle.internal.hash.HashCode) File(java.io.File) ConfigurableNormalizer(org.gradle.internal.fingerprint.hashing.ConfigurableNormalizer) StreamZipInput(org.gradle.api.internal.file.archive.impl.StreamZipInput) List(java.util.List) DefaultFileSystemLocationFingerprint(org.gradle.internal.fingerprint.impl.DefaultFileSystemLocationFingerprint) RegularFileSnapshot(org.gradle.internal.snapshot.RegularFileSnapshot) ZipEntry(org.gradle.api.internal.file.archive.ZipEntry) FileType(org.gradle.internal.file.FileType) FilenameUtils(org.apache.commons.io.FilenameUtils) RegularFileSnapshotContext(org.gradle.internal.fingerprint.hashing.RegularFileSnapshotContext) ZipEntry(org.gradle.api.internal.file.archive.ZipEntry) StreamZipInput(org.gradle.api.internal.file.archive.impl.StreamZipInput) ZipEntryContext(org.gradle.internal.fingerprint.hashing.ZipEntryContext)

Aggregations

ImmutableSet (com.google.common.collect.ImmutableSet)1 Lists (com.google.common.collect.Lists)1 File (java.io.File)1 IOException (java.io.IOException)1 List (java.util.List)1 Locale (java.util.Locale)1 Set (java.util.Set)1 Nullable (javax.annotation.Nullable)1 FilenameUtils (org.apache.commons.io.FilenameUtils)1 ZipEntry (org.gradle.api.internal.file.archive.ZipEntry)1 ZipInput (org.gradle.api.internal.file.archive.ZipInput)1 FileZipInput (org.gradle.api.internal.file.archive.impl.FileZipInput)1 StreamZipInput (org.gradle.api.internal.file.archive.impl.StreamZipInput)1 FileType (org.gradle.internal.file.FileType)1 FileSystemLocationFingerprint (org.gradle.internal.fingerprint.FileSystemLocationFingerprint)1 FingerprintHashingStrategy (org.gradle.internal.fingerprint.FingerprintHashingStrategy)1 ConfigurableNormalizer (org.gradle.internal.fingerprint.hashing.ConfigurableNormalizer)1 RegularFileSnapshotContext (org.gradle.internal.fingerprint.hashing.RegularFileSnapshotContext)1 RegularFileSnapshotContextHasher (org.gradle.internal.fingerprint.hashing.RegularFileSnapshotContextHasher)1 ResourceHasher (org.gradle.internal.fingerprint.hashing.ResourceHasher)1