Restore 'KotlinGradleSubplugin' as marker interface.

This avoids build failure in 'buildSrc' module with 'kotlin-dsl' applied
with 'ClassNotFound' exception.

^KT-51378 Fixed
This commit is contained in:
Yahor Berdnikau
2022-02-18 13:42:18 +01:00
committed by Space
parent 2173ce77d5
commit 9d0d26e15d
2 changed files with 39 additions and 1 deletions
@@ -116,3 +116,10 @@ interface KotlinCompilerPluginSupportPlugin : Plugin<Project> {
open class SubpluginArtifact(val groupId: String, val artifactId: String, val version: String? = null)
class JetBrainsSubpluginArtifact(artifactId: String) : SubpluginArtifact(groupId = "org.jetbrains.kotlin", artifactId = artifactId)
/**
* Marker interface left here for backward compatibility with older plugin versions.
* Remove once minimal supported Gradle version will use Kotlin 1.7+.
*/
@Deprecated(level = DeprecationLevel.HIDDEN, message = "")
interface KotlinGradleSubplugin
@@ -11,7 +11,6 @@ import org.jetbrains.kotlin.gradle.testbase.*
import org.jetbrains.kotlin.gradle.util.checkBytecodeContains
import org.jetbrains.kotlin.test.util.JUnit4Assertions.assertTrue
import org.junit.jupiter.api.DisplayName
import kotlin.io.path.readText
@DisplayName("Other plugins tests")
@OtherGradlePluginTests
@@ -212,4 +211,36 @@ class SubpuginsIT : KGPBaseTest() {
}
}
}
@DisplayName("KT-51378: Using 'kotlin-dsl' with latest plugin version in buildSrc module")
@GradleTestVersions(
minVersion = TestVersions.Gradle.G_6_8 // Gradle usage of sam-with-receivers subplugin was added in this version
)
@GradleTest
fun testBuildSrcKotlinDSL(gradleVersion: GradleVersion) {
project("buildSrcUsingKotlinCompilationAndKotlinPlugin", gradleVersion) {
subProject("buildSrc").buildGradleKts.modify {
//language=kts
"""
${it.substringBefore("}")}
}
buildscript {
val kotlin_version: String by extra
repositories {
mavenLocal()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${'$'}kotlin_version")
}
}
${it.substringAfter("}")}
""".trimIndent()
}
build("assemble")
}
}
}