TaskBasedOperation

@Incubating interface TaskBasedOperation<TaskT : Task>
com.android.build.api.artifact.TaskBasedOperation

Interface with methods to wire input and output method references to Task-based operations.

A Task-based operation will create, transform, or append files or directories to public ArtifactType to customize or participate in the build flow.

Each operation should indicate through the methods of this interface which method can be used to set or retrieve the Task inputs and outputs.

Summary

Public methods

abstract OutOperationRequest<FileTypeT>
wiredWith(taskOutput: (TaskT) -> FileSystemLocationProperty<FileTypeT>)

Sets the TaskT output method reference so the TaskT result can be retrieved after successful task execution.

abstract CombiningOperationRequest<FileTypeT>
wiredWith(taskInput: (TaskT) -> ListProperty<FileTypeT>, taskOutput: (TaskT) -> FileSystemLocationProperty<FileTypeT>)

Sets the TaskT input and output methods references so the Task can retrieve the current versions of a Artifact.MultipleArtifact when invoking taskInput while producing a new version of the same artifact type accessible through the taskOutput method after successful execution.

abstract InAndOutDirectoryOperationRequest<TaskT>
wiredWithDirectories(taskInput: (TaskT) -> DirectoryProperty, taskOutput: (TaskT) -> DirectoryProperty)

Sets the TaskT input and output methods references so the Task can retrieve the current version of the target ArtifactType when invoking taskInput.

abstract InAndOutFileOperationRequest
wiredWithFiles(taskInput: (TaskT) -> RegularFileProperty, taskOutput: (TaskT) -> RegularFileProperty)

Sets the TaskT input and output methods references so the Task can retrieve the current version of the target ArtifactType when invoking taskInput.

Public methods

wiredWith

abstract fun <FileTypeT : FileSystemLocation> wiredWith(taskOutput: (TaskT) -> FileSystemLocationProperty<FileTypeT>): OutOperationRequest<FileTypeT>

Sets the TaskT output method reference so the TaskT result can be retrieved after successful task execution.

This method is useful when creating a new version, when appending to existing artifacts, or when access to the current version of an artifact isn't required.

Parameters
taskOutput: (TaskT) -> FileSystemLocationProperty<FileTypeT> The method reference to retrieve the task output after successful task execution.
Return
The OutOperationRequest to set the desired operation type and ArtifactType on which the operation applies.

wiredWith

abstract fun <FileTypeT : FileSystemLocation> wiredWith(
    taskInput: (TaskT) -> ListProperty<FileTypeT>,
    taskOutput: (TaskT) -> FileSystemLocationProperty<FileTypeT>
): CombiningOperationRequest<FileTypeT>

Sets the TaskT input and output methods references so the Task can retrieve the current versions of a Artifact.MultipleArtifact when invoking taskInput while producing a new version of the same artifact type accessible through the taskOutput method after successful execution.

This method is useful when TaskT is combining all elements of an ArtifactType into a single element.

Parameters
taskInput: (TaskT) -> ListProperty<FileTypeT> The method reference the TaskT will use to retrieve the current artifact versions during TaskT execution (and only then).
taskOutput: (TaskT) -> FileSystemLocationProperty<FileTypeT> The method reference to retrieve the task output after successful task execution.
Return
The CombiningOperationRequest to set the desired operation type and ArtifactType as well as the target ArtifactType.

wiredWithDirectories

abstract fun wiredWithDirectories(
    taskInput: (TaskT) -> DirectoryProperty,
    taskOutput: (TaskT) -> DirectoryProperty
): InAndOutDirectoryOperationRequest<TaskT>

Sets the TaskT input and output methods references so the Task can retrieve the current version of the target ArtifactType when invoking taskInput. TaskT will also produce a new version of the same artifact type accessible through the taskOutput method after successful execution.

This method is useful when TaskT is transforming an ArtifactType from its current version to a new one and the ArtifactType's Artifact.kind is Artifact.DIRECTORY

Parameters
taskInput: (TaskT) -> DirectoryProperty The method reference the TaskT will use to retrieve the current artifact version during TaskT execution (and only then).
taskOutput: (TaskT) -> DirectoryProperty The method reference to retrieve the task output after successful task execution.
Return
The InAndOutDirectoryOperationRequest to set the desired operation type as well as the target ArtifactType.

wiredWithFiles

abstract fun wiredWithFiles(
    taskInput: (TaskT) -> RegularFileProperty,
    taskOutput: (TaskT) -> RegularFileProperty
): InAndOutFileOperationRequest

Sets the TaskT input and output methods references so the Task can retrieve the current version of the target ArtifactType when invoking taskInput. TaskT will also produce a new version of the same artifact type accessible through the taskOutput method after successful execution.

This method is useful when TaskT is transforming an ArtifactType from its current version to a new one and the ArtifactType's Artifact.kind is Artifact.FILE

Parameters
taskInput: (TaskT) -> RegularFileProperty The method reference the TaskT will use to retrieve the current artifact version during TaskT execution (and only then).
taskOutput: (TaskT) -> RegularFileProperty The method reference to retrieve the task output after successful task execution.
Return
The OutOperationRequest to set the desired operation type and ArtifactType as well as the target ArtifactType.