Files
saturnclient/stonecutter.gradle.kts
T
selimaj-devandclaude eebfe8fa4d
Check / compile (pull_request) Successful in 7m47s
Switch the root build scripts to Kotlin and limit parallel remaps
- settings.gradle, stonecutter.gradle and the root build.gradle become
  .kts. Loom's version for the Stonecutter versions moves to the root
  gradle.properties (loom_version), read by pluginManagement, since the
  Kotlin plugins block can't read properties. The old mc-<v> projects keep
  their Groovy scripts until they're folded in.
- buildAll ran all eight remapJar tasks at once. Each loads a Minecraft
  classpath and remaps a ~50 MB jar, which doesn't fit in the 3 GB daemon
  heap: a cold build stalled in garbage collection for 40+ minutes, and
  earlier runs failed. A shared build service now lets two remaps run
  together; a cold buildAll takes about 2 minutes.
- port.sh and VERSION_GUIDE follow the .kts file names.

The 1.21.11 jar is the same as with the Groovy scripts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 04:51:28 +02:00

72 lines
2.4 KiB
Kotlin

plugins {
id("dev.kikugie.stonecutter")
}
// The version whose code is uncommented in src/. Switch with "Set active project to <v>", and run
// "Reset active project" before committing.
stonecutter active "1.21.11"
subprojects {
apply(plugin = "java")
repositories {
maven("https://maven.fabricmc.net/")
maven("https://git.selimaj.dev/api/packages/selimaj-dev/maven")
maven("https://git.selimaj.dev/api/packages/saturnclientmc/maven")
mavenCentral()
}
dependencies {
"implementation"("de.javagl:obj:0.4.0")
"implementation"("com.formdev:svgSalamander:1.1.4")
"implementation"("com.fasterxml.jackson.core:jackson-databind:2.17.0")
"implementation"("com.fasterxml.jackson.core:jackson-annotations:2.17.0")
"implementation"("com.fasterxml.jackson.core:jackson-core:2.17.0")
}
}
// Every Minecraft version builds on common and ships its resources.
configure(subprojects.filter { it.name != "common" }) {
dependencies {
"implementation"(project(":common"))
}
extensions.configure<SourceSetContainer> {
named("main") {
resources.srcDir(project(":common").file("src/main/resources"))
}
}
}
// remapJar loads a whole Minecraft classpath and remaps a ~50 MB jar. Eight at once don't fit in the
// daemon's heap (org.gradle.jvmargs) and the build stalls in garbage collection, so only two run
// together. Everything else still builds in parallel.
abstract class RemapLimit : BuildService<BuildServiceParameters.None>
val remapLimit = gradle.sharedServices.registerIfAbsent("remapLimit", RemapLimit::class) {
maxParallelUsages = 2
}
subprojects {
tasks.matching { it.name == "remapJar" }.configureEach {
usesService(remapLimit)
}
}
tasks.register("buildAll") {
group = "build"
description = "Builds every Minecraft version's remapped jar and collects them in build/allJars"
val remapJars = subprojects.flatMap { it.tasks.matching { task -> task.name == "remapJar" } }
dependsOn(remapJars)
doLast {
val outputDir = layout.buildDirectory.dir("allJars").get().asFile
outputDir.mkdirs()
remapJars.map { (it as AbstractArchiveTask).archiveFile.get().asFile }
.filter { it.exists() && !it.name.contains("sources") }
.forEach { it.copyTo(outputDir.resolve(it.name), overwrite = true) }
println("All remapped jars collected in: $outputDir")
}
}