diff options
author | Walker Selby <git@walkerselby.com> | 2023-05-12 11:32:40 -0700 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-05-25 02:24:37 +0200 |
commit | 7e8fa83e5afc0b21c96b91bbe87f39751e841bf7 (patch) | |
tree | fc0068c473beae7a9db766e8caf87bc074bf0769 /build.gradle.kts | |
parent | cc5c1a8d1cb3e1042908d59e17199ffadfff0fc7 (diff) | |
download | forge1.8.9template-7e8fa83e5afc0b21c96b91bbe87f39751e841bf7.tar.gz forge1.8.9template-7e8fa83e5afc0b21c96b91bbe87f39751e841bf7.tar.bz2 forge1.8.9template-7e8fa83e5afc0b21c96b91bbe87f39751e841bf7.zip |
Add constants to buildscript to allow easier setup
Refactor to create constants for common values to be replaced
Signed-off-by: Walker Selby <git@walkerselby.com>
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) |