From e176385001e99e22e7c03674e3bb00283a44f92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linnea=20Gr=C3=A4f?= Date: Thu, 23 Nov 2023 18:05:17 +0100 Subject: [PATCH] Make use of version catalogue --- build.gradle.kts | 32 +++++++++++++------------------- common/build.gradle.kts | 24 ++++++++++++------------ gradle/libs.versions.toml | 27 +++++++++++++++++++++++++++ legacy/build.gradle.kts | 22 +++++++++++----------- modern/build.gradle.kts | 18 ++++++++++-------- 5 files changed, 73 insertions(+), 50 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index 7aef10063..b8f0a2cde 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,13 +3,7 @@ import java.io.ByteArrayOutputStream import java.net.URL plugins { - kotlin("jvm") version "1.8.21" - id("gg.essential.loom") version "0.10.0.+" apply false - id("dev.architectury.architectury-pack200") version "0.1.3" - id("xyz.wagyourtail.unimined") version "1.1.0-SNAPSHOT" apply false - id("org.jetbrains.dokka") version "1.8.10" - kotlin("plugin.lombok") version "1.8.21" - id("com.github.johnrengelman.shadow") version "8.1.1" apply false + alias(libs.plugins.dokka) } @@ -39,18 +33,18 @@ allprojects { maven("https://maven.neoforged.net/releases") } afterEvaluate { - (tasks.findByName("dokkaHtml") as? DokkaTask)?.apply { - dokkaSourceSets { - "main" { - sourceLink { - println(project.path) - localDirectory.set(file("src/main/")) - remoteUrl.set(URL("https://github.com/NotEnoughUpdates/MoulConfig/blob/$hash/src/main/")) - remoteLineSuffix.set("#L") - } - } - } - } +// (tasks.findByName("dokkaHtml") as? DokkaTask)?.apply { +// dokkaSourceSets { +// "main" { +// sourceLink { +// println(project.path) +// localDirectory.set(file("src/main/")) +// remoteUrl.set(URL("https://github.com/NotEnoughUpdates/MoulConfig/blob/$hash/src/main/")) +// remoteLineSuffix.set("#L") +// } +// } +// } +// } extensions.findByType()?.apply { repositories { if (project.hasProperty("moulconfigPassword")) { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 4e5504385..aefdc426f 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,8 +1,8 @@ plugins { java - kotlin("jvm") - id("org.jetbrains.dokka") - kotlin("plugin.lombok") + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.kotlin.lombok) + alias(libs.plugins.dokka) } java.toolchain.languageVersion.set(JavaLanguageVersion.of(8)) @@ -20,12 +20,12 @@ val singleFile by configurations.creating artifacts { add(singleFile.name, tasks.jar) } -tasks.dokkaHtml { - dokkaSourceSets { - ("main") { - moduleName.set("MoulConfig-Common") - sourceRoots.from(sourceSets.main.get().allSource) - classpath.from(tasks.compileJava.get().classpath) - } - } -} +//tasks.dokkaHtml { +// dokkaSourceSets { +// ("main") { +// moduleName.set("MoulConfig-Common") +// sourceRoots.from(sourceSets.main.get().allSource) +// classpath.from(tasks.compileJava.get().classpath) +// } +// } +//} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..f722856ff --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,27 @@ +[versions] +mc_modern = "1.20.2" +mc_legacy = "1.8.9" +mcp = "22-1.8.9" +forge_loader = "11.15.1.2318-1.8.9" +fabric_loader = "0.14.22" +fabric_api = "0.89.2+1.20.2" +yarn_build = "1" +lombok = "1.18.26" +jbAnnotations = "24.0.1" +kotlin = "1.8.21" +shadow = "8.1.1" +dokka = "1.9.10" +unimined = "1.1.0-SNAPSHOT" + +[libraries] +jbAnnotations = { module = "org.jetbrains:annotations", version.ref = "jbAnnotations" } +lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" } +fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" } + +[plugins] +shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" } +kotlin_jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin_lombok = { id = "org.jetbrains.kotlin.plugin.lombok", version.ref = "kotlin" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +unimined = { id = "xyz.wagyourtail.unimined", version.ref = "unimined" } + diff --git a/legacy/build.gradle.kts b/legacy/build.gradle.kts index 217e0a6a3..24fe01eb0 100644 --- a/legacy/build.gradle.kts +++ b/legacy/build.gradle.kts @@ -6,21 +6,21 @@ plugins { idea java `maven-publish` - kotlin("jvm") - id("org.jetbrains.dokka") - id("com.github.johnrengelman.shadow") - id("xyz.wagyourtail.unimined") - kotlin("plugin.lombok") + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.kotlin.lombok) + alias(libs.plugins.shadow) + alias(libs.plugins.unimined) + alias(libs.plugins.dokka) } unimined.minecraft { - version("1.8.9") + version(libs.versions.mc.legacy.get()) mappings { searge() - mcp("stable", "22-1.8.9") + mcp("stable", libs.versions.mcp.get()) } minecraftForge { - loader("11.15.1.2318-1.8.9") + loader(libs.versions.forge.loader.get()) } runs { config("client") { @@ -40,9 +40,9 @@ val include by configurations.creating { } dependencies { - annotationProcessor("org.projectlombok:lombok:1.18.26") - compileOnly("org.projectlombok:lombok:1.18.26") - compileOnly("org.jetbrains:annotations:24.0.1") + annotationProcessor(libs.lombok) + compileOnly(libs.lombok) + compileOnly(libs.jbAnnotations) implementation((project(":common"))) include(project(":common", configuration = "singleFile")) } diff --git a/modern/build.gradle.kts b/modern/build.gradle.kts index b9fd17b71..3c4539c4b 100644 --- a/modern/build.gradle.kts +++ b/modern/build.gradle.kts @@ -3,22 +3,24 @@ import xyz.wagyourtail.unimined.api.task.RemapJarTask plugins { java idea - kotlin("jvm") - id("com.github.johnrengelman.shadow") `maven-publish` - id("xyz.wagyourtail.unimined") - kotlin("plugin.lombok") + alias(libs.plugins.unimined) + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.kotlin.lombok) + alias(libs.plugins.dokka) + alias(libs.plugins.shadow) + } unimined.minecraft { - version("1.20.2") + version(libs.versions.mc.modern.get()) mappings { intermediary() - yarn(1) + yarn(libs.versions.yarn.build.get()) } fabric { - loader("0.14.22") + loader(libs.versions.fabric.loader.get()) } // runs { // config("client") { @@ -34,7 +36,7 @@ java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) val shadowInclude by configurations.creating dependencies { implementation(project(":common")) - "modImplementation"("net.fabricmc.fabric-api:fabric-api:0.89.2+1.20.2") + "modImplementation"(libs.fabric.api) shadowInclude(project(":common", configuration = "singleFile")) }