From 8b6671ce1278dd2c53706e94fb6ca452abe3869a Mon Sep 17 00:00:00 2001 From: Tadeas Kriz Date: Sun, 28 Jul 2024 22:54:21 -0400 Subject: [PATCH] Fix Gradle tests. --- .../annotations/impl/build.gradle.kts | 14 ++++++++++++++ SKIE/runtime/kotlin/impl/build.gradle.kts | 1 + .../skie/test/trait/gradle/BuildGradleBuilder.kt | 3 ++- .../skie/test/util/KotlinVersion.needsOldLinker.kt | 9 +++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/SKIE/common/configuration/annotations/impl/build.gradle.kts b/SKIE/common/configuration/annotations/impl/build.gradle.kts index 49f22c233..10b50bcd9 100644 --- a/SKIE/common/configuration/annotations/impl/build.gradle.kts +++ b/SKIE/common/configuration/annotations/impl/build.gradle.kts @@ -124,6 +124,20 @@ kotlin { @targets@ + sourceSets.commonMain { + dependencies { + compileOnly(kotlin("stdlib-common")) + } + } + + sourceSets["jvmMain"].dependencies { + compileOnly(kotlin("stdlib")) + } + + sourceSets["jsMain"].dependencies { + compileOnly(kotlin("stdlib-js")) + } + // jvm() // js { // browser() diff --git a/SKIE/runtime/kotlin/impl/build.gradle.kts b/SKIE/runtime/kotlin/impl/build.gradle.kts index acc120b63..4830e34bc 100644 --- a/SKIE/runtime/kotlin/impl/build.gradle.kts +++ b/SKIE/runtime/kotlin/impl/build.gradle.kts @@ -92,6 +92,7 @@ kotlin { sourceSets.commonMain { dependencies { + compileOnly(kotlin("stdlib-common")) @dependencies@ } } diff --git a/test-runner/src/test/kotlin/co/touchlab/skie/test/trait/gradle/BuildGradleBuilder.kt b/test-runner/src/test/kotlin/co/touchlab/skie/test/trait/gradle/BuildGradleBuilder.kt index 792ffb089..ee77d2303 100644 --- a/test-runner/src/test/kotlin/co/touchlab/skie/test/trait/gradle/BuildGradleBuilder.kt +++ b/test-runner/src/test/kotlin/co/touchlab/skie/test/trait/gradle/BuildGradleBuilder.kt @@ -4,6 +4,7 @@ import co.touchlab.skie.test.runner.BuildConfiguration import co.touchlab.skie.test.util.KotlinTarget import co.touchlab.skie.test.util.KotlinVersion import co.touchlab.skie.test.util.LinkMode +import co.touchlab.skie.test.util.coroutinesVersion import co.touchlab.skie.test.util.needsOldLinker import org.intellij.lang.annotations.Language @@ -142,7 +143,7 @@ class BuildGradleBuilder( fun includeCoroutinesDependency() { "sourceSets.commonMain" { "dependencies" { - +"""implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")""" + +"""implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${kotlinVersion.coroutinesVersion}")""" } } } diff --git a/test-runner/src/test/kotlin/co/touchlab/skie/test/util/KotlinVersion.needsOldLinker.kt b/test-runner/src/test/kotlin/co/touchlab/skie/test/util/KotlinVersion.needsOldLinker.kt index 4afaf78ea..87fe995a7 100644 --- a/test-runner/src/test/kotlin/co/touchlab/skie/test/util/KotlinVersion.needsOldLinker.kt +++ b/test-runner/src/test/kotlin/co/touchlab/skie/test/util/KotlinVersion.needsOldLinker.kt @@ -2,3 +2,12 @@ package co.touchlab.skie.test.util val KotlinVersion.needsOldLinker: Boolean get() = value.startsWith("1.8.") || value.startsWith("1.9.0") + +val KotlinVersion.coroutinesVersion: String + get() = when { + value.startsWith("2.0.") -> "1.9.0-RC" + value.startsWith("1.9.2") -> "1.8.1" + value.startsWith("1.9.") || value.startsWith("1.8.2") -> "1.7.3" + value.startsWith("1.8.") -> "1.6.4" + else -> error("Coroutines version not assigned for Kotlin version $value") + }