registerKotlinJvmCompileTask

abstract fun registerKotlinJvmCompileTask(taskName: String, compilerOptions: KotlinJvmCompilerOptions = createCompilerJvmOptions(), explicitApiMode: Provider<ExplicitApiMode> = providerFactory.provider { ExplicitApiMode.Disabled }): TaskProvider<out KotlinJvmCompile>

Registers a new standalone Kotlin compilation task for the JVM platform.

This task is not associated with any KotlinTarget or KotlinCompilation. It is not executed as part of the common compilation pipeline.

Here's an example of how to register a new task:

project.plugins.apply<KotlinApiPlugin>()
val kotlinApiPlugin = project.plugins.getPlugin(KotlinApiPlugin::class)
val kotlinJvmOptions = kotlinApiPlugin.createCompilerJvmOptions()
val kotlinJvmCompileTask = kotlinApiPlugin.registerKotlinJvmCompileTask(
"customKotlinCompile",
kotlinJvmOptions,
project.providers.provider { ExplicitApiMode.Strict }
)

Since

2.1.0

Parameters

taskName

the name of the task.

compilerOptions

values of this KotlinJvmCompilerOptions instance that are used as convention values for KotlinJvmCompilerOptions's inside task.

explicitApiMode

desired ExplicitApiMode mode in the task. The Provider can have null value which is the same as specify ExplicitApiMode.Disabled. By default, the value is ExplicitApiMode.Disabled.


Deprecated

Replaced with 'registerKotlinJvmCompileTask(taskName, compilerOptions, explicitApiMode)'

Registers a new standalone Kotlin compilation task with the given taskName for the JVM platform.

Since

1.7.0


abstract fun registerKotlinJvmCompileTask(taskName: String, moduleName: String): TaskProvider<out KotlinJvmCompile>

Deprecated

Replaced with 'registerKotlinJvmCompileTask(taskName, compilerOptions, explicitApiMode)'

Registers a new standalone Kotlin compilation task for the JVM platform.

Since

1.9.20

Parameters

taskName

The name of the task to be created.

moduleName

The name of the module for which the task is being created. For more information, see KotlinJvmCompilerOptions.moduleName.