Transform Action
Interface for artifact transform actions.
A transform action implementation is an abstract class implementing the transform method. A minimal implementation may look like this:
import org.gradle.api.artifacts.transform.TransformParameters;
public abstract class MyTransform implements TransformAction<TransformParameters.None> {
@InputArtifact
public abstract Provider<FileSystemLocation> getInputArtifact();
@Override
public void transform(TransformOutputs outputs) {
File input = getInputArtifact().get().getAsFile();
File output = outputs.file(input.getName() + ".transformed");
// Do something to generate output from input
}
}
Content copied to clipboard
- Do not implement getParameters in your class, the method will be implemented by Gradle.
- Implementations may only have a default constructor.
- An abstract getter annotated with InputArtifact will receive the input artifact location, which is the file or directory that the transform should be applied to.
- An abstract getter with InputArtifactDependencies will receive the dependencies of its input artifact.
Since
5.3
Parameters
<T>
Parameter type for the transform action. Should be TransformParameters.None if the action does not have parameters.
Functions
Link copied to clipboard
The object provided by getParameters when registering the artifact transform.
Link copied to clipboard
Executes the transform.