chore: use Java 17 for building the build scripts

This commit is contained in:
Vladimir Sitnikov 2023-11-24 13:17:19 +03:00
parent b080ca648f
commit 9b4221a23e
2 changed files with 4 additions and 19 deletions

View File

@ -39,7 +39,7 @@ dependencies {
val currentJava = JavaVersion.current()
if (currentJava > JavaVersion.VERSION_1_8) {
// We want an LTS Java release for build script compilation
val latestSupportedLts = listOf("25", "21", "17", "11")
val latestSupportedLts = listOf("17", "11")
.intersect(JvmTarget.values().mapTo(mutableSetOf()) { it.target })
.first { JavaVersion.toVersion(it) <= currentJava }

View File

@ -15,9 +15,6 @@
* limitations under the License.
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("java-library")
id("org.gradle.kotlin.kotlin-dsl") // this is 'kotlin-dsl' without version
@ -28,20 +25,8 @@ tasks.validatePlugins {
enableStricterValidation.set(true)
}
val currentJava = JavaVersion.current()
if (currentJava > JavaVersion.VERSION_1_8) {
// We want an LTS Java release for build script compilation
val latestSupportedLts = listOf("25", "21", "17", "11")
.intersect(JvmTarget.values().mapTo(mutableSetOf()) { it.target })
.first { JavaVersion.toVersion(it) <= currentJava }
tasks.withType<JavaCompile>().configureEach {
options.release.set(JavaVersion.toVersion(latestSupportedLts).majorVersion.toInt())
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = latestSupportedLts
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}