Movatterモバイル変換


[0]ホーム

URL:


TransformAction

Table of Contents

Properties
Methods
Script blocks
Property details
Method details
API Documentation:TransformAction

Interface for artifact transform actions.

A transform action implementation is an abstract class implementing theTransformAction.transform(org.gradle.api.artifacts.transform.TransformOutputs) method. A minimal implementation may look like this:

import org.gradle.api.artifacts.transform.TransformParameters;publicabstractclass MyTransformimplements TransformAction<TransformParameters.None> {@InputArtifactpublicabstract Provider<FileSystemLocation> getInputArtifact();@Overridepublicvoid transform(TransformOutputs outputs) {        File input = getInputArtifact().get().getAsFile();        File output = outputs.file(input.getName() +".transformed");// Do something to generate output from input    }}

Implementations of TransformAction are subject to the following constraints:

  • Do not implementTransformAction.getParameters() in your class, the method will be implemented by Gradle.
  • Implementations may only have a default constructor.

Implementations can receive parameters by using annotated abstract getter methods.

  • An abstract getter annotated withInputArtifact will receive theinput artifact location, which is the file or directory that the transform should be applied to.
  • An abstract getter withInputArtifactDependencies will receive thedependencies of its input artifact.

Properties

PropertyDescription
parameters

The object provided byTransformSpec.getParameters() when registering the artifact transform.

Methods

MethodDescription
transform(outputs)

Executes the transform.

Script blocks

No script blocks

Property details

Tparameters (read-only)

The object provided byTransformSpec.getParameters() when registering the artifact transform.

Do not implement this method in your subclass. Gradle provides the implementation when registering the transform action viaDependencyHandler.registerTransform(java.lang.Class, org.gradle.api.Action).

Method details

voidtransform(TransformOutputs outputs)

Executes the transform.

This method must be implemented in the subclass.


[8]ページ先頭

©2009-2025 Movatter.jp