Search in sources :

Example 1 with ArtifactTransformException

use of org.gradle.api.artifacts.transform.ArtifactTransformException in project gradle by gradle.

the class DefaultVariantTransformRegistration method transform.

@Override
public List<File> transform(File input) {
    try {
        File absoluteFile = input.getAbsoluteFile();
        // Collect up hash of the input files, and of the transform's configuration params and implementation
        FileCollectionSnapshot snapshot = fileCollectionSnapshotter.snapshot(new SimpleFileCollection(absoluteFile), TaskFilePropertyCompareStrategy.UNORDERED, TaskFilePropertySnapshotNormalizationStrategy.ABSOLUTE);
        DefaultBuildCacheHasher hasher = new DefaultBuildCacheHasher();
        hasher.putBytes(inputsHash.asBytes());
        snapshot.appendToHasher(hasher);
        HashCode resultHash = hasher.hash();
        return transformedFileCache.getResult(absoluteFile, resultHash, transformer);
    } catch (Exception e) {
        throw new ArtifactTransformException(input, to, implementation, e);
    }
}
Also used : HashCode(com.google.common.hash.HashCode) SimpleFileCollection(org.gradle.api.internal.file.collections.SimpleFileCollection) FileCollectionSnapshot(org.gradle.api.internal.changedetection.state.FileCollectionSnapshot) DefaultBuildCacheHasher(org.gradle.caching.internal.DefaultBuildCacheHasher) ArtifactTransformException(org.gradle.api.artifacts.transform.ArtifactTransformException) File(java.io.File) ArtifactTransformException(org.gradle.api.artifacts.transform.ArtifactTransformException) VariantTransformConfigurationException(org.gradle.api.artifacts.transform.VariantTransformConfigurationException)

Aggregations

HashCode (com.google.common.hash.HashCode)1 File (java.io.File)1 ArtifactTransformException (org.gradle.api.artifacts.transform.ArtifactTransformException)1 VariantTransformConfigurationException (org.gradle.api.artifacts.transform.VariantTransformConfigurationException)1 FileCollectionSnapshot (org.gradle.api.internal.changedetection.state.FileCollectionSnapshot)1 SimpleFileCollection (org.gradle.api.internal.file.collections.SimpleFileCollection)1 DefaultBuildCacheHasher (org.gradle.caching.internal.DefaultBuildCacheHasher)1