Stay organized with collections
Save and categorize content based on your preferences.
CombiningOperationRequest
@Incubating interface CombiningOperationRequest<FileTypeT : FileSystemLocation>
Summary
Public methods
abstract fun <ArtifactTypeT> toTransform(type: ArtifactTypeT): Unit where ArtifactTypeT : Artifact.MultipleArtifact<FileTypeT>, ArtifactTypeT : Artifact.Transformable
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.MultipleArtifact 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 ArtifactType 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 2025-02-10 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 2025-02-10 UTC."],[],[],null,["# CombiningOperationRequest\n=========================\n\n```\n@Incubating interface CombiningOperationRequest\u003cFileTypeT : FileSystemLocation\u003e\n```\n\n|---------------------------------------------------------------|\n| [com.android.build.api.artifact.CombiningOperationRequest](#) |\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [toTransform](#toTransform(com.android.build.api.artifact.CombiningOperationRequest.toTransform.ArtifactTypeT))`(`type:` `ArtifactTypeT`)` Initiates a transform request to a multiple [Artifact.Transformable](/reference/tools/gradle-api/4.2/com/android/build/api/artifact/Artifact.Transformable) artifact type. |\n\nPublic methods\n--------------\n\n### toTransform\n\n```\nabstract fun \u003cArtifactTypeT\u003e toTransform(type: ArtifactTypeT): Unit where ArtifactTypeT : Artifact.MultipleArtifact\u003cFileTypeT\u003e, ArtifactTypeT : Artifact.Transformable\n```\n\nInitiates a transform request to a multiple [Artifact.Transformable](/reference/tools/gradle-api/4.2/com/android/build/api/artifact/Artifact.Transformable) artifact type.\n\n| Parameters ||\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| type: ArtifactTypeT | The [Artifact](/reference/tools/gradle-api/4.2/com/android/build/api/artifact/Artifact) of FileTypeT identifying the artifact to transform. The artifact type must be [Artifact.MultipleArtifact](/reference/tools/gradle-api/4.2/com/android/build/api/artifact/Artifact.MultipleArtifact) and [Artifact.Transformable](/reference/tools/gradle-api/4.2/com/android/build/api/artifact/Artifact.Transformable). The implementation of the task must combine all the inputs into a single output. Chained transforms will get a [ListProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/ListProperty.html) containing the single output from the upstream transform. If some [append](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/append.html) 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](https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html) to transform a list of [org.gradle.api.file.RegularFile](https://docs.gradle.org/current/javadoc/org/gradle/api/file/RegularFile.html) as inputs into a single output: ```scalate-server-page abstract class MyTask: DefaultTask() { @get:InputFiles abstract val inputFiles: ListProperty\u003cRegularFile\u003e @get:OutputFile abstract val outputFile: RegularFileProperty @TaskAction fun taskAction() { ... read all inputFiles and write outputFile ... } } ``` An [ArtifactType](/reference/tools/gradle-api/4.2/com/android/build/api/artifact/ArtifactType) defined as follows : ```scalate-server-page sealed class ArtifactType\u003cT: FileSystemLocation\u003e(val kind: ArtifactKind) { object MULTIPLE_FILE_ARTIFACT: ArtifactType\u003cRegularFile\u003e(FILE), Multiple, Transformable } ``` You then register the task as follows: ```verilog val taskProvider= projects.tasks.register(MyTask::class.java, \"combineTask\") artifacts.use(taskProvider) .wiredWith( MyTask::inputFiles, MyTask::outputFile) .toTransform(ArtifactType.MULTIPLE_FILE_ARTIFACT) ``` |"]]