Really fix JLine on Windows

The history of how paths work in Win32 is a sad story and shall not be documented here.
Needless to say, Windows hates the temporary file name for jansi's native code since it
includes the version. For git builds, it includes quotes around the actual version. But
alas, the issue apparently doesn't occur if you build on Windows since it removes the
quotes from the git commandline that is ultimately used to build the version string,
because of more Win32 sadness and shame.

Go look at Raymond Chen's blog, The Old New Thing. It's full of Windows oddities and
it will make you want to weep because almost 90% of the world uses this legacy OS from
the 1980s.
This commit is contained in:
Andrew Steinborn 2019-10-13 16:35:54 -05:00 committed by Zach Brown
parent c65396072f
commit ff8b9ef3d5
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76

View File

@ -1,4 +1,4 @@
From f18f263e2f7704568f3a05f32bb37ba1da25e400 Mon Sep 17 00:00:00 2001 From f00c943e438f24b1dc0c345a59fb52431b5a127d Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net> From: Minecrell <minecrell@minecrell.net>
Date: Fri, 9 Jun 2017 19:03:43 +0200 Date: Fri, 9 Jun 2017 19:03:43 +0200
Subject: [PATCH] Use TerminalConsoleAppender for console improvements Subject: [PATCH] Use TerminalConsoleAppender for console improvements
@ -19,7 +19,7 @@ Other changes:
configuration configuration
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 04b0dd9a7f..58b14a740e 100644 index 04b0dd9a7..58b14a740 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -41,10 +41,27 @@ @@ -41,10 +41,27 @@
@ -75,7 +75,7 @@ index 04b0dd9a7f..58b14a740e 100644
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
new file mode 100644 new file mode 100644
index 0000000000..cd6e259239 index 000000000..cd6e25923
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java +++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
@ -121,7 +121,7 @@ index 0000000000..cd6e259239
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
new file mode 100644 new file mode 100644
index 0000000000..685deaa0e5 index 000000000..685deaa0e
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java +++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
@ -143,7 +143,7 @@ index 0000000000..685deaa0e5
+ +
+} +}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 895049287c..92d0aa6d66 100644 index 895049287..92d0aa6d6 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java --- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -85,6 +85,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -85,6 +85,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@ -185,7 +185,7 @@ index 895049287c..92d0aa6d66 100644
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true)); System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true)); System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 759c713976..6c9a43d66b 100644 index 759c71397..6c9a43d66 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -57,7 +57,7 @@ import org.apache.commons.lang3.Validate; @@ -57,7 +57,7 @@ import org.apache.commons.lang3.Validate;
@ -244,7 +244,7 @@ index 759c713976..6c9a43d66b 100644
public KeyPair getKeyPair() { public KeyPair getKeyPair() {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index d23e4e5e3d..6a77707983 100644 index d23e4e5e3..6a7770798 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -76,8 +76,7 @@ public abstract class PlayerList { @@ -76,8 +76,7 @@ public abstract class PlayerList {
@ -258,7 +258,7 @@ index d23e4e5e3d..6a77707983 100644
this.k = new GameProfileBanList(PlayerList.a); this.k = new GameProfileBanList(PlayerList.a);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8e6f23d278..4c94e85e46 100644 index 8e6f23d27..4c94e85e4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -41,7 +41,6 @@ import java.util.function.Consumer; @@ -41,7 +41,6 @@ import java.util.function.Consumer;
@ -284,7 +284,7 @@ index 8e6f23d278..4c94e85e46 100644
@Override @Override
public PluginCommand getPluginCommand(String name) { public PluginCommand getPluginCommand(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 78534c307c..c1ece9acd4 100644 index 78534c307..b0bb086a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -13,7 +13,7 @@ import java.util.logging.Logger; @@ -13,7 +13,7 @@ import java.util.logging.Logger;
@ -324,9 +324,18 @@ index 78534c307c..c1ece9acd4 100644
} }
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
@@ -226,7 +236,7 @@ public class Main {
System.out.println("Unable to read system info");
}
// Paper end
-
+ System.setProperty( "library.jansi.version", "Paper" ); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows
System.out.println("Loading libraries, please wait...");
MinecraftServer.main(options);
} catch (Throwable t) {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
deleted file mode 100644 deleted file mode 100644
index fdf2f075e2..0000000000 index fdf2f075e..000000000
--- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java --- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
+++ /dev/null +++ /dev/null
@@ -1,72 +0,0 @@ @@ -1,72 +0,0 @@
@ -403,7 +412,7 @@ index fdf2f075e2..0000000000
- } - }
-} -}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
index befcc19f9b..5510266fb1 100644 index befcc19f9..5510266fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
@@ -4,20 +4,31 @@ import java.util.Collections; @@ -4,20 +4,31 @@ import java.util.Collections;
@ -486,7 +495,7 @@ index befcc19f9b..5510266fb1 100644
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
index 70f8d42992..449e99d1b6 100644 index 70f8d4299..449e99d1b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java --- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java +++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -17,7 +17,7 @@ public class ServerShutdownThread extends Thread { @@ -17,7 +17,7 @@ public class ServerShutdownThread extends Thread {
@ -500,7 +509,7 @@ index 70f8d42992..449e99d1b6 100644
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
deleted file mode 100644 deleted file mode 100644
index f267f99f96..0000000000 index f267f99f9..000000000
--- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java --- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
+++ /dev/null +++ /dev/null
@@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
@ -563,13 +572,13 @@ index f267f99f96..0000000000
-} -}
diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties
new file mode 100644 new file mode 100644
index 0000000000..0694b21465 index 000000000..0694b2146
--- /dev/null --- /dev/null
+++ b/src/main/resources/log4j2.component.properties +++ b/src/main/resources/log4j2.component.properties
@@ -0,0 +1 @@ @@ -0,0 +1 @@
+log4j.skipJansi=true +log4j.skipJansi=true
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 490a9acc70..08b6bb7f97 100644 index 490a9acc7..08b6bb7f9 100644
--- a/src/main/resources/log4j2.xml --- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml
@@ -1,12 +1,11 @@ @@ -1,12 +1,11 @@
@ -599,5 +608,5 @@ index 490a9acc70..08b6bb7f97 100644
<AppenderRef ref="TerminalConsole" level="info"/> <AppenderRef ref="TerminalConsole" level="info"/>
</Root> </Root>
-- --
2.22.1 2.23.0