Fix warning message was not showing correct property name

Show this message only once per build.

^KT-48826 Fixed
This commit is contained in:
Yahor Berdnikau
2021-12-06 16:10:40 +01:00
committed by Space
parent bf57e33713
commit 8ed0c17ebd
@@ -37,6 +37,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmAndroidCompilation
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.locateTask
import org.jetbrains.kotlin.gradle.tasks.registerTask
import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
import org.jetbrains.kotlin.gradle.utils.isConfigurationCacheAvailable
import java.io.ByteArrayOutputStream
import java.io.File
@@ -109,7 +110,10 @@ class Kapt3GradleSubplugin @Inject internal constructor(private val registry: To
fun Project.isUseWorkerApi(): Boolean {
return getBooleanOptionValue(BooleanOption.KAPT_USE_WORKER_API) {
"""
|'${BooleanOption.KAPT_USE_WORKER_API}' is deprecated and scheduled to be removed in Kotlin 1.7 release.
|Warning: '${BooleanOption.KAPT_USE_WORKER_API.optionName}' is deprecated and scheduled to be removed in Kotlin 1.8 release.
|
|By default Kapt plugin is using Gradle workers to run annotation processing. Running annotation processing
|directly in the Kotlin compiler is deprecated.
""".trimMargin()
}
}
@@ -184,7 +188,7 @@ class Kapt3GradleSubplugin @Inject internal constructor(private val registry: To
): Boolean {
val value = findProperty(booleanOption.optionName)
if (value != null && deprecationMessage != null) {
logger.warn(deprecationMessage())
SingleWarningPerBuild.show(this, deprecationMessage())
}
return when (value) {
is Boolean -> value