From dd056c3787e15b365fe99955e94c82ce332e7e29 Mon Sep 17 00:00:00 2001 From: Franklin Wang <9077461+gnawf@users.noreply.github.com> Date: Wed, 8 Nov 2023 15:34:39 +1300 Subject: [PATCH] Upgrade Kotlin and other libraries (#469) * Upgrade Kotlin to 1.9.20 * Upgrade other libraries --- build.gradle | 19 +++++++++++++------ lib/build.gradle.kts | 19 ++++++++----------- .../test/kotlin/graphql/nadel/test/Mocking.kt | 6 +++--- test/build.gradle.kts | 4 +--- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index a42d85782..547a7fa99 100644 --- a/build.gradle +++ b/build.gradle @@ -1,16 +1,23 @@ import java.text.SimpleDateFormat plugins { - id "org.jetbrains.kotlin.jvm" version "1.6.10" + id "org.jetbrains.kotlin.jvm" version "1.9.20" id "com.jfrog.artifactory" version "4.29.2" id "biz.aQute.bnd.builder" version "6.3.1" - id "com.bnorm.power.kotlin-power-assert" version "0.11.0" + id "com.bnorm.power.kotlin-power-assert" version "0.13.0" } -if (JavaVersion.current() != JavaVersion.VERSION_11) { - def msg = String.format("This build must be run with Java 11 - you are running %s - Gradle finds the JDK via JAVA_HOME=%s", - JavaVersion.current(), System.getenv("JAVA_HOME")) - throw new GradleException(msg) +allprojects { + java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } + } + kotlin { + jvmToolchain { + languageVersion = JavaLanguageVersion.of(11) + } + } } def getDevelopmentVersion() { diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 0d91a01de..220134fa6 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -19,17 +19,16 @@ dependencies { api(kotlin("stdlib")) api(kotlin("reflect")) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") - api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.0") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") + api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.7.3") testImplementation("org.slf4j:slf4j-simple:$slf4jVersion") - testImplementation("com.fasterxml.jackson.core:jackson-databind:2.9.6") - testImplementation("org.openjdk.jmh:jmh-core:1.21") - testImplementation("org.openjdk.jmh:jmh-generator-annprocess:1.21") - testImplementation("com.google.guava:guava:28.0-jre") - testImplementation("io.kotest:kotest-runner-junit5:5.1.0") - testImplementation("io.kotest:kotest-framework-datatest:5.1.0") - testImplementation("io.mockk:mockk:1.12.3") + testImplementation("com.fasterxml.jackson.core:jackson-databind:2.15.3") + testImplementation("org.openjdk.jmh:jmh-core:1.37") + testImplementation("org.openjdk.jmh:jmh-generator-annprocess:1.37") + testImplementation("io.kotest:kotest-runner-junit5:5.8.0") + testImplementation("io.kotest:kotest-framework-datatest:5.8.0") + testImplementation("io.mockk:mockk:1.13.8") } // compileJava.source file("build/generated-src"), sourceSets.main.java @@ -51,8 +50,6 @@ tasks.withType().configureEach { "-Xjvm-default=all", ) } - sourceCompatibility = JavaVersion.VERSION_11.toString() - targetCompatibility = JavaVersion.VERSION_11.toString() } configure { diff --git a/lib/src/test/kotlin/graphql/nadel/test/Mocking.kt b/lib/src/test/kotlin/graphql/nadel/test/Mocking.kt index a50f2ad19..68ac404e4 100644 --- a/lib/src/test/kotlin/graphql/nadel/test/Mocking.kt +++ b/lib/src/test/kotlin/graphql/nadel/test/Mocking.kt @@ -18,7 +18,7 @@ inline fun mock( MockKDsl.internalMockk( name, relaxed, - *moreInterfaces, + moreInterfaces, relaxUnitFun = relaxUnitFun, block = block ) @@ -44,7 +44,7 @@ inline fun spy( ): T = MockK.useImpl { MockKDsl.internalSpyk( name, - *moreInterfaces, + moreInterfaces, recordPrivateCalls = recordPrivateCalls, block = block ) @@ -67,7 +67,7 @@ inline fun spy( MockKDsl.internalSpyk( objToCopy, name, - *moreInterfaces, + moreInterfaces, recordPrivateCalls = recordPrivateCalls, block = block ) diff --git a/test/build.gradle.kts b/test/build.gradle.kts index 1d9062c5a..9402c059d 100644 --- a/test/build.gradle.kts +++ b/test/build.gradle.kts @@ -13,7 +13,7 @@ dependencies { testImplementation("org.reflections:reflections:0.9.12") testImplementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.6") testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.6") - testImplementation("io.kotest:kotest-runner-junit5:5.1.0") + testImplementation("io.kotest:kotest-runner-junit5:5.8.0") testImplementation("io.strikt:strikt-jvm:0.31.0") testImplementation("org.yaml:snakeyaml:1.30") } @@ -32,6 +32,4 @@ tasks.withType().configureEach { "-Xjvm-default=all", ) } - sourceCompatibility = JavaVersion.VERSION_11.toString() - targetCompatibility = JavaVersion.VERSION_11.toString() }