Stay organized with collections Save and categorize content based on your preferences.


interface InAndOutFileOperationRequest

Operations performed by a Task with a single RegularFile or Directory output.

Task is consuming existing version of the target SingleArtifact and producing a new version.


Public methods

abstract Unit
toTransform(type: ArtifactTypeT)

Initiates a transform request to a single Artifact.Transformable artifact type.

Public methods


abstract fun <ArtifactTypeT> toTransform(type: ArtifactTypeT): Unit where ArtifactTypeT : Artifact.Single<RegularFile>, ArtifactTypeT : Artifact.Transformable

Initiates a transform request to a single Artifact.Transformable artifact type.

type: ArtifactTypeT

The Artifact identifying the artifact to transform. The Artifact's Artifact.kind must be Artifact.FILE.

The artifact type must be Artifact.Single and Artifact.Transformable.

As an example, let's take a Task transforming an input org.gradle.api.file.RegularFile into an output:

    abstract class MyTask: DefaultTask() {
         @get:InputFile abstract val inputFile: RegularFileProperty
         @get:OutputFile abstract val outputFile: RegularFileProperty

         @TaskAction fun taskAction() {
             ... read inputFile and write outputFile ...

An ArtifactType defined as follows :

    sealed class ArtifactType<T: FileSystemLocation>(val kind: ArtifactKind) {
         object SINGLE_FILE_ARTIFACT:
                 ArtifactType<RegularFile>(FILE), Single, Transformable

You can register a transform to the collection of org.gradle.api.file.RegularFile.

    val taskProvider= projects.tasks.register(, "transformTask")