From 281cd0fed1269c2ed9ad040edd15a91563e71bcb Mon Sep 17 00:00:00 2001 From: Kazik Pogoda Date: Fri, 30 Aug 2024 14:04:23 +0200 Subject: [PATCH] kotlinTarget nd javaTarget managed in libs.versions.toml --- build.gradle.kts | 28 +++++++++++++++------------- gradle/libs.versions.toml | 3 +++ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 446124e..358d983 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -33,11 +33,11 @@ plugins { alias(libs.plugins.publish) } -val javaTargetVersion = 17 -val kotlinTargetVersion = KotlinVersion.KOTLIN_2_0 -val jvmTargetVersion = JvmTarget.fromTarget("$javaTargetVersion") - val githubAccount = "xemantic" + +val javaTarget = libs.versions.javaTarget.get() +val kotlinTarget = KotlinVersion.fromVersion(libs.versions.kotlinTarget.get()) + val isReleaseBuild = !project.version.toString().endsWith("-SNAPSHOT") val githubActor: String? by project val githubToken: String? by project @@ -72,26 +72,28 @@ subprojects { // set up according to https://jakewharton.com/gradle-toolchains-are-rarely-a-good-idea/ withType { compilerOptions { - apiVersion = kotlinTargetVersion - languageVersion = kotlinTargetVersion - jvmTarget = jvmTargetVersion - freeCompilerArgs.add("-Xjdk-release=$javaTargetVersion") + apiVersion = kotlinTarget + languageVersion = kotlinTarget + jvmTarget = JvmTarget.fromTarget(javaTarget) + freeCompilerArgs.add("-Xjdk-release=$javaTarget") progressiveMode = true } } withType { - options.release = javaTargetVersion + options.release = javaTarget.toInt() } } if (project.name.startsWith(rootProject.name)) { - apply(plugin = "maven-publish") - apply(plugin = "java-library") - apply(plugin = "org.jetbrains.dokka") - apply(plugin = "signing") + apply { + plugin("maven-publish") + plugin("java-library") + plugin("org.jetbrains.dokka") + plugin("signing") + } configure { withJavadocJar() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 854b0d5..e25fbaf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,4 +1,7 @@ [versions] +kotlinTarget = "2.0" +javaTarget = "17" + kotlin = "2.0.20" kotlinxCoroutines = "1.8.1" kotest = "5.9.1"