Deprecate 'kotlin.coroutines' property and extension

Deprecation 'kotlin.coroutines' property and related
'kotlin.experimental.coroutines' extension DSL. These properties
are not doing anything since 1.5.0 release and has to be removed long
time ago.

^KT-50369 Fixed
This commit is contained in:
Yahor Berdnikau
2021-12-23 17:53:41 +01:00
committed by Space
parent 5de0f78350
commit 8bdb19a11e
2 changed files with 29 additions and 3 deletions
@@ -23,16 +23,18 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrSingleTargetPreset
import org.jetbrains.kotlin.gradle.tasks.CompileUsingKotlinDaemon
import org.jetbrains.kotlin.gradle.tasks.withType
import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
import org.jetbrains.kotlin.statistics.metrics.StringMetrics
import javax.inject.Inject
import kotlin.reflect.KClass
private const val KOTLIN_PROJECT_EXTENSION_NAME = "kotlin"
internal fun Project.createKotlinExtension(extensionClass: KClass<out KotlinTopLevelExtension>): KotlinTopLevelExtension {
val kotlinExt = extensions.create(KOTLIN_PROJECT_EXTENSION_NAME, extensionClass.java, this)
DslObject(kotlinExt).extensions.create("experimental", ExperimentalExtension::class.java)
DslObject(kotlinExt).extensions.create("experimental", ExperimentalExtension::class.java, this)
return topLevelExtension
}
@@ -286,8 +288,20 @@ open class KotlinAndroidProjectExtension(project: Project) : KotlinSingleTargetE
open fun target(body: KotlinAndroidTarget.() -> Unit) = target.run(body)
}
open class ExperimentalExtension {
open class ExperimentalExtension @Inject constructor(
private val project: Project
) {
var coroutines: Coroutines? = null
set(value) {
SingleWarningPerBuild.show(
project,
"""
'kotlin.experimental.coroutines' option does nothing since 1.5.0 release
and scheduled to be removed in Kotlin 1.7.0 release!
""".trimIndent()
)
field = value
}
}
enum class Coroutines {
@@ -75,7 +75,19 @@ internal class PropertiesProvider private constructor(private val project: Proje
}
val coroutines: Coroutines?
get() = property("kotlin.coroutines")?.let { Coroutines.byCompilerArgument(it) }
get() {
val propValue = property("kotlin.coroutines")?.let { Coroutines.byCompilerArgument(it) }
if (propValue != null) {
SingleWarningPerBuild.show(
project,
"""
'kotlin.coroutines' property does nothing since 1.5.0 release
and scheduled to be removed in Kotlin 1.7.0 release!
""".trimIndent()
)
}
return propValue
}
val singleBuildMetricsFile: File?
get() = property("kotlin.internal.single.build.metrics.file")?.let { File(it) }