diff options
author | Jonas Herzig <jonas@spark-squared.com> | 2022-05-10 11:11:27 +0200 |
---|---|---|
committer | Jonas Herzig <jonas@spark-squared.com> | 2022-05-10 11:11:27 +0200 |
commit | aac68af7dbad25b29531b8544c100c497146c250 (patch) | |
tree | 73364c9157b43b31ec06b306164b8b2aa23f018e /build.gradle.kts | |
parent | c7eaf63caad15b8e1935be5acc9b85fd3765faa9 (diff) | |
download | Remap-aac68af7dbad25b29531b8544c100c497146c250.tar.gz Remap-aac68af7dbad25b29531b8544c100c497146c250.tar.bz2 Remap-aac68af7dbad25b29531b8544c100c497146c250.zip |
Add support for kotlin-compiler-embeddable 1.6.20
While, unlike last time, maintaining backwards compatibility with 1.5.21 (and
anything in between).
Diffstat (limited to 'build.gradle.kts')
-rw-r--r-- | build.gradle.kts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index c3bba96..b6214a3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,6 +20,9 @@ repositories { val testA by sourceSets.creating val testB by sourceSets.creating +kotlinVersion("1.5.21", isPrimaryVersion = true) +kotlinVersion("1.6.20") + dependencies { api("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.21") implementation(kotlin("stdlib")) @@ -49,3 +52,32 @@ publishing { tasks.test { useJUnitPlatform() } + +fun kotlinVersion(version: String, isPrimaryVersion: Boolean = false) { + val name = version.replace(".", "") + + val sourceSet = sourceSets.create("kotlin$name") + + val testClasspath = configurations.create("kotlin${name}TestClasspath") { + extendsFrom(configurations.testRuntimeClasspath.get()) + extendsFrom(configurations[sourceSet.compileOnlyConfigurationName]) + } + + dependencies { + implementation(sourceSet.output) + sourceSet.compileOnlyConfigurationName("org.jetbrains.kotlin:kotlin-compiler-embeddable:$version") + } + + tasks.jar { + from(sourceSet.output) + } + + if (!isPrimaryVersion) { + val testTask = tasks.register("testKotlin$name", Test::class) { + useJUnitPlatform() + testClassesDirs = sourceSets.test.get().output.classesDirs + classpath = testClasspath + sourceSets.test.get().output + sourceSets.main.get().output + } + tasks.check { dependsOn(testTask) } + } +} |