Stay organized with collections
Save and categorize content based on your preferences.
CombiningOperationRequest
interface CombiningOperationRequest<FileTypeT : FileSystemLocation?>
Summary
Public functions
fun <ArtifactTypeT : Artifact.Multiple<FileTypeT?>? & Artifact.Transformable?> toTransform(
type: ArtifactTypeT?
): Unit
Initiates a transform request to a multiple Artifact.Transformable
artifact type.
Parameters |
type: ArtifactTypeT? |
The Artifact of FileTypeT identifying the artifact to transform.
The artifact type must be Artifact.Multiple and Artifact.Transformable .
The implementation of the task must combine all the inputs into a single output. Chained transforms will get a ListProperty containing the single output from the upstream transform.
If some append calls are made on the same artifact type, the first transform will always get the complete list of artifacts irrespective of the timing of the calls.
In the following example, let's take a Task to transform a list of org.gradle.api.file.RegularFile as inputs into a single output:
abstract class MyTask: DefaultTask() { @get:InputFiles abstract val inputFiles: ListProperty<RegularFile> @get:OutputFile abstract val outputFile: RegularFileProperty
@TaskAction fun taskAction() { ... read all inputFiles and write outputFile ... } }
An SingleArtifact defined as follows :
sealed class ArtifactType<T: FileSystemLocation>(val kind: ArtifactKind) { object MULTIPLE_FILE_ARTIFACT: ArtifactType<RegularFile>(FILE), Multiple, Transformable }
You then register the task as follows:
val taskProvider= projects.tasks.register(MyTask::class.java, "combineTask") artifacts.use(taskProvider) .wiredWith( MyTask::inputFiles, MyTask::outputFile) .toTransform(ArtifactType.MULTIPLE_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-09-14 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-09-14 UTC."],[],[]]