Stay organized with collections
Save and categorize content based on your preferences.
LibraryAndroidComponentsExtension
@Incubating interface LibraryAndroidComponentsExtension : AndroidComponentsExtension<LibraryVariantBuilder, LibraryVariant>
Extension for Library module variant.
A library module is created when a build script is applying the 'com.android.library' plugin.
Summary
Inherited functions
|
From class AndroidComponentsExtension
Unit |
androidTests(selector: VariantSelector = selector().all(), callback: Action<AndroidTest>)
Allow for registration of a callback to be called with instances of type AndroidTest
once the list of com.android.build.api.artifact.Artifact has been determined.
At this stage, access to the DSL objects is disallowed and access to the AndroidTestBuilder
instance is limited to read-only access.
Because the list of artifacts (including private ones) is final, one cannot change the build
flow anymore as org.gradle.api.Tasks are now expecting those artifacts as inputs. However
users can modify such artifacts by replacing or transforming them, see com.android.build.api.artifact.Artifacts
for details.
Code executing in the callback also has access to the AndroidTest information which is used
to configure org.gradle.api.Task inputs. Such information represented as
org.gradle.api.provider.Property can still be modified ensuring that all
org.gradle.api.Tasks created by the Android Gradle Plugin use the updated value.
|
Unit |
androidTests(selector: VariantSelector = selector().all(), callback: (AndroidTest) -> Unit)
Action based version of the AndroidTest above.
|
Unit |
beforeAndroidTests(selector: VariantSelector = selector().all(), callback: (AndroidTestBuilder) -> Unit)
Allow for registration of a callback to be called with AndroidTestBuilder that
satisfies the selector. The callback will be called as soon as the AndroidTestBuilder
instance has been created but before any com.android.build.api.artifact.Artifact related to
android tests has been determined, therefore the build flow can still be changed when the
callback is invoked.
|
Unit |
beforeAndroidTests(selector: VariantSelector = selector().all(), callback: Action<AndroidTestBuilder>)
Action based version of the beforeAndroidTests above.
|
Unit |
beforeUnitTests(selector: VariantSelector = selector().all(), callback: (UnitTestBuilder) -> Unit)
Allow for registration of a callback to be called with UnitTestBuilder that
satisfies the selector. The callback will be called as soon as the UnitTestBuilder
instance has been created but before any com.android.build.api.artifact.Artifact related to
unit tests has been determined, therefore the build flow can still be changed when the
callback is invoked.
|
Unit |
beforeUnitTests(selector: VariantSelector = selector().all(), callback: Action<UnitTestBuilder>)
Action based version of beforeUnitTests above.
|
Unit |
beforeVariants(selector: VariantSelector = selector().all(), callback: (VariantBuilderT) -> Unit)
Method to register a callback to be called with VariantBuilderT instances that
satisfies the selector. The callback will be called as soon as the VariantBuilderT
instance has been created but before any com.android.build.api.artifact.Artifact has been
determined, therefore the build flow can still be changed when the callback is invoked.
At this stage, access to the DSL objects is disallowed, use afterDsl method to
programmatically access the DSL objects before the VariantBuilderT object is built.
Example without selection:
androidComponents {
beforeVariants {
println("Called with variant : ${'$'}name")
}
}
Example with selection:
androidComponents {
val debug = selector().withBuildType("debug")
beforeVariants(debug) {
println("Called with variant : ${'$'}name")
}
}
|
Unit |
beforeVariants(selector: VariantSelector = selector().all(), callback: Action<VariantBuilderT>)
Action based version of beforeVariants above.
|
Unit |
onVariants(selector: VariantSelector = selector().all(), callback: (VariantT) -> Unit)
Allow for registration of a callback to be called with variant instances of type VariantT
once the list of com.android.build.api.artifact.Artifact has been determined.
At this stage, access to the DSL objects is disallowed and access to the VariantBuilderT
instance is limited to read-only access.
Because the list of artifacts (including private ones) is final, one cannot change the build
flow anymore as org.gradle.api.Tasks are now expecting those artifacts as inputs. However
users can modify such artifacts by replacing or transforming them, see com.android.build.api.artifact.Artifacts
for details.
Code executing in the callback also has access to the VariantT information which is used
to configure org.gradle.api.Task inputs (for example, the buildConfigFields). Such
information represented as org.gradle.api.provider.Property can still be modified ensuring
that all org.gradle.api.Tasks created by the Android Gradle Plugin use the updated value.
|
Unit |
onVariants(selector: VariantSelector = selector().all(), callback: Action<VariantT>)
Action based version of onVariants above.
|
VariantSelector |
selector()
Creates a VariantSelector instance that can be configured
to reduce the set of ComponentBuilder instances participating in the beforeVariants
and onVariants callback invocation.
|
Unit |
unitTests(selector: VariantSelector = selector().all(), callback: Action<UnitTest>)
Allow for registration of a callback to be called with instances of type UnitTest
once the list of com.android.build.api.artifact.Artifact has been determined.
At this stage, access to the DSL objects is disallowed and access to the UnitTestBuilder
instance is limited to read-only access.
Because the list of artifacts (including private ones) is final, one cannot change the build
flow anymore as org.gradle.api.Tasks are now expecting those artifacts as inputs. However
users can modify such artifacts by replacing or transforming them, see com.android.build.api.artifact.Artifacts
for details.
Code executing in the callback also has access to the UnitTest information which is used
to configure org.gradle.api.Task inputs. Such information represented as
org.gradle.api.provider.Property can still be modified ensuring that all
org.gradle.api.Tasks created by the Android Gradle Plugin use the updated value.
|
Unit |
unitTests(selector: VariantSelector = selector().all(), callback: (UnitTest) -> Unit)
Action based version of the unitTests above.
|
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2021-04-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-04-07 UTC."],[],[]]