From 96a5a3be15ee00d11a6bec03bcddbb10f497279b Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Wed, 28 Aug 2024 18:14:09 +1000 Subject: [PATCH] clean buildscripts a lil soz troph --- build.gradle | 46 ++++++++++++------- gradle.properties | 13 +++--- libs.versions.toml | 8 +++- settings.gradle | 2 +- .../resources/META-INF/neoforge.mods.toml | 44 ++++++++++++++++++ src/main/resources/fabric.mod.json | 19 ++++---- 6 files changed, 95 insertions(+), 37 deletions(-) create mode 100644 src/main/resources/META-INF/neoforge.mods.toml diff --git a/build.gradle b/build.gradle index 5cde253..ecdf59d 100644 --- a/build.gradle +++ b/build.gradle @@ -6,8 +6,8 @@ plugins { alias libs.plugins.minotaur } -version = "$project.baseVersion+$project.branch" -archivesBaseName = project.archivesName +version = "$baseVersion+$branch" +archivesBaseName = project.slug repositories { maven { url "https://maven.terraformersmc.com/releases" } @@ -17,15 +17,17 @@ repositories { } dependencies { + implementation libs.kaleidoConfig + include libs.kaleidoConfig + minecraft libs.mc mappings variantOf(libs.yarn) { classifier "v2" } modImplementation libs.fl + modImplementation libs.fapi - modImplementation libs.spruceui - implementation libs.kaleidoConfig + modImplementation libs.spruceui include libs.spruceui - include libs.kaleidoConfig } processResources { @@ -34,19 +36,21 @@ processResources { modId : modId, modName : modName, modDescription: modDescription, - homepage : homepage, - issues : issues, - sources : sources, + homepage : "https://modrinth.com/mod/${slug}", + issues : "https://github.com/${user}/${slug}/issues", + sources : "https://github.com/${user}/${slug}", license : license, authors : authors.split(", ").join("\",\n \""), contributors : contributors.split(", ").join("\",\n \""), - mc : libs.versions.mc.get(), + members : "${authors}. Contributions by ${contributors}", + mc : compatibleVersions.split(", ")[0], fl : libs.versions.fl.get(), fapi : libs.versions.fapi.get(), spruceui : libs.versions.spruceui.get() ] - inputs.properties meta - filesMatching("fabric.mod.json") { expand meta } + inputs.properties(meta) + filesMatching("*.mod.json") { expand(meta) } + filesMatching("META-INF/*mods.toml") { expand(meta) } } tasks.withType(JavaCompile).configureEach { @@ -56,10 +60,14 @@ tasks.withType(JavaCompile).configureEach { java { withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { - from "LICENSE" + from("LICENSE") { + rename { "${it}_${archivesBaseName}" } + } } publishing { @@ -71,12 +79,16 @@ publishing { } modrinth { - token = System.getenv("MODRINTH_TOKEN") - projectId = "ballotbox" + token = "$System.env.MODRINTH_TOKEN" + projectId = slug + versionNumber = project.version + uploadFile = remapJar + gameVersions = compatibleVersions.split(", ").toList() + loaders = compatibleLoaders.split(", ").toList() + changelog = "$System.env.CHANGELOG" + syncBodyFrom = "\n" + rootProject.file("README.md").text dependencies { required.version "fabric-api", libs.versions.fapi.get() } - changelog = System.getenv("CHANGELOG") - syncBodyFrom = "\n" + rootProject.file("README.md").text - uploadFile = remapJar } + diff --git a/gradle.properties b/gradle.properties index ee821ce..65e68ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,23 +4,22 @@ org.gradle.caching=true org.gradle.parallel=true org.gradle.caching.debug=false org.gradle.configureondemand=true - # Loom fabric.loom.multiProjectOptimisation=true - # Mod Metadata -archivesName=ballotbox group=net.modfest +user=ModFest +slug=ballotbox modId=ballotbox modName=Ballotbox modDescription=In-game category voting! authors=ModFest contributors=Prospector, Sisby folk, acikek -homepage=https://modrinth.com/mod/ballotbox -issues=https://github.com/modfest/ballotbox/issues -sources=https://github.com/modfest/ballotbox license=MIT - # Mod Version baseVersion=0.4.2 +# Branch Metadata branch=1.21 +tagBranch=1.21 +compatibleVersions=1.21, 1.21.1 +compatibleLoaders=fabric, quilt, neoforge diff --git a/libs.versions.toml b/libs.versions.toml index 3f0c320..7403b1a 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -2,21 +2,25 @@ loom = "1.7.+" minotaur = "2.+" +kaleidoConfig = "0.3.1+1.3.1" + mc = "1.21" fl = "0.15.11" yarn = "1.21+build.9" fapi = "0.100.7+1.21" + spruceui = "5.1.0+1.21" -kaleidoConfig = "0.3.1+1.3.1" [plugins] loom = { id = "fabric-loom", version.ref = "loom" } minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" } [libraries] +kaleidoConfig = { group = "folk.sisby", name = "kaleido-config", version.ref = "kaleidoConfig" } + mc = { group = "mojang", name = "minecraft", version.ref = "mc" } fl = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fl" } yarn = { group = "net.fabricmc", name = "yarn", version.ref = "yarn" } fapi = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fapi" } + spruceui = { group = "dev.lambdaurora", name = "spruceui", version.ref = "spruceui" } -kaleidoConfig = { group = "folk.sisby", name = "kaleido-config", version.ref = "kaleidoConfig" } diff --git a/settings.gradle b/settings.gradle index 593ea78..dce0b1d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ pluginManagement { repositories { - maven { url 'https://maven.fabricmc.net/' } + maven { url "https://maven.fabricmc.net/" } gradlePluginPortal() } } diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..29344ad --- /dev/null +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,44 @@ +modLoader = "javafml" +loaderVersion = "[4,)" +license = "${license}" +issueTrackerURL = "${issues}" + +[[mods]] +modId = "${modId}" +version = "${version}" +displayName = "${modName}" +description = '''${modDescription}''' +authors = "${members}" +displayURL = "${homepage}" +logoFile = "assets/${modId}/icon.png" + +[properties] +"connector:placeholder" = true + +[[dependencies.${ modId }]] +modId = "connector" +type = "required" +versionRange = "*" +ordering = "NONE" +side = "BOTH" + +[[dependencies.${ modId }]] +modId = "neoforge" +type = "required" +versionRange = "*" +ordering = "NONE" +side = "BOTH" + +[[dependencies.${ modId }]] +modId = "minecraft" +type = "required" +versionRange = "[${mc},)" +ordering = "NONE" +side = "BOTH" + +[[dependencies.${ modId }]] +modId = "fabric_api" +type = "required" +versionRange = "[${fapi},)" +ordering = "NONE" +side = "BOTH" diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f03f136..6f0f2bb 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -16,7 +16,15 @@ "sources": "${sources}" }, "license": "${license}", - "icon": "assets/ballotbox/icon.png", + "icon": "assets/${modId}/icon.png", + "mixins": [ + "${modId}.mixins.json" + ], + "depends": { + "minecraft": ">=${mc}", + "fabricloader": ">=${fl}", + "fabric-api": ">=${fapi}" + }, "entrypoints": { "main": [ "net.modfest.ballotbox.BallotBox" @@ -24,14 +32,5 @@ "client": [ "net.modfest.ballotbox.client.BallotBoxClient" ] - }, - "mixins": [ - "ballotbox.mixins.json" - ], - "depends": { - "minecraft": ">=${mc}", - "fabricloader": ">=${fl}", - "fabric-api": ">=${fapi}", - "spruceui": ">=${spruceui}" } }