feat(minecraft): Make every subproject its own mod

This commit is contained in:
2025-11-08 00:44:52 +01:00
parent 47ad406560
commit d2dada2b77
34 changed files with 186 additions and 65 deletions

View File

@@ -2,6 +2,7 @@ plugins {
id("com.gradleup.shadow")
java
`java-library`
id("de.siphalor.tweed5.shadow.explicit")
id("de.siphalor.tweed5.minecraft.mod.component")
}
@@ -10,16 +11,25 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}
val minecraftJijElements = configurations.resolvable("minecraftJijElements")
tasks.shadowJar {
relocate("org.apache.commons", "de.siphalor.tweed5.shadowed.org.apache.commons")
}
fun formatJarsForJson(jars: FileCollection): String {
return jars.files.joinToString(",") { "{\"file\":\"META-INF/jars/${it.name}\"}"}
}
tasks.register<Sync>("processMinecraftModResources") {
inputs.property("id", project.name)
inputs.property("version", project.version)
inputs.property("name", properties["module.name"])
inputs.property("description", properties["module.description"])
inputs.property("repoUrl", properties["git.url"])
inputs.files(minecraftJijElements)
val jars = objects.fileCollection().apply { from(minecraftJijElements) }
from(project.layout.settingsDirectory.dir("../tweed5-minecraft/mod-template/resources")) {
expand(
@@ -29,6 +39,7 @@ tasks.register<Sync>("processMinecraftModResources") {
"name" to properties["module.name"],
"description" to properties["module.description"],
"repoUrl" to properties["git.url"],
"jars" to formatJarsForJson(jars)
)
)
}
@@ -44,6 +55,9 @@ tasks.register<Sync>("processMinecraftTestmodResources") {
inputs.property("name", properties["module.name"])
inputs.property("description", properties["module.description"])
inputs.property("repoUrl", properties["git.url"])
inputs.files(minecraftJijElements)
val jars = objects.fileCollection().apply { from(minecraftJijElements) }
from(project.layout.settingsDirectory.dir("../tweed5-minecraft/mod-template/resources")) {
expand(
@@ -53,6 +67,7 @@ tasks.register<Sync>("processMinecraftTestmodResources") {
"name" to "${properties["module.name"]} (test mod)",
"description" to properties["module.description"],
"repoUrl" to properties["git.url"],
"jars" to formatJarsForJson(jars)
)
)
}