From 05671cfa3ee084971af29e80e8cb70ff122e342e Mon Sep 17 00:00:00 2001 From: Josh-Larson Date: Sat, 30 Nov 2024 16:02:45 -0600 Subject: [PATCH] Added auto-detect kotlin/java version to build.gradle.kts --- build.gradle.kts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f50be7a..98bdbfd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + /*********************************************************************************** * Copyright (c) 2023 /// Project SWG /// www.projectswg.com * * * @@ -31,16 +33,15 @@ plugins { kotlin("jvm") } -val javaVersion: String by ext -val javaMajorVersion: String by ext -val kotlinTargetJdk: String by ext +val javaVersion = JavaVersion.current() +val kotlinTargetJdk = JvmTarget.fromTarget(javaVersion.majorVersion) +val junit5Version: String by ext java { modularity.inferModulePath.set(true) } idea { - targetVersion = javaVersion module { inheritOutputDirs = true } @@ -52,15 +53,15 @@ repositories { } dependencies { - api(group="org.jetbrains", name="annotations", version="20.1.0") + api(group="org.jetbrains", name="annotations", version="26.0.1") api(group="me.joshlarson", name="jlcommon", version="1.10.1") - api(group="org.bouncycastle", name="bcprov-jdk18on", version="1.71") + api(group="org.bouncycastle", name="bcprov-jdk18on", version="1.79") implementation(kotlin("stdlib")) - implementation(group="org.mongodb", name="mongodb-driver-sync", version="4.11.1") + implementation(group="org.mongodb", name="mongodb-driver-sync", version="5.2.1") - testImplementation(group="org.junit.jupiter", name="junit-jupiter-api", version="5.8.1") - testImplementation(group="org.junit.jupiter", name="junit-jupiter-params", version="5.8.1") - testRuntimeOnly(group="org.junit.jupiter", name="junit-jupiter-engine", version="5.8.1") + testImplementation(group="org.junit.jupiter", name="junit-jupiter-api", version=junit5Version) + testImplementation(group="org.junit.jupiter", name="junit-jupiter-params", version=junit5Version) + testRuntimeOnly(group="org.junit.jupiter", name="junit-jupiter-engine", version=junit5Version) } tasks.withType { @@ -68,8 +69,8 @@ tasks.withType { } tasks.withType().configureEach { - kotlinOptions { - jvmTarget = kotlinTargetJdk + compilerOptions { + jvmTarget.set(kotlinTargetJdk) } destinationDirectory.set(File(destinationDirectory.get().asFile.path.replace("kotlin", "java"))) }