fix(heights): repair native stature potion brewing
Release / release (push) Successful in 6m27s
CI / build (push) Successful in 2m8s

This commit is contained in:
dmg
2026-09-11 22:16:48 -04:00
parent ff0523860c
commit df44bba9c6
7 changed files with 593 additions and 1 deletions
+59
View File
@@ -1,3 +1,6 @@
import java.net.URI
import java.security.MessageDigest
plugins {
java
}
@@ -33,6 +36,62 @@ tasks.test {
useJUnitPlatform()
}
// Exercise the declared runtime's native brewing engine, not a recipe-registry double.
// Paperclip only extracts/patches dependencies: no server, world, port or EULA acceptance.
val brewingRuntime = layout.buildDirectory.dir("brewing-runtime")
val downloadBrewingRuntime = tasks.register("downloadBrewingRuntime") {
val launcher = brewingRuntime.map { it.file("purpur-26.2-2618.jar") }
outputs.file(launcher)
doLast {
val file = launcher.get().asFile
file.parentFile.mkdirs()
val connection = URI("https://api.purpurmc.org/v2/purpur/26.2/2618/download").toURL().openConnection()
connection.connectTimeout = 30_000
connection.readTimeout = 120_000
val bytes = connection.getInputStream().use { it.readBytes() }
val digest = MessageDigest.getInstance("SHA-256").digest(bytes)
.joinToString("") { "%02x".format(it) }
check(digest == "4a32d046a118804d89ca74ba89b798c98f6d8d1f310c18077ac573597049de31") {
"Purpur 2618 checksum mismatch"
}
file.writeBytes(bytes)
}
}
val prepareBrewingRuntime = tasks.register<JavaExec>("prepareBrewingRuntime") {
dependsOn(downloadBrewingRuntime)
javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(25) }
classpath = files(brewingRuntime.map { it.file("purpur-26.2-2618.jar") })
mainClass = "io.papermc.paperclip.Main"
jvmArgs("-Dpaperclip.patchonly=true")
workingDir(brewingRuntime)
outputs.dir(brewingRuntime.map { it.dir("versions") })
outputs.dir(brewingRuntime.map { it.dir("libraries") })
}
val nativeTest = sourceSets.create("nativeTest")
dependencies {
// Use the runtime's bundled API/dependencies, not the API POM's older transitive versions.
add(nativeTest.implementationConfigurationName, platform("org.junit:junit-bom:5.13.4"))
add(nativeTest.implementationConfigurationName, "org.junit.jupiter:junit-jupiter")
add(nativeTest.implementationConfigurationName, "org.mockito:mockito-core:5.18.0")
add(nativeTest.compileOnlyConfigurationName, "org.jetbrains:annotations:26.0.2")
add(nativeTest.compileOnlyConfigurationName, "org.checkerframework:checker-qual:3.49.2")
add(nativeTest.runtimeOnlyConfigurationName, "org.junit.platform:junit-platform-launcher")
}
val nativeRuntimeJars = files(fileTree(brewingRuntime) {
include("versions/**/*.jar", "libraries/**/*.jar")
}).builtBy(prepareBrewingRuntime)
nativeTest.compileClasspath += sourceSets.main.get().output + nativeRuntimeJars
nativeTest.runtimeClasspath += sourceSets.main.get().output + nativeRuntimeJars
val nativeBrewingTest = tasks.register<Test>("nativeBrewingTest") {
description = "Runs native Purpur brewing regressions without starting a server"
testClassesDirs = nativeTest.output.classesDirs
classpath = nativeTest.runtimeClasspath
useJUnitPlatform()
maxHeapSize = "1G"
workingDir(brewingRuntime)
}
tasks.check { dependsOn(nativeBrewingTest) }
val pluginVersion = version
tasks.processResources {
filesMatching("plugin.yml") {