1
0
mirror of https://github.com/chylex/Better-Controls.git synced 2024-11-25 01:42:45 +01:00

Compare commits

..

1 Commits

Author SHA1 Message Date
476689deb9
Switch from separate loader jars to one multiloader jar 2024-07-02 19:20:05 +02:00
6 changed files with 17 additions and 37 deletions

View File

@ -1,5 +1,3 @@
import org.gradle.jvm.tasks.Jar
val modId: String by project
val minecraftVersion: String by project
val fabricVersion: String by project
@ -47,11 +45,6 @@ tasks.jar {
exclude("com/terraformersmc/modmenu/")
}
tasks.register<Jar>("uncompressedRemapJar") {
group = "fabric"
from(tasks.remapJar.map { it.outputs.files.map(::zipTree) })
archiveClassifier.set("uncompressed")
entryCompression = ZipEntryCompression.STORED // Reduces size of multiloader jar.
tasks.remapJar {
archiveVersion.set(tasks.jar.get().archiveVersion)
}

View File

@ -18,7 +18,7 @@
"sources": "${sourcesURL}"
},
"environment": "${sidesForFabric}",
"environment": "client",
"entrypoints": {
"client": [ "chylex.bettercontrols.BetterControlsMod" ],
"modmenu": [ "chylex.bettercontrols.compatibility.ModMenuSupport" ]
@ -26,7 +26,7 @@
"mixins": [{
"config": "${id}.mixins.json",
"environment": "${sidesForFabric}"
"environment": "client"
}],
"depends": {

View File

@ -21,11 +21,11 @@ modId = "minecraft"
type = "required"
versionRange = "[${minimumMinecraftVersion},)"
ordering = "NONE"
side = "${sidesForNeoForge}"
side = "CLIENT"
[[dependencies.${id}]]
modId = "neoforge"
type = "required"
versionRange = "[${minimumNeoForgeVersion},)"
ordering = "NONE"
side = "${sidesForNeoForge}"
side = "CLIENT"

View File

@ -10,7 +10,6 @@ val modVersion: String by project
val modLicense: String by project
val modSourcesURL: String by project
val modIssuesURL: String by project
val modSides: String by project
val minecraftVersion: String by project
val mixinVersion: String by project
@ -20,6 +19,7 @@ val minimumNeoForgeVersion: String by project
val minimumFabricVersion: String by project
val modNameStripped = modName.replace(" ", "")
val jarVersion = "$minecraftVersion+v$modVersion"
plugins {
idea
@ -96,13 +96,6 @@ allprojects {
}
tasks.withType<ProcessResources> {
val (sidesForNeoForge, sidesForFabric) = when (modSides) {
"both" -> Pair("BOTH", "*")
"client" -> Pair("CLIENT", "client")
"server" -> Pair("SERVER", "server")
else -> error("Invalid modSides value: $modSides")
}
inputs.property("id", modId)
inputs.property("name", modName)
inputs.property("description", modDescription)
@ -111,8 +104,6 @@ allprojects {
inputs.property("license", modLicense)
inputs.property("sourcesURL", modSourcesURL)
inputs.property("issuesURL", modIssuesURL)
inputs.property("sidesForNeoForge", sidesForNeoForge)
inputs.property("sidesForFabric", sidesForFabric)
inputs.property("minimumMinecraftVersion", minimumMinecraftVersion)
inputs.property("minimumNeoForgeVersion", minimumNeoForgeVersion)
inputs.property("minimumFabricVersion", minimumFabricVersion)
@ -121,11 +112,6 @@ allprojects {
into("assets/$modId")
}
}
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
}
subprojects {
@ -150,7 +136,10 @@ subprojects {
}
tasks.jar {
entryCompression = ZipEntryCompression.STORED // Reduces size of multiloader jar.
archiveVersion.set(jarVersion)
entryCompression = ZipEntryCompression.STORED
from(rootProject.file("LICENSE"))
manifest {
packageInformation(modId, "$modNameStripped-${project.name}")
@ -179,21 +168,20 @@ val multiloaderJar = tasks.register<Jar>("multiloaderJar") {
group = "build"
archiveBaseName.set(modNameStripped)
archiveVersion.set("$minecraftVersion+v$modVersion")
archiveVersion.set(jarVersion)
destinationDirectory = layout.buildDirectory.dir("dist")
fun includeJar(project: Project, jarTaskName: String) {
from(project.tasks.named(jarTaskName).map { it.outputs }) {
fun includeJar(project: Project, jarTask: (TaskContainer) -> TaskProvider<out Jar>) {
from(jarTask(project.tasks).map { it.outputs }) {
into("jars")
rename { "$modNameStripped-${project.name}.jar" }
}
}
findProject(":NeoForge")?.let { includeJar(it, "jar") }
findProject(":Fabric")?.let { includeJar(it, "uncompressedRemapJar") }
findProject(":NeoForge")?.let { includeJar(it, TaskContainer::jar) }
findProject(":Fabric")?.let { includeJar(it, TaskContainer::remapJar) }
from(rootProject.file("LICENSE"))
from(multiloaderSources.map { it.output })
manifest {

View File

@ -7,7 +7,6 @@ modVersion=1.3.1
modLicense=MPL-2.0
modSourcesURL=https://github.com/chylex/Better-Controls
modIssuesURL=https://github.com/chylex/Better-Controls/issues
modSides=client
# Dependencies
minecraftVersion=1.21

View File

@ -18,7 +18,7 @@
"sources": "${sourcesURL}"
},
"environment": "${sidesForFabric}",
"environment": "client",
"jars": [{
"file": "jars/${jarPrefix}-Fabric.jar"