From 0c25f24aa18611864279f8c6b2cbabaa10ffb45a Mon Sep 17 00:00:00 2001 From: Snownee Date: Sat, 24 Aug 2024 00:56:39 +0800 Subject: [PATCH] chore: add the missing parts in the build script --- build.gradle | 39 ++++++++++++++++++++++----------------- gradle.properties | 1 + 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index c923b3f2..b3c0cfec 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ plugins { id 'idea' id 'maven-publish' id 'net.neoforged.moddev' version '2.0.16-beta' + id "me.shedaniel.unified-publishing" version "0.1.+" } tasks.named('wrapper', Wrapper).configure { @@ -18,8 +19,10 @@ tasks.named('wrapper', Wrapper).configure { abstract class TeaConDumpPathToGitHub extends DefaultTask { @Input abstract Property getPublishName() + @InputFile abstract RegularFileProperty getTargetFile() + @TaskAction void dump() { if (System.env.GITHUB_ACTIONS) { @@ -38,7 +41,7 @@ abstract class TeaConDumpPathToGitHub extends DefaultTask { } base { - archivesName = 'XKDeco-NeoForge' + archivesName = 'XeKr\'s Decoration' } version = "${minecraft_version}-NeoForge-${mod_version}" group = "${mod_base_package}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html @@ -240,17 +243,22 @@ processResources { } } -tasks.jarJar.configure { - // TODO[3TUSK]: I don't know if it is possible to exclude these? - //exclude("/assets/${project.mod_id}/lang/en_us.existing.json") - //exclude("/assets/test") - //exclude("/org/teacon/xkdeco/data") - //exclude("/org/teacon/xkdeco/mixin/data") - //exclude("/.cache") - //exclude("/xkdeco.data.mixins.json") -} - jar { + exclude("/assets/${project.mod_id}/lang/en_us.existing.json") + exclude("/assets/test") + exclude("/org/teacon/xkdeco/data") + exclude("/org/teacon/xkdeco/mixin/data") + exclude("/.cache") + exclude("/xkdeco.data.mixins.json") + + manifest { + attributes(["Specification-Title" : mod_id, + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : realVersion, + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")]) + } + preserveFileTimestamps = false reproducibleFileOrder = true } @@ -311,18 +319,16 @@ tasks.register("githubActionOutput", TeaConDumpPathToGitHub) { task -> task.getTargetFile().set(jar.archiveFile) } -// TODO We will come back later for publication on CurseForge / Modrinth. -/* unifiedPublishing { project { displayName = "[NeoForge $project.supported_version] $project.mod_version" version = realVersion // Optional, Inferred from project by default changelog = file("CHANGELOG.md").exists() ? file("CHANGELOG.md").text : "" releaseType = project.release_type // Optional, use "release", "beta" or "alpha" - gameVersions = ["1.20.1"] + gameVersions = [project.minecraft_version] gameLoaders = ["neoforge"] - mainPublication tasks.jarJar // Declares the publicated jar + mainPublication tasks.jar //TODO test if (System.getenv("CURSE_TOKEN") != null) { curseforge { @@ -335,7 +341,7 @@ unifiedPublishing { } } - if (System.getenv("CURSE_TOKEN") != null) { + if (System.getenv("MODRINTH_TOKEN") != null) { modrinth { token = System.getenv("MODRINTH_TOKEN") id = "XlwMlNhH" // Required, must be a string, ID of Modrinth project @@ -347,4 +353,3 @@ unifiedPublishing { } } } - */ diff --git a/gradle.properties b/gradle.properties index e45d9c6b..04b40d7f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,6 +25,7 @@ loader_version_range=[4,) # Mod Properties mod_version=0.8.2 release_type=release +supported_version=1.21.1 remote_repo=teaconmc/XKDeco mod_id=xkdeco mod_base_package=org.teacon.xkdeco