MultipleArtifactTypeOutOperationRequest

Added in 8.3.1

interface MultipleArtifactTypeOutOperationRequest<FileTypeT : FileSystemLocation>


Read-only Operations performed by a Task with a multiple RegularFile or Directory output.

All APIs will use a Artifact.Multiple as a target type and must use a ListProperty of FileTypeT to retrieve the artifacts.

Summary

Public functions

Unit
<ArtifactTypeT : Artifact.Multiple<FileTypeT>> toListenTo(
    type: ArtifactTypeT
)

Initiates a reactive request where the Task used in the Artifacts.use method will be executed once the final version of the type artifact has been produced.

Public functions

toListenTo

Added in 8.3.1
fun <ArtifactTypeT : Artifact.Multiple<FileTypeT>> toListenTo(
    type: ArtifactTypeT
): Unit

Initiates a reactive request where the Task used in the Artifacts.use method will be executed once the final version of the type artifact has been produced.

The final version artifact will be injected in the Task.

Remember that an artifact is not always produced, for instance, an artifact related to minification will not be produced unless minification is turned on.

When an artifact is not produced in the current build flow, the Task will NOT be invoked.

For example, let's take a Task that wants to listen to the merged manifest file production :

        abstract class MyTask: DefaultTask() {
@get:InputFiles abstract val proguardFiles: ListProperty<RegularFile>

@TaskAction fun taskAction() {
... verify that those proguard files are correct ...
}
}

You can register the Task that consumes the proguard files as a [ListProperty] of
[org.gradle.api.file.RegularFile]:

```kotlin
val taskProvider= projects.tasks.register(MyTask::class.java, "verifyKeepProguardTask")
artifacts.use(taskProvider)
.wiredWithMultiple(MyTask::proguardFiles)
.toListenTo(MultipleArtifact.MULTIDEX_KEEP_PROGUARD)

Task will be registered as a finalizer task for the final producer of the type artifact using Gradle's Task.finalizedBy API.

Parameters
type: ArtifactTypeT

the Artifact.Multiple artifact identifier.