Change KotlinGradleSubplugin deprecation level to ERROR.

^KT-48830 Fixed
This commit is contained in:
Yahor Berdnikau
2021-09-27 16:45:36 +02:00
committed by Space
parent e15cfe8f70
commit 60cbfbf107
10 changed files with 13 additions and 12 deletions
@@ -20,7 +20,7 @@ import org.gradle.api.Project
import org.gradle.api.tasks.compile.AbstractCompile
import org.jetbrains.kotlin.gradle.plugin.*
class ExampleLegacySubplugin : @Suppress("DEPRECATION") KotlinGradleSubplugin<AbstractCompile> {
class ExampleLegacySubplugin : @Suppress("DEPRECATION_ERROR") KotlinGradleSubplugin<AbstractCompile> {
override fun isApplicable(project: Project, task: AbstractCompile): Boolean {
return true
@@ -29,7 +29,7 @@ import javax.inject.Inject
class AllOpenGradleSubplugin @Inject internal constructor(private val registry: ToolingModelBuilderRegistry) :
KotlinCompilerPluginSupportPlugin,
@Suppress("DEPRECATION") // implementing to fix KT-39809
@Suppress("DEPRECATION_ERROR") // implementing to fix KT-39809
KotlinGradleSubplugin<AbstractCompile> {
companion object {
@@ -70,7 +70,8 @@ open class InternalSubpluginOption(key: String, value: String) : SubpluginOption
message = "This interface will be removed due to performance considerations. " +
"Please use the KotlinCompilerPluginSupportPlugin interface instead " +
"and remove the META-INF/services/org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin entry.",
replaceWith = ReplaceWith("KotlinCompilerPluginSupportPlugin")
replaceWith = ReplaceWith("KotlinCompilerPluginSupportPlugin"),
level = DeprecationLevel.ERROR
)
interface KotlinGradleSubplugin<in KotlinCompile : AbstractCompile> {
fun isApplicable(project: Project, task: AbstractCompile): Boolean
@@ -839,7 +839,7 @@ private val BaseVariant.dataBindingDependencyArtifactsIfSupported: FileCollectio
?.invoke(this) as? FileCollection
//region Stub implementation for legacy API, KT-39809
@Suppress("DEPRECATION") // implementing to fix KT-39809
@Suppress("DEPRECATION_ERROR") // implementing to fix KT-39809
class Kapt3KotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
override fun isApplicable(project: Project, task: AbstractCompile): Boolean = false
@@ -27,7 +27,7 @@ class SubpluginEnvironment(
fun loadSubplugins(project: Project): SubpluginEnvironment {
val kotlinPluginVersion = project.getKotlinPluginVersion()
return try {
@Suppress("DEPRECATION") // support for the deprecated plugin API
@Suppress("DEPRECATION_ERROR") // support for the deprecated plugin API
val klass = KotlinGradleSubplugin::class.java
val buildscriptClassloader = project.buildscript.classLoader
val klassFromBuildscript = try {
@@ -44,7 +44,7 @@ class SubpluginEnvironment(
val result = project.plugins.filterIsInstance<KotlinCompilerPluginSupportPlugin>()
@Suppress("DEPRECATION", "UNCHECKED_CAST")
@Suppress("DEPRECATION_ERROR", "UNCHECKED_CAST")
val compatibilitySubplugins = ServiceLoader.load(klass, classloader)
.filter { it !is KotlinCompilerPluginSupportPlugin }
.map { LegacyKotlinCompilerPluginSupportPlugin(it as KotlinGradleSubplugin<AbstractCompile>) }
@@ -139,7 +139,7 @@ internal fun addCompilationSourcesToExternalCompileTask(compilation: KotlinCompi
}
internal class LegacyKotlinCompilerPluginSupportPlugin(
@Suppress("deprecation") // support for deprecated API
@Suppress("DEPRECATION_ERROR") // support for deprecated API
val oldPlugin: KotlinGradleSubplugin<AbstractCompile>
) : KotlinCompilerPluginSupportPlugin {
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean =
@@ -213,7 +213,7 @@ private fun Configuration.discoverScriptExtensionsFiles() =
class ScriptingKotlinGradleSubplugin :
KotlinCompilerPluginSupportPlugin,
@Suppress("DEPRECATION") // implementing to fix KT-39809
@Suppress("DEPRECATION_ERROR") // implementing to fix KT-39809
KotlinGradleSubplugin<KotlinCompile> {
companion object {
const val SCRIPTING_ARTIFACT_NAME = "kotlin-scripting-compiler-embeddable"
@@ -73,7 +73,7 @@ class AndroidExtensionsSubpluginIndicator @Inject internal constructor(private v
class AndroidSubplugin :
KotlinCompilerPluginSupportPlugin,
@Suppress("DEPRECATION") // implementing to fix KT-39809
@Suppress("DEPRECATION_ERROR") // implementing to fix KT-39809
KotlinGradleSubplugin<AbstractCompile>
{
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean {
@@ -29,7 +29,7 @@ import javax.inject.Inject
class NoArgGradleSubplugin @Inject internal constructor(private val registry: ToolingModelBuilderRegistry) :
KotlinCompilerPluginSupportPlugin,
@Suppress("DEPRECATION") // implementing to fix KT-39809
@Suppress("DEPRECATION_ERROR") // implementing to fix KT-39809
KotlinGradleSubplugin<AbstractCompile> {
companion object {
@@ -29,7 +29,7 @@ import javax.inject.Inject
class SamWithReceiverGradleSubplugin @Inject internal constructor(private val registry: ToolingModelBuilderRegistry) :
KotlinCompilerPluginSupportPlugin,
@Suppress("DEPRECATION") // implementing to fix KT-39809
@Suppress("DEPRECATION_ERROR") // implementing to fix KT-39809
KotlinGradleSubplugin<AbstractCompile> {
override fun apply(target: Project) {
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
class SerializationGradleSubplugin :
KotlinCompilerPluginSupportPlugin,
@Suppress("DEPRECATION") // implementing to fix KT-39809
@Suppress("DEPRECATION_ERROR") // implementing to fix KT-39809
KotlinGradleSubplugin<AbstractCompile> {
companion object {