BuiltArtifacts
interface 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.Task
s 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 :
abstract class MyTask @inject constructor(val objectFactory: ObjectFactory): DefaultTask() {
@get:InputDirectory
abstract val input: DirectoryProperty
@get:OutputDirectory
abstract val output: DirectoryProperty
@get:Internal
abstract val artifactsLoader: Property
@TaskAction
fun taskAction() {
val builtArtifacts= artifactsLoader.get().load(
objectFactory, input.get())
TODO : TBD what will be surfaced here
newBuiltArtifacts.save(output.get()))
}
}
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 types |
|
---|---|
BuiltArtifacts.Companion |
|
BuiltArtifacts.TransformParams |
Specialized version of Gradle's |
Public functions |
|
---|---|
Unit |
Saves the metadata associated with this instance into a folder. |
Public properties |
|
---|---|
String |
Returns the application ID for these |
Artifact<*> |
Identifies the |
Collection<BuiltArtifact> |
Returns the |
String |
Identifies the variant name for these |
Public functions
Public properties
applicationId
val applicationId: String
Returns the application ID for these BuiltArtifact
instances.
Returns | |
---|---|
String |
the application ID. |
artifactType
val artifactType: Artifact<*>
Identifies the Artifact
for this Collection
of BuiltArtifact
, all BuiltArtifact
are the same type of artifact.
Returns | |
---|---|
Artifact<*> |
the |