158 lines
3.3 KiB
Kotlin
158 lines
3.3 KiB
Kotlin
import org.gradle.kotlin.dsl.withType
|
|
import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask
|
|
|
|
plugins {
|
|
id("java")
|
|
id("xyz.wagyourtail.unimined") version("1.3.15-SNAPSHOT")
|
|
id("com.gradleup.shadow") version("9.0.0-beta15")
|
|
}
|
|
|
|
group = "dev.rdh"
|
|
version = "0.1"
|
|
|
|
val boot by sourceSets.creating
|
|
val fabric by sourceSets.creating
|
|
val forge by sourceSets.creating
|
|
|
|
java.toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
vendor = JvmVendorSpec.AZUL
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
}
|
|
|
|
dependencies {
|
|
val bootImplementation by configurations.getting
|
|
val shade by configurations.creating
|
|
|
|
implementation(bootImplementation("net.fabricmc:sponge-mixin:0.15.5+mixin.0.8.7")!!)
|
|
implementation(bootImplementation("org.ow2.asm:asm-tree:9.8")!!)
|
|
|
|
"io.github.prcraftmc:class-diff:1.0-SNAPSHOT".let {
|
|
bootImplementation(it)
|
|
shade(it) {
|
|
exclude(group = "org.ow2.asm")
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.jar {
|
|
archiveClassifier.set("slim")
|
|
putInDevlibs()
|
|
}
|
|
|
|
tasks.shadowJar {
|
|
archiveClassifier.set("common")
|
|
configurations = listOf(project.configurations["shade"])
|
|
from(boot.output)
|
|
putInDevlibs()
|
|
minimize()
|
|
|
|
exclude("**/module-info.class")
|
|
exclude("META-INF/maven/**")
|
|
|
|
relocate("com.github.difflib", "dev.rdh.testmod.lib.difflib")
|
|
relocate("io.github.prcraftmc.classdiff", "dev.rdh.testmod.lib.classdiff")
|
|
relocate("com.nothome.delta", "dev.rdh.testmod.lib.delta")
|
|
}
|
|
|
|
tasks.assemble {
|
|
dependsOn(tasks.named("remapForgeJar"), tasks.named("remapFabricJar"))
|
|
}
|
|
|
|
tasks.register<MergedJar>("mergeJars") {
|
|
group = "build"
|
|
|
|
mainJar.set(tasks.shadowJar.flatMap { it.archiveFile })
|
|
add("fabric", tasks.named<Jar>("remapFabricJar"))
|
|
add("forge", tasks.named<Jar>("remapForgeJar"))
|
|
|
|
manifest.attributes(
|
|
"Platform-Class" to "dev.rdh.testmod.PlatformFinder"
|
|
)
|
|
|
|
archiveClassifier.set("merged")
|
|
}
|
|
|
|
unimined.minecraft {
|
|
combineWith(boot)
|
|
version("1.20.1")
|
|
|
|
mappings {
|
|
mojmap()
|
|
devFallbackNamespace("official")
|
|
}
|
|
|
|
defaultRemapJar = false
|
|
}
|
|
|
|
unimined.minecraft(fabric) {
|
|
combineWith(sourceSets.main.get())
|
|
|
|
fabric {
|
|
loader("0.16.14")
|
|
}
|
|
|
|
defaultRemapJar = true
|
|
}
|
|
|
|
unimined.minecraft(forge) {
|
|
combineWith(sourceSets.main.get())
|
|
|
|
minecraftForge {
|
|
loader("47.4.0")
|
|
}
|
|
|
|
defaultRemapJar = true
|
|
}
|
|
|
|
tasks.named<ProcessResources>("processFabricResources") {
|
|
val props = mapOf(
|
|
"version" to project.version,
|
|
"minecraft_version" to unimined.minecrafts[fabric]!!.version,
|
|
)
|
|
|
|
inputs.properties(props)
|
|
|
|
filesMatching("fabric.mod.json") {
|
|
expand(props)
|
|
}
|
|
}
|
|
|
|
tasks.named<ProcessResources>("processForgeResources") {
|
|
val props = mapOf(
|
|
"version" to project.version,
|
|
"minecraft_version" to unimined.minecrafts[forge]!!.version,
|
|
)
|
|
|
|
inputs.properties(props)
|
|
|
|
filesMatching("META-INF/mods.toml") {
|
|
expand(props)
|
|
}
|
|
}
|
|
|
|
tasks.named<Jar>("forgeJar") {
|
|
putInDevlibs()
|
|
manifest.attributes(
|
|
"MixinConfigs" to "testmod.mixins.json"
|
|
)
|
|
}
|
|
|
|
tasks.named<Jar>("fabricJar") {
|
|
putInDevlibs()
|
|
}
|
|
|
|
tasks.withType<AbstractArchiveTask> {
|
|
isPreserveFileTimestamps = false
|
|
isReproducibleFileOrder = true
|
|
includeEmptyDirs = false
|
|
}
|
|
|
|
tasks.withType<RemapJarTask> {
|
|
mixinRemap {
|
|
disableRefmap()
|
|
}
|
|
} |