Prepares the build for 26.x, which ships unobfuscated and needs Java 25 (#39): - loom-back-compat applies the remapping Loom to 1.21.x and would apply the plain one to 26.x. loom_version becomes loomx.loom_version. - Each version compiles with its Java toolchain (21 for 1.21.x, 25 for 26.x), and the mixin configs take their compatibility level from it. The foojay resolver downloads a missing JDK; CI installs 21 and 25. - buildAll collects remapJar's output, or jar's where there's nothing to remap. - fabric.mod.json depends on fabric-api, Fabric API's mod id; 26.x's jar no longer provides the old "fabric" alias. Nothing changes for the 1.21.x jars. Co-Authored-By: Claude Opus 5.5 <[email protected]>
85 lines
2.8 KiB
Kotlin
85 lines
2.8 KiB
Kotlin
// Builds one Minecraft version from the shared src/. Stonecutter runs this for each version in
|
|
// stonecutterVersions (settings.gradle.kts), with that version's versions/<v>/gradle.properties.
|
|
plugins {
|
|
id("dev.kikugie.loom-back-compat")
|
|
`maven-publish`
|
|
}
|
|
|
|
val minecraftVersion = property("minecraft_version") as String
|
|
// The Minecraft versions the jar loads on (fabric.mod.json); a range where hotfixes share a jar.
|
|
val minecraftCompat = findProperty("minecraft_compat") as String? ?: minecraftVersion
|
|
val javaVersion = if (sc.current.parsed >= "26.1") 25 else 21
|
|
val loaderVersion = property("loader_version") as String
|
|
|
|
version = "${property("mod_version")}+$minecraftVersion"
|
|
group = property("maven_group") as String
|
|
|
|
base {
|
|
archivesName = property("archives_base_name") as String
|
|
}
|
|
|
|
dependencies {
|
|
minecraft("com.mojang:minecraft:$minecraftVersion")
|
|
loomx.applyMojangMappings()
|
|
modImplementation("net.fabricmc:fabric-loader:$loaderVersion")
|
|
modImplementation("net.fabricmc.fabric-api:fabric-api:${property("fabric_api_version")}")
|
|
|
|
// Saturn's emote library (limb bending, Emotecraft emotes)
|
|
include(modImplementation("org.saturnclient:emotes-fabric:${property("emotes_version")}+$minecraftVersion")!!)
|
|
|
|
implementation(project(":common"))
|
|
|
|
for (library in listOf(
|
|
"dev.selimaj:session-java:0.2.0",
|
|
"de.javagl:obj:0.4.0",
|
|
"com.formdev:svgSalamander:1.1.4",
|
|
"com.fasterxml.jackson.core:jackson-databind:2.17.0",
|
|
"com.fasterxml.jackson.core:jackson-annotations:2.17.0",
|
|
"com.fasterxml.jackson.core:jackson-core:2.17.0",
|
|
)) {
|
|
include(implementation(library)!!)
|
|
}
|
|
}
|
|
|
|
// Injects the version values into fabric.mod.json.
|
|
tasks.processResources {
|
|
val values = mapOf(
|
|
"version" to project.version.toString(),
|
|
"minecraft_version" to minecraftCompat,
|
|
"loader_version" to loaderVersion,
|
|
"java" to "JAVA_$javaVersion",
|
|
)
|
|
inputs.properties(values)
|
|
filteringCharset = "UTF-8"
|
|
filesMatching(listOf("fabric.mod.json", "*.mixins.json")) { expand(values) }
|
|
}
|
|
|
|
tasks.withType<JavaCompile>().configureEach {
|
|
options.release = javaVersion
|
|
}
|
|
|
|
java {
|
|
// Loom attaches the sources jar to remapSourcesJar and build.
|
|
withSourcesJar()
|
|
toolchain.languageVersion = JavaLanguageVersion.of(javaVersion)
|
|
}
|
|
|
|
tasks.jar {
|
|
val archivesName = base.archivesName
|
|
inputs.property("archivesName", archivesName)
|
|
from("LICENSE") {
|
|
rename { "${it}_${archivesName.get()}" }
|
|
}
|
|
from(project(":common").extensions.getByType<SourceSetContainer>()["main"].output)
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
create<MavenPublication>("mavenJava") {
|
|
artifactId = property("archives_base_name") as String
|
|
from(components["java"])
|
|
}
|
|
}
|
|
}
|