KotlinMultiplatformAndroidComponentsExtension
@Incubating interface KotlinMultiplatformAndroidComponentsExtension : DslLifecycle, AndroidComponents
Components extension for KMP Android Gradle Plugin related components.
Summary
Public functions |
|
|---|---|
Unit |
onVariant(callback: (KotlinMultiplatformAndroidVariant) -> Unit)Allow for registration of a |
Unit |
onVariant(callback: Action<KotlinMultiplatformAndroidVariant>) |
Inherited functions |
||||
|---|---|---|---|---|
|
||||
Inherited properties |
||||
|---|---|---|---|---|
|
||||
Public functions
onVariant
fun onVariant(callback: (KotlinMultiplatformAndroidVariant) -> Unit): Unit
Allow for registration of a callback to be called with variant instances of type KotlinMultiplatformAndroidExtension once the list of com.android.build.api.artifact.Artifact has been determined.
At this stage, access to the DSL objects is disallowed
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 KotlinMultiplatformAndroidExtension 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.