Skip to content

Commit

Permalink
chore: add the missing parts in the build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Snownee committed Aug 23, 2024
1 parent f3362be commit 0c25f24
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
39 changes: 22 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -18,8 +19,10 @@ tasks.named('wrapper', Wrapper).configure {
abstract class TeaConDumpPathToGitHub extends DefaultTask {
@Input
abstract Property<String> getPublishName()

@InputFile
abstract RegularFileProperty getTargetFile()

@TaskAction
void dump() {
if (System.env.GITHUB_ACTIONS) {
Expand All @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -347,4 +353,3 @@ unifiedPublishing {
}
}
}
*/
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c25f24

Please sign in to comment.