From b17021bded9b2e33ade811f46ecfadae70994447 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 16 Oct 2024 09:14:08 +0300 Subject: [PATCH] Use newer way of configuring the Kotlin compiler in Gradle Currently, the generated projects use: ```gradle tasks.withType { kotlinOptions.jvmTarget = JavaVersion.VERSION_21.toString() kotlinOptions.javaParameters = true } ``` however org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions (the type of kotlinOptions) has been deprecated and the new way to configure stuff is described in: https://kotlinlang.org/docs/gradle-compiler-options.html --- docs/src/main/asciidoc/kotlin.adoc | 8 +++++--- .../gradle-kotlin-dsl/kotlin/build.tpl.qute.gradle.kts | 8 +++++--- .../testGradleKotlinContent/build.gradle.kts | 8 +++++--- .../conditional-dependencies-kotlin/build.gradle.kts | 8 +++++--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/docs/src/main/asciidoc/kotlin.adoc b/docs/src/main/asciidoc/kotlin.adoc index 2ff3227ba340a..767e610cf8af8 100644 --- a/docs/src/main/asciidoc/kotlin.adoc +++ b/docs/src/main/asciidoc/kotlin.adoc @@ -301,9 +301,11 @@ allOpen { // <2> annotation("io.quarkus.test.junit.QuarkusTest") } -tasks.withType { - kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString() - kotlinOptions.javaParameters = true +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21 + javaParameters = true + } } ---- diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle-kotlin-dsl/kotlin/build.tpl.qute.gradle.kts b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle-kotlin-dsl/kotlin/build.tpl.qute.gradle.kts index 3005bf160cd0b..69dd5db777700 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle-kotlin-dsl/kotlin/build.tpl.qute.gradle.kts +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle-kotlin-dsl/kotlin/build.tpl.qute.gradle.kts @@ -25,7 +25,9 @@ allOpen { annotation("io.quarkus.test.junit.QuarkusTest") } -tasks.withType { - kotlinOptions.jvmTarget = JavaVersion.VERSION_{java.version}.toString() - kotlinOptions.javaParameters = true +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_{java.version} + javaParameters = true + } } diff --git a/integration-tests/devtools/src/test/resources/__snapshots__/KotlinSerializationCodestartTest/testGradleKotlinContent/build.gradle.kts b/integration-tests/devtools/src/test/resources/__snapshots__/KotlinSerializationCodestartTest/testGradleKotlinContent/build.gradle.kts index 29e2753624387..4206a766670ad 100644 --- a/integration-tests/devtools/src/test/resources/__snapshots__/KotlinSerializationCodestartTest/testGradleKotlinContent/build.gradle.kts +++ b/integration-tests/devtools/src/test/resources/__snapshots__/KotlinSerializationCodestartTest/testGradleKotlinContent/build.gradle.kts @@ -43,7 +43,9 @@ allOpen { annotation("io.quarkus.test.junit.QuarkusTest") } -tasks.withType { - kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() - kotlinOptions.javaParameters = true +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + javaParameters = true + } } diff --git a/integration-tests/gradle/src/main/resources/conditional-dependencies-kotlin/build.gradle.kts b/integration-tests/gradle/src/main/resources/conditional-dependencies-kotlin/build.gradle.kts index 007458ade94b9..5dea13880a16b 100644 --- a/integration-tests/gradle/src/main/resources/conditional-dependencies-kotlin/build.gradle.kts +++ b/integration-tests/gradle/src/main/resources/conditional-dependencies-kotlin/build.gradle.kts @@ -45,7 +45,9 @@ allOpen { annotation("io.quarkus.test.junit.QuarkusTest") } -tasks.withType { - kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() - kotlinOptions.javaParameters = true +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + javaParameters = true + } }