KotlinAndroidExtension

A plugin DSL extension for configuring Kotlin JVM options for the entire project.

This extension is only available when "org.jetbrains.kotlin.android" plugin is applied in the project.

Use the extension in your build script in the kotlin block:

kotlin {
// Your extension configuration
}

Since

2.1.0

Properties

Link copied to clipboard

Represents the compiler options used by a Kotlin compilation process.

Link copied to clipboard

The version of the Kotlin compiler.

Link copied to clipboard

Specifies the version of the core Kotlin libraries that are added to the Kotlin compile classpath, unless there is already a dependency added to this project.

Link copied to clipboard

Configures default explicit API mode for all non-test compilations in the project.

Link copied to clipboard

Configures Kotlin daemon JVM arguments for all tasks in this project.

Link copied to clipboard

A NamedDomainObjectContainer containing all registered KotlinSourceSets in this project.

Link copied to clipboard
abstract val target: KotlinTarget

An instance of KotlinTarget for KotlinPlatformType.androidJvm platform.

Functions

Link copied to clipboard
open fun compilerOptions(configure: KotlinJvmCompilerOptions.() -> Unit)

Configures the compilerOptions with the provided configuration.

Link copied to clipboard
abstract fun explicitApi()

Sets explicitApi option to report issues as errors.

Link copied to clipboard
abstract fun explicitApiWarning()

Sets explicitApi option to report issues as warnings.

Link copied to clipboard
abstract fun <T : Named> NamedDomainObjectContainer<T>.invokeWhenCreated(name: String, configure: T.() -> Unit)

Can be used to configure objects that are not yet created, or will be created in 'afterEvaluate' (for example, typically for Android source sets containing flavors and buildTypes).

Link copied to clipboard
abstract fun jvmToolchain(jdkVersion: Int)
abstract fun jvmToolchain(action: Action<JavaToolchainSpec>)

Configures Java toolchain both for Kotlin JVM and Java tasks in the project.