BuiltArtifacts

@Incubating interface BuiltArtifacts
com.android.build.api.variant.BuiltArtifacts

Represents a Collection of BuiltArtifact produced by a org.gradle.api.Task.

Tasks in Android Gradle Plugin can produce more than one file in the output folder so any Artifact with a Artifact.kind of type com.android.build.api.artifact.ArtifactKind.DIRECTORY can actually contain several produced File. For instance, when dealing with multi-apk, there will be several manifest files or APKs produced by the Android Gradle Plugin.

Each produced file can be identified with unique metadata like the list of filters and/or version code or version name. This instance will allow producer and consumer org.gradle.api.Tasks to easily match produced files with this metadata without relying on name mangling or other custom solutions.

Simple use of this facility can look like :

This BuiltArtifacts will abstract access to these produced files and provided some metadata associated with each file to be able to identify filters, version code or version name.

Summary

Nested classes

abstract

Specialized version of Gradle's WorkParameters so we can retrieve the output file generated when transforming an instance of BuiltArtifacts into a new one.

Constants

const Int

Current version of the metadata file.

Public methods

abstract Unit

Saves the metadata associated with this instance into a folder.

Properties

abstract String

Returns the application ID for these BuiltArtifact instances.

abstract Artifact<*>

Identifies the Artifact for this Collection of BuiltArtifact, all BuiltArtifact are the same type of artifact.

abstract Collection<BuiltArtifact>

Returns the Collection of BuiltArtifact.

abstract String

Identifies the variant name for these BuiltArtifact

Constants

METADATA_FILE_VERSION

const val METADATA_FILE_VERSION: Int

Current version of the metadata file.

Value: 2

Public methods

save

abstract fun save(out: Directory): Unit

Saves the metadata associated with this instance into a folder.

Parameters
out: Directory the Directory that can be used to save the metadata using a standard file name.

Properties

applicationId

abstract val applicationId: String

Returns the application ID for these BuiltArtifact instances.

Return
the application ID.

artifactType

abstract val artifactType: Artifact<*>

Identifies the Artifact for this Collection of BuiltArtifact, all BuiltArtifact are the same type of artifact.

Return
the Artifact for all the BuiltArtifact instances.

elements

abstract val elements: Collection<BuiltArtifact>

Returns the Collection of BuiltArtifact.

variantName

abstract val variantName: String

Identifies the variant name for these BuiltArtifact