Deprecate 'kapt.use.workers.api' property.
^KT-48826 Fixed
This commit is contained in:
+14
-3
@@ -107,7 +107,11 @@ class Kapt3GradleSubplugin @Inject internal constructor(private val registry: To
|
||||
}
|
||||
|
||||
fun Project.isUseWorkerApi(): Boolean {
|
||||
return getBooleanOptionValue(BooleanOption.KAPT_USE_WORKER_API)
|
||||
return getBooleanOptionValue(BooleanOption.KAPT_USE_WORKER_API) {
|
||||
"""
|
||||
|'${BooleanOption.KAPT_USE_WORKER_API}' is deprecated and scheduled to be removed in Kotlin 1.7 release.
|
||||
""".trimMargin()
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.isIncrementalKapt(): Boolean {
|
||||
@@ -174,8 +178,15 @@ class Kapt3GradleSubplugin @Inject internal constructor(private val registry: To
|
||||
fun isEnabled(project: Project) =
|
||||
project.plugins.any { it is Kapt3GradleSubplugin }
|
||||
|
||||
private fun Project.getBooleanOptionValue(booleanOption: BooleanOption): Boolean {
|
||||
return when (val value = findProperty(booleanOption.optionName)) {
|
||||
private fun Project.getBooleanOptionValue(
|
||||
booleanOption: BooleanOption,
|
||||
deprecationMessage: (() -> String)? = null
|
||||
): Boolean {
|
||||
val value = findProperty(booleanOption.optionName)
|
||||
if (value != null && deprecationMessage != null) {
|
||||
logger.warn(deprecationMessage())
|
||||
}
|
||||
return when (value) {
|
||||
is Boolean -> value
|
||||
is String -> when {
|
||||
value.equals("true", ignoreCase = true) -> true
|
||||
|
||||
Reference in New Issue
Block a user