Annotation Type CacheableTransform


  • @Retention(RUNTIME)
    @Target(TYPE)
    public @interface CacheableTransform
    Attaching this annotation to a TransformAction type it indicates that the build cache should be used for artifact transforms of this type.

    Only an artifact transform that produces reproducible and relocatable outputs should be marked with CacheableTransform.

    Normalization must be specified for each file parameter of a cacheable transform. For example:

     import org.gradle.api.artifacts.transform.TransformParameters;
    
     @CacheableTransform
     public abstract class MyTransform implements TransformAction<TransformParameters.None> {
         @PathSensitive(PathSensitivity.NAME_ONLY)
         @InputArtifact
         public abstract Provider<FileSystemLocation> getInputArtifact();
    
         @Classpath
         @InputArtifactDependencies
         public abstract FileCollection getDependencies();
    
         @Override
         public void transform(TransformOutputs outputs) {
             // ...
         }
     }
     
    Since:
    5.3
    See Also:
    DisableCachingByDefault