From 9ba86cf3cebe4cb42ce6c22c4dbb47f2f3b9a00c Mon Sep 17 00:00:00 2001 From: Jakub Chrzanowski Date: Wed, 16 Mar 2022 21:44:30 +0100 Subject: [PATCH] Use JVM toolchain for configuring source/target compilation compatibility --- .github/template-cleanup/gradle.properties | 3 --- CHANGELOG.md | 1 + build.gradle.kts | 19 +++++++------------ gradle.properties | 3 --- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/template-cleanup/gradle.properties b/.github/template-cleanup/gradle.properties index 06d8f87..cf51d7d 100644 --- a/.github/template-cleanup/gradle.properties +++ b/.github/template-cleanup/gradle.properties @@ -19,9 +19,6 @@ platformVersion = 2021.1.3 # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins = -# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3 -javaVersion = 11 - # Gradle Releases -> https://github.com/gradle/gradle/releases gradleVersion = 7.4.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d367bf..503a6ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## [Unreleased] ### Changed +- Use JVM toolchain for configuring source/target compilation compatibility - Dependencies (GitHub Actions) - upgrade `actions/checkout` to `3` - Upgrade Gradle Wrapper to `7.4.1` diff --git a/build.gradle.kts b/build.gradle.kts index 3dc6685..0e54ac0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,4 @@ import org.jetbrains.changelog.markdownToHTML -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile fun properties(key: String) = project.findProperty(key).toString() @@ -24,6 +23,13 @@ repositories { mavenCentral() } +// Set the JVM language level used to compile sources and generate files - Java 11 is required since 2020.3 +kotlin { + jvmToolchain { + (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11)) + } +} + // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin intellij { pluginName.set(properties("pluginName")) @@ -49,17 +55,6 @@ qodana { } tasks { - // Set the JVM compatibility versions - properties("javaVersion").let { - withType { - sourceCompatibility = it - targetCompatibility = it - } - withType { - kotlinOptions.jvmTarget = it - } - } - wrapper { gradleVersion = properties("gradleVersion") } diff --git a/gradle.properties b/gradle.properties index 1e2d556..d4464b8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,9 +19,6 @@ platformVersion = 2021.1.3 # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins = -# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3 -javaVersion = 11 - # Gradle Releases -> https://github.com/gradle/gradle/releases gradleVersion = 7.4.1