From 43fa4e0cdc93aae20cae0bd53ef6c4aff3b9a43d Mon Sep 17 00:00:00 2001 From: BoD Date: Tue, 8 Oct 2024 20:02:20 +0200 Subject: [PATCH] Use kotlin-test 2.0 in apollo-compiler in order to not break generated code compilation with 1.9 --- gradle/libraries.toml | 2 ++ libraries/apollo-compiler/build.gradle.kts | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gradle/libraries.toml b/gradle/libraries.toml index 100a744761..b544e0422e 100644 --- a/gradle/libraries.toml +++ b/gradle/libraries.toml @@ -133,6 +133,8 @@ kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib- kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test" } # the Kotlin plugin resolves the version kotlin-test-js = { group = "org.jetbrains.kotlin", name = "kotlin-test-js" } # the Kotlin plugin resolves the version kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit" } # the Kotlin plugin resolves the version +kotlin-test-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin-stdlib" } # use the same version as the stdlib +kotlin-test-junit-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin-stdlib" } # use the same version as the stdlib kotlinx-benchmark-runtime = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.8" kotlinx-benchmark = "org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.4.12" kotlinx-browser = "org.jetbrains.kotlinx:kotlinx-browser:0.2" diff --git a/libraries/apollo-compiler/build.gradle.kts b/libraries/apollo-compiler/build.gradle.kts index cf2c44e288..6ad9804084 100644 --- a/libraries/apollo-compiler/build.gradle.kts +++ b/libraries/apollo-compiler/build.gradle.kts @@ -24,7 +24,9 @@ dependencies { testImplementation(libs.kotlin.compiletesting) testImplementation(libs.google.testing.compile) testImplementation(libs.truth) - testImplementation(libs.kotlin.test.junit) + testImplementation(libs.kotlin.test.junit.stdlib) { + because("We compile the generated code with Kotlin 1.9, which doesn't understand classes compiled with 2.1") + } testImplementation(libs.google.testparameterinjector) testImplementation(project(":apollo-api-java")) { because("Generated Java code references Java and Guava Optionals") @@ -82,3 +84,10 @@ tasks.withType().configureEach { addRelativeInput("usedtypesDir","src/test/usedtypes") addRelativeInput("validationDir", "src/test/validation") } + +configurations.all { + resolutionStrategy { + // We compile the generated code with Kotlin 1.9, which doesn't understand classes compiled with 2.1 + force(libs.kotlin.test.stdlib.get()) + } +}