Minimize build setup

This commit is contained in:
FlorianMichael 2024-08-05 19:43:31 +02:00
parent 1bc0f9f646
commit 5316e8da17
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
16 changed files with 19 additions and 67 deletions

View File

@ -83,16 +83,21 @@ subprojects {
// Define the jar output attributes for all platforms // Define the jar output attributes for all platforms
base { base {
group = project.maven_group group = project.maven_group
archivesName = project.maven_name archivesName = project.name
version = project.maven_version version = project.maven_version
} }
def mcVersion = project.forge_version.split("-")[0]
// Used to execute code only for specific submodules // Used to execute code only for specific submodules
def versionId = Integer.parseInt(project.mc_version.replace(".", "")) def versionId = Integer.parseInt(mcVersion.replace(".", ""))
compileJava.options.encoding = "UTF-8" compileJava.options.encoding = "UTF-8"
minecraft { minecraft {
if (versionId >= 1_16_5) {
mappings channel: "official", version: mcVersion
}
runs { runs {
client { client {
workingDirectory project.file("run") workingDirectory project.file("run")
@ -104,11 +109,11 @@ subprojects {
property "mixin.debug.export", "true" property "mixin.debug.export", "true"
property "mixin.hotSwap", "true" property "mixin.hotSwap", "true"
property "fml.coreMods.load", "de.florianmichael.viaforge.mixin.MixinLoader" // Only required for MC 1.12, but modern Forges skips this anyway property "fml.coreMods.load", "de.florianmichael.viaforge.mixin.MixinLoader" // Only required for MC 1.12, but modern Forges skips this anyway
args "-mixin.config=" + "mixins." + project.getProperty('maven_name') + ".json" args "-mixin.config=" + "mixins." + project.getProperty('name') + ".json"
// source set // source set
mods { mods {
"${project.maven_name}" { "${project.name}" {
source sourceSets.main source sourceSets.main
} }
} }
@ -121,6 +126,7 @@ subprojects {
} }
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${forge_version}"
if (versionId >= 1_17_1) { if (versionId >= 1_17_1) {
// Minecraft 1.17+ already includes slf4j, so we don't need to include it // Minecraft 1.17+ already includes slf4j, so we don't need to include it
compileOnly "org.slf4j:slf4j-api:${slf4j_version}" compileOnly "org.slf4j:slf4j-api:${slf4j_version}"
@ -135,7 +141,7 @@ subprojects {
} }
mixin { mixin {
add sourceSets.main, "mixins.${project.maven_name}.refmap.json" add sourceSets.main, "mixins.${project.name}.refmap.json"
} }
jar { jar {
@ -151,7 +157,7 @@ subprojects {
"TweakOrder": "0", "TweakOrder": "0",
"FMLCorePluginContainsFMLMod": "true", // Only required for MC 1.12, but modern Forges skips this anyway "FMLCorePluginContainsFMLMod": "true", // Only required for MC 1.12, but modern Forges skips this anyway
"FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader", // Counterpart to the above "FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader", // Counterpart to the above
"MixinConfigs": "mixins.${project.maven_name}.json", "MixinConfigs": "mixins.${project.name}.json",
"ForceLoadAsMod": "true" "ForceLoadAsMod": "true"
) )
enabled = false enabled = false

View File

@ -6,6 +6,5 @@ org.gradle.daemon=false
maven_group=de.florianmichael maven_group=de.florianmichael
maven_version=3.7.1-SNAPSHOT maven_version=3.7.1-SNAPSHOT
# Should be ignored by dependabot
slf4j_version=2.0.7 slf4j_version=2.0.7
mixin_version=0.8.3 mixin_version=0.8.3

View File

@ -1,7 +1,3 @@
minecraft { minecraft {
mappings channel: "stable", version: "39-1.12" mappings channel: "stable", version: "39-1.12"
} }
dependencies {
minecraft "net.minecraftforge:forge:1.12.2-14.23.5.2859"
}

View File

@ -1,2 +1 @@
maven_name=viaforge-mc1122 forge_version=1.12.2-14.23.5.2859
mc_version=1.12.2

View File

@ -1,7 +0,0 @@
minecraft {
mappings channel: "official", version: "1.16.5"
}
dependencies {
minecraft "net.minecraftforge:forge:1.16.5-36.2.39"
}

View File

@ -1,2 +1 @@
maven_name=viaforge-mc1165 forge_version=1.16.5-36.2.39
mc_version=1.16.5

View File

@ -1,7 +0,0 @@
minecraft {
mappings channel: "official", version: "1.17.1"
}
dependencies {
minecraft "net.minecraftforge:forge:1.17.1-37.1.1"
}

View File

@ -1,2 +1 @@
maven_name=viaforge-mc1171 forge_version=1.17.1-37.1.1
mc_version=1.17.1

View File

@ -1,7 +0,0 @@
minecraft {
mappings channel: "official", version: "1.18.2"
}
dependencies {
minecraft "net.minecraftforge:forge:1.18.2-40.2.0"
}

View File

@ -1,2 +1 @@
maven_name=viaforge-mc1182 forge_version=1.18.2-40.2.0
mc_version=1.18.2

View File

@ -1,7 +0,0 @@
minecraft {
mappings channel: "official", version: "1.19.2"
}
dependencies {
minecraft "net.minecraftforge:forge:1.19.2-43.4.2"
}

View File

@ -1,2 +1 @@
maven_name=viaforge-mc1192 forge_version=1.19.2-43.4.2
mc_version=1.19.2

View File

@ -1,7 +0,0 @@
minecraft {
mappings channel: "official", version: "1.19.4"
}
dependencies {
minecraft "net.minecraftforge:forge:1.19.4-45.2.0"
}

View File

@ -1,2 +1 @@
maven_name=viaforge-mc1194 forge_version=1.19.4-45.2.0
mc_version=1.19.4

View File

@ -1,7 +0,0 @@
minecraft {
mappings channel: "official", version: "1.20.4"
}
dependencies {
minecraft "net.minecraftforge:forge:1.20.4-49.0.13"
}

View File

@ -1,2 +1 @@
maven_name=viaforge-mc1204 forge_version=1.20.4-49.0.13
mc_version=1.20.4