[Gradle] Deprecate kotlinOptions DSL in KotlinCompile DSL

^KT-63419 In Progress
This commit is contained in:
Yahor Berdnikau
2024-02-23 13:26:13 +01:00
committed by Space Team
parent 433bec3700
commit 2f70478e67
9 changed files with 13 additions and 46 deletions
@@ -6,7 +6,7 @@
@file:Suppress("PackageDirectoryMismatch") // Old package for compatibility
package org.jetbrains.kotlin.gradle.tasks
import groovy.lang.Closure
import org.gradle.api.Action
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.artifacts.*
@@ -187,22 +187,11 @@ abstract class AbstractKotlinNativeCompile<
@Deprecated(
message = "AbstractKotlinNativeCompile will not provide access to kotlinOptions." +
" Implementations should provide access to compilerOptions",
level = DeprecationLevel.ERROR
)
@get:Internal
abstract val kotlinOptions: T
@Deprecated(
message = "AbstractKotlinNativeCompile will not provide access to kotlinOptions()." +
" Implementations should provide access to compilerOptions()",
)
abstract fun kotlinOptions(fn: T.() -> Unit)
@Deprecated(
message = "AbstractKotlinNativeCompile will not provide access to kotlinOptions()." +
" Implementations should provide access to compilerOptions()",
)
abstract fun kotlinOptions(fn: Closure<*>)
@Deprecated("Use implementations compilerOptions to get/set freeCompilerArgs")
@get:Input
abstract val additionalCompilerOptions: Provider<Collection<String>>
@@ -391,25 +380,12 @@ internal constructor(
// region Kotlin options
@Deprecated(KOTLIN_OPTIONS_DEPRECATION_MESSAGE)
override val kotlinOptions: KotlinCommonOptions = object : KotlinCommonOptions {
override val options: KotlinCommonCompilerOptions
get() = compilerOptions
}
override fun kotlinOptions(fn: KotlinCommonOptions.() -> Unit) {
kotlinOptions.fn()
}
@Deprecated(
message = "Replaced with kotlinOptions()",
replaceWith = ReplaceWith("kotlinOptions(fn)")
)
override fun kotlinOptions(fn: Closure<*>) {
@Suppress("DEPRECATION")
fn.delegate = kotlinOptions
fn.call()
}
@Suppress("UNCHECKED_CAST")
@Deprecated(
message = "Replaced with compilerOptions.freeCompilerArgs",
@@ -46,7 +46,7 @@ import javax.inject.Inject
@CacheableTask
abstract class Kotlin2JsCompile @Inject constructor(
override val compilerOptions: KotlinJsCompilerOptions,
final override val compilerOptions: KotlinJsCompilerOptions,
objectFactory: ObjectFactory,
workerExecutor: WorkerExecutor,
) : AbstractKotlinCompile<K2JSCompilerArguments>(objectFactory, workerExecutor),
@@ -61,6 +61,7 @@ abstract class Kotlin2JsCompile @Inject constructor(
compilerOptions.verbose.convention(logger.isDebugEnabled)
}
@Deprecated(KOTLIN_OPTIONS_DEPRECATION_MESSAGE)
override val kotlinOptions: KotlinJsOptions = KotlinJsOptionsCompat(
{ this },
compilerOptions
@@ -61,6 +61,7 @@ abstract class KotlinCompile @Inject constructor(
K2MultiplatformCompilationTask,
@Suppress("TYPEALIAS_EXPANSION_DEPRECATION") KotlinJvmCompileDsl {
@Deprecated(KOTLIN_OPTIONS_DEPRECATION_MESSAGE)
final override val kotlinOptions: KotlinJvmOptions = KotlinJvmOptionsCompat(
{ this },
compilerOptions
@@ -40,7 +40,7 @@ import javax.inject.Inject
@CacheableTask
abstract class KotlinCompileCommon @Inject constructor(
override val compilerOptions: KotlinMultiplatformCommonCompilerOptions,
final override val compilerOptions: KotlinMultiplatformCommonCompilerOptions,
workerExecutor: WorkerExecutor,
objectFactory: ObjectFactory
) : AbstractKotlinCompile<K2MetadataCompilerArguments>(objectFactory, workerExecutor),
@@ -51,6 +51,7 @@ abstract class KotlinCompileCommon @Inject constructor(
compilerOptions.verbose.convention(logger.isDebugEnabled)
}
@Deprecated(KOTLIN_OPTIONS_DEPRECATION_MESSAGE)
override val kotlinOptions: KotlinMultiplatformCommonOptions = KotlinMultiplatformCommonOptionsCompat(
{ this },
compilerOptions