Skip to content

Commit

Permalink
kotlinTarget nd javaTarget managed in libs.versions.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Aug 30, 2024
1 parent 69a5957 commit 281cd0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
28 changes: 15 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -72,26 +72,28 @@ subprojects {
// set up according to https://jakewharton.com/gradle-toolchains-are-rarely-a-good-idea/
withType<KotlinJvmCompile> {
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<JavaCompile> {
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<JavaPluginExtension> {
withJavadocJar()
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[versions]
kotlinTarget = "2.0"
javaTarget = "17"

kotlin = "2.0.20"
kotlinxCoroutines = "1.8.1"
kotest = "5.9.1"
Expand Down

0 comments on commit 281cd0f

Please sign in to comment.