From a0a0f3f29077156abb45ff7f0173d02c67024c2d Mon Sep 17 00:00:00 2001 From: squid233 <60126026+squid233@users.noreply.github.com> Date: Sat, 7 Dec 2024 12:02:56 +0800 Subject: [PATCH] chore: Update build script --- build.gradle.kts | 6 +++--- buildSrc/build.gradle.kts | 7 +++++++ buildSrc/gradle.properties | 1 + .../kotlin/generator.conventions.gradle.kts | 17 ++++------------- .../overrungl/nfd/NFDGenerator.kt | 0 modules/overrungl.joml/build.gradle.kts | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) rename generators/nfd/src/main/{java => kotlin}/overrungl/nfd/NFDGenerator.kt (100%) diff --git a/build.gradle.kts b/build.gradle.kts index d7a7aed7..d2ae36dd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,9 +4,9 @@ plugins { signing } -val projGroupId: String by project -val projVersion: String by project -val projLicenseYear: String by project +val projGroupId: String by rootProject +val projVersion: String by rootProject +val projLicenseYear: String by rootProject val jdkVersion: String by rootProject val jdkEnablePreview: String by rootProject diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index c0857ae3..7e7e468b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,6 +1,7 @@ plugins { `kotlin-dsl` } val kotlinPluginVersion: String by rootProject +val kotlinTargetJdkVersion: String by rootProject repositories { mavenCentral() @@ -9,3 +10,9 @@ repositories { dependencies { implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:$kotlinPluginVersion") } + +kotlin { + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(kotlinTargetJdkVersion)) + } +} diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties index eb16f338..ac7ae9f0 100644 --- a/buildSrc/gradle.properties +++ b/buildSrc/gradle.properties @@ -1 +1,2 @@ kotlinPluginVersion=2.1.0 +kotlinTargetJdkVersion=22 diff --git a/buildSrc/src/main/kotlin/generator.conventions.gradle.kts b/buildSrc/src/main/kotlin/generator.conventions.gradle.kts index 0177aad5..a6b8613d 100644 --- a/buildSrc/src/main/kotlin/generator.conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/generator.conventions.gradle.kts @@ -1,10 +1,6 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - plugins { kotlin("jvm") } val javaPoetVersion: String by rootProject -val jdkVersion: String by rootProject val kotlinTargetJdkVersion: String by rootProject repositories { @@ -15,13 +11,8 @@ dependencies { implementation("com.palantir.javapoet:javapoet:$javaPoetVersion") } -tasks.withType { - compilerOptions { jvmTarget.set(JvmTarget.fromTarget(kotlinTargetJdkVersion)) } -} - -tasks.withType { - javaCompiler.set(javaToolchains.compilerFor { - targetCompatibility = kotlinTargetJdkVersion - languageVersion.set(JavaLanguageVersion.of(jdkVersion)) - }) +kotlin { + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(kotlinTargetJdkVersion)) + } } diff --git a/generators/nfd/src/main/java/overrungl/nfd/NFDGenerator.kt b/generators/nfd/src/main/kotlin/overrungl/nfd/NFDGenerator.kt similarity index 100% rename from generators/nfd/src/main/java/overrungl/nfd/NFDGenerator.kt rename to generators/nfd/src/main/kotlin/overrungl/nfd/NFDGenerator.kt diff --git a/modules/overrungl.joml/build.gradle.kts b/modules/overrungl.joml/build.gradle.kts index 557fecb6..2a11a8a1 100644 --- a/modules/overrungl.joml/build.gradle.kts +++ b/modules/overrungl.joml/build.gradle.kts @@ -8,7 +8,7 @@ overrunglModule { publishInfo = Artifact.JOML } -val jomlVersion: String by project +val jomlVersion: String by rootProject dependencies { api("org.joml:joml:$jomlVersion")