ScopedArtifactsOperation

Added in 7.4.0

interface ScopedArtifactsOperation<T : Task>


Defines all possible operations on a ScopedArtifact artifact type.

Depending on the scope, inputs may contain a mix of org.gradle.api.file.FileCollection, RegularFile or Directory so all Task consuming the current value of the artifact must provide two input fields that will contain the list of RegularFile and Directory.

Summary

Public functions

Unit

Append a new FileSystemLocation (basically, either a Directory or a RegularFile) to the artifact type referenced by to

Unit
toGet(
    type: ScopedArtifact,
    inputJars: (T) -> ListProperty<RegularFile>,
    inputDirectories: (T) -> ListProperty<Directory>
)

Set the final version of the type artifact to the input fields of the Task.

Unit

Transform the current version of the type artifact into a new version.

Unit
toTransform(
    type: ScopedArtifact,
    inputJars: (T) -> ListProperty<RegularFile>,
    inputDirectories: (T) -> ListProperty<Directory>,
    into: (T) -> RegularFileProperty
)

Transform the current version of the type artifact into a new version.

Public functions

toAppend

Added in 7.4.0
fun toAppend(to: ScopedArtifact, with: (T) -> Property<FileSystemLocation>): Unit

Append a new FileSystemLocation (basically, either a Directory or a RegularFile) to the artifact type referenced by to

Parameters
to: ScopedArtifact

the ScopedArtifact to add the with to.

with: (T) -> Property<FileSystemLocation>

lambda that returns the Property used by the Task to save the appended element. The Property value will be automatically set by the Android Gradle Plugin and its location should not be considered part of the API and can change in the future.

toGet

Added in 7.4.0
fun toGet(
    type: ScopedArtifact,
    inputJars: (T) -> ListProperty<RegularFile>,
    inputDirectories: (T) -> ListProperty<Directory>
): Unit

Set the final version of the type artifact to the input fields of the Task. Those input fields should be annotated with org.gradle.api.tasks.InputFiles for Gradle to property set the task dependency.

Parameters
type: ScopedArtifact

the ScopedArtifact to obtain the final value of.

inputJars: (T) -> ListProperty<RegularFile>

lambda that returns a ListProperty or RegularFile that will be used to set all incoming files for this artifact type.

inputDirectories: (T) -> ListProperty<Directory>

lambda that returns a ListProperty or Directory that will be used to set all incoming directories for this artifact type.

toReplace

fun toReplace(type: ScopedArtifact, into: (T) -> RegularFileProperty): Unit

Transform the current version of the type artifact into a new version. The order in which the replace Tasks are applied is directly set by the order of this method call. Last one wins and none of the previously set append/transform/replace registered Tasks will be invoked since this Task replace the final version.

Parameters
type: ScopedArtifact

the ScopedArtifact to replace.

into: (T) -> RegularFileProperty

lambda that returns the Property used by the Task to save the replaced element. The Property value will be automatically set by the Android Gradle Plugin and its location should not be considered part of the API and can change in the future.

toTransform

fun toTransform(
    type: ScopedArtifact,
    inputJars: (T) -> ListProperty<RegularFile>,
    inputDirectories: (T) -> ListProperty<Directory>,
    into: (T) -> RegularFileProperty
): Unit

Transform the current version of the type artifact into a new version. The order in which the transforms are applied is directly set by the order of this method call. First come, first served, last one provides the final version of the artifacts.

IMPORTANT: Task will transform many inputs into a single output. That means task must have merging logic as jars contain similar files and folders (like META-INF). Merging logic depends on transformation nature.

Parameters
type: ScopedArtifact

the ScopedArtifact to transform.

inputJars: (T) -> ListProperty<RegularFile>

lambda that returns a ListProperty or RegularFile that will be used to set all incoming files for this artifact type.

inputDirectories: (T) -> ListProperty<Directory>

lambda that returns a ListProperty or Directory that will be used to set all incoming directories for this artifact type.

into: (T) -> RegularFileProperty

lambda that returns the Property used by the Task to save the transformed element. The Property value will be automatically set by the Android Gradle Plugin and its location should not be considered part of the API and can change in the future.