Skip to content

Commit

Permalink
loader/ml9: create mod name marker txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Sychic committed Jun 27, 2024
1 parent e5b2c4c commit 678586a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/kotlin/gg/essential/essential-loader.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,26 @@ when {
""".trimIndent())
}
}
register("generateModNameMarker") {
val modName = findProperty("essential.loader.modName")?.toString() ?: throw GradleException("""
A mod name has not been set.
You need to set `essential.loader.modName` in the project's `gradle.properties` file to the name of your mod.
For example: `essential.loader.modName=Cool Mod`
""".trimIndent())
val outputFile = file("${layout.buildDirectory}/generated-resources/essential-loader-mod-name.txt")
outputs.file(outputFile)
doLast {
outputFile.writeText(modName)
}
}
named<ProcessResources>("processResources") {
if (!isML8) {
dependsOn(named("generateEssentialLoaderMixinConfig"))
from(file("${layout.buildDirectory}/generated-resources/mixin.stage0.essential-loader.json"))
dependsOn(named("generateModNameMarker"))
from(file("${layout.buildDirectory}/generated-resources/essential-loader-mod-name.txt")) {
into("META-INF")
}
}
}
}
Expand Down

0 comments on commit 678586a

Please sign in to comment.