fix: move to jline-terminal-ffm on java 22+ and fall back to jni on 21, fixes #10405

ffm requires 1) native access allowed (the jdk cracks down on undocumented native access in 22) and 2) reverting the default console back to java.base, so the internal jline doesnt take over
This commit is contained in:
MiniDigger | Martin 2024-11-17 20:31:50 +01:00
parent 0500ee7896
commit 9dcfb32d11
3 changed files with 6 additions and 4 deletions

View file

@ -11,7 +11,7 @@ import kotlin.io.path.*
plugins {
java
`maven-publish`
id("io.papermc.paperweight.core") version "1.7.4"
id("io.papermc.paperweight.core") version "1.7.5"
}
allprojects {

View file

@ -679,12 +679,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
System.err.println("*** Server will start in 20 seconds ***");
Thread.sleep(TimeUnit.SECONDS.toMillis(20));
}
}
@@ -0,0 +0,0 @@ public class Main {
System.setProperty("library.jansi.version", "Paper"); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows
System.setProperty("jdk.console", "java.base"); // Paper - revert default console provider back to java.base so we can have our own jline
- System.out.println("Loading libraries, please wait...");
- net.minecraft.server.Main.main(options);
+
+ //System.out.println("Loading libraries, please wait...");
+ //net.minecraft.server.Main.main(options);
+ io.papermc.paper.PaperBootstrap.boot(options);

View file

@ -47,7 +47,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
implementation(project(":paper-api"))
- implementation("jline:jline:2.12.1")
+ // Paper start
+ implementation("org.jline:jline-terminal-jansi:3.21.0")
+ implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
+ implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
+ implementation("net.minecrell:terminalconsoleappender:1.3.0")
+ implementation("net.kyori:adventure-text-serializer-ansi:4.17.0") // Keep in sync with adventureVersion from Paper-API build file
+ /*
@ -472,6 +473,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ System.setProperty("library.jansi.version", "Paper"); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows
+ System.setProperty("jdk.console", "java.base"); // Paper - revert default console provider back to java.base so we can have our own jline
System.out.println("Loading libraries, please wait...");
net.minecraft.server.Main.main(options);
} catch (Throwable t) {