Stay organized with collections
Save and categorize content based on your preferences.
InAndOutFileOperationRequest
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.
Summary
Public functions
fun <ArtifactTypeT : Artifact.Single<RegularFile> & Artifact.Transformable> toTransform(
type: ArtifactTypeT
): Unit
Initiates a transform request to a single Artifact.Transformable
artifact type.
Parameters |
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(MyTask::class.java, "transformTask") artifacts.use(taskProvider) .wiredWithFiles( MyTask::inputFile, MyTask::outputFile) .toTransform(ArtifactType.SINGLE_FILE_ARTIFACT)
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-01-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-01-26 UTC."],[],[]]