KotlinMultiplatformAndroidComponentsExtension

@Incubating
public interface KotlinMultiplatformAndroidComponentsExtension extends DslLifecycle, AndroidComponents


Components extension for KMP Android Gradle Plugin related components.

Summary

Public methods

abstract void

Action based version of onVariant above.

abstract void

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.

Inherited methods

From com.android.build.api.variant.AndroidComponents
abstract @NonNull AndroidPluginVersion

The version of the Android Gradle Plugin currently in use.

abstract @NonNull SdkComponents

Provides access to underlying Android SDK and build-tools components like adb.

From com.android.build.api.variant.DslLifecycle
abstract void

Action based version of finalizeDsl above.

abstract void

API to customize the DSL Objects programmatically after they have been evaluated from the build files and before used in the build process next steps like variant or tasks creation.

Public methods

onVariant

abstract void onVariant(
    @NonNull Action<@NonNull KotlinMultiplatformAndroidVariant> callback
)

Action based version of onVariant above.

onVariant

abstract void onVariant(
    @NonNull Function1<@NonNull KotlinMultiplatformAndroidVariantUnit> callback
)

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.