diff options
Diffstat (limited to 'build.gradle.kts')
-rw-r--r-- | build.gradle.kts | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index c5eb641..3f514b2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,8 +6,13 @@ plugins { id("com.github.johnrengelman.shadow") version "7.1.2" } -group = "com.example.archloomtemplate" -version = "1.0.0" +//Constants: + +val baseGroup: String by project +val mcVersion: String by project +val version: String by project +val mixinGroup = "$baseGroup.mixin" +val modid = rootProject.name // Toolchains: java { @@ -23,17 +28,17 @@ loom { property("mixin.debug", "true") property("asmhelper.verbose", "true") arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") - arg("--mixin", "mixins.examplemod.json") + arg("--mixin", "mixins.$modid.json") } } forge { pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter()) // If you don't want mixins, remove this lines - mixinConfig("mixins.examplemod.json") + mixinConfig("mixins.$modid.json") } // If you don't want mixins, remove these lines mixin { - defaultRefmapName.set("mixins.examplemod.refmap.json") + defaultRefmapName.set("mixins.$modid.refmap.json") } } @@ -77,15 +82,28 @@ tasks.withType(JavaCompile::class) { } tasks.withType(Jar::class) { - archiveBaseName.set("examplemod") + archiveBaseName.set(modid) manifest.attributes.run { this["FMLCorePluginContainsFMLMod"] = "true" this["ForceLoadAsMod"] = "true" // If you don't want mixins, remove these lines this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker" - this["MixinConfigs"] = "mixins.examplemod.json" + this["MixinConfigs"] = "mixins.$modid.json" + } +} + +tasks.processResources { + inputs.property("version", project.version) + inputs.property("mcversion", mcVersion) + inputs.property("modid", modid) + inputs.property("mixinGroup", mixinGroup) + + filesMatching(listOf("mcmod.info", "mixins.$modid.json")) { + expand(inputs.properties) } + + rename("(.+_at.cfg)", "META-INF/$1") } @@ -111,7 +129,7 @@ tasks.shadowJar { } // If you want to include other dependencies and shadow them, you can relocate them in here - fun relocate(name: String) = relocate(name, "com.examplemod.deps.$name") + fun relocate(name: String) = relocate(name, "$baseGroup.deps.$name") } tasks.assemble.get().dependsOn(tasks.remapJar) |