From 1c2b1fb75704f5855e4805c3f182642d2e9aa51a Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 15 Jul 2021 11:27:21 -0400 Subject: [PATCH] System property cleanup --- core/src/mindustry/ClientLauncher.java | 2 +- core/src/mindustry/net/CrashSender.java | 21 +++++----- core/src/mindustry/ui/Links.java | 40 ++++++++++++------- gradle.properties | 2 +- .../src/mindustry/server/ServerControl.java | 2 +- 5 files changed, 38 insertions(+), 29 deletions(-) diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientLauncher.java index 24582860bf..5ea23d3555 100644 --- a/core/src/mindustry/ClientLauncher.java +++ b/core/src/mindustry/ClientLauncher.java @@ -55,7 +55,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform Log.info("[GL] Max texture size: @", maxTextureSize); Log.info("[GL] Using @ context.", gl30 != null ? "OpenGL 3" : "OpenGL 2"); if(maxTextureSize < 4096) Log.warn("[GL] Your maximum texture size is below the recommended minimum of 4096. This will cause severe performance issues."); - Log.info("[JAVA] Version: @", System.getProperty("java.version")); + Log.info("[JAVA] Version: @", OS.javaVersion); Time.setDeltaProvider(() -> { float result = Core.graphics.getDeltaTime() * 60f; diff --git a/core/src/mindustry/net/CrashSender.java b/core/src/mindustry/net/CrashSender.java index b1cbfdbf58..1f3720c8ac 100644 --- a/core/src/mindustry/net/CrashSender.java +++ b/core/src/mindustry/net/CrashSender.java @@ -29,18 +29,17 @@ public class CrashSender{ report += "Report this at " + Vars.reportIssueURL + "\n\n"; } return report - + "Version: " + Version.combined() + (Vars.headless ? " (Server)" : "") + "\n" - + "OS: " + System.getProperty("os.name") + " x" + (OS.is64Bit ? "64" : "32") + "\n" - + "Java Version: " + System.getProperty("java.version") + "\n" - + "Java Architecture: " + System.getProperty("sun.arch.data.model") + "\n" - + (mods == null ? "" : mods.list().size + " Mods" + (mods.list().isEmpty() ? "" : ": " + mods.list().toString(", ", mod -> mod.name + ":" + mod.meta.version))) - + "\n\n" + error; + + "Version: " + Version.combined() + (Vars.headless ? " (Server)" : "") + "\n" + + "OS: " + OS.osName + " x" + (OS.osArchBits) + " (" + OS.osArch + ")\n" + + "Java Version: " + OS.javaVersion + "\n" + + (mods == null ? "" : mods.list().size + " Mods" + (mods.list().isEmpty() ? "" : ": " + mods.list().toString(", ", mod -> mod.name + ":" + mod.meta.version))) + + "\n\n" + error; } public static void log(Throwable exception){ try{ Core.settings.getDataDirectory().child("crashes").child("crash_" + System.currentTimeMillis() + ".txt") - .writeString(createReport(Strings.neatError(exception))); + .writeString(createReport(Strings.neatError(exception))); }catch(Throwable ignored){ } } @@ -60,7 +59,7 @@ public class CrashSender{ }catch(Throwable ignored){} //don't create crash logs for custom builds, as it's expected - if(Version.build == -1 || (System.getProperty("user.name").equals("anuke") && "release".equals(Version.modifier))){ + if(Version.build == -1 || (OS.username.equals("anuke") && !"steam".equals(Version.modifier))){ ret(); } @@ -141,10 +140,10 @@ public class CrashSender{ ex(() -> value.addChild("server", new JsonValue(fs))); ex(() -> value.addChild("players", new JsonValue(Groups.player.size()))); ex(() -> value.addChild("state", new JsonValue(Vars.state.getState().name()))); - ex(() -> value.addChild("os", new JsonValue(System.getProperty("os.name") + "x" + (OS.is64Bit ? "64" : "32")))); + ex(() -> value.addChild("os", new JsonValue(OS.osName + " x" + OS.osArchBits + " " + OS.osVersion))); ex(() -> value.addChild("trace", new JsonValue(parseException(exception)))); - ex(() -> value.addChild("javaVersion", new JsonValue(System.getProperty("java.version")))); - ex(() -> value.addChild("javaArch", new JsonValue(System.getProperty("sun.arch.data.model")))); + ex(() -> value.addChild("javaVersion", new JsonValue(OS.javaVersion))); + ex(() -> value.addChild("javaArch", new JsonValue(OS.osArchBits))); Log.info("Sending crash report."); diff --git a/core/src/mindustry/ui/Links.java b/core/src/mindustry/ui/Links.java index 6c5962d11c..b3c756ba32 100644 --- a/core/src/mindustry/ui/Links.java +++ b/core/src/mindustry/ui/Links.java @@ -55,20 +55,30 @@ public class Links{ private static String report(){ return "https://github.com/Anuken/Mindustry/issues/new?assignees=&labels=bug&body=" + - Strings.encode(Strings.format( - "**Platform**: `@`\n" + - "\n**Build**: `@`\n" + - "\n**Issue**: *Explain your issue in detail.*\n" + - "\n**Steps to reproduce**: *How you happened across the issue, and what exactly you did to make the bug happen.*\n" + - "\n**Link(s) to mod(s) used**: `@`\n" + - "\n**Save file**: *The (zipped) save file you were playing on when the bug happened. THIS IS REQUIRED FOR ANY ISSUE HAPPENING IN-GAME, REGARDLESS OF WHETHER YOU THINK IT HAPPENS EVERYWHERE. DO NOT DELETE OR OMIT THIS LINE UNLESS YOU ARE SURE THAT THE ISSUE DOES NOT HAPPEN IN-GAME.*\n" + - "\n**Crash report**: *The contents of relevant crash report files. REQUIRED if you are reporting a crash.*\n" + - "\n---\n" + - "\n*Place an X (no spaces) between the brackets to confirm that you have read the line below.*" + - "\n- [ ] **I have updated to the latest release (https://github.com/Anuken/Mindustry/releases) to make sure my issue has not been fixed.**" + - "\n- [ ] **I have searched the closed and open issues to make sure that this problem has not already been reported.**", - OS.isAndroid ? "Android " + Core.app.getVersion() : (System.getProperty("os.name") + (OS.is64Bit ? " x64" : " x32")), - Version.combined(), - Vars.mods.list().any() ? Vars.mods.list().select(LoadedMod::enabled).map(l -> l.meta.author + "/" + l.name + ":" + l.meta.version) : "none")); + Strings.encode(Strings.format( + """ + **Platform**: `@` + + **Build**: `@` + + **Issue**: *Explain your issue in detail.* + + **Steps to reproduce**: *How you happened across the issue, and what exactly you did to make the bug happen.* + + **Link(s) to mod(s) used**: `@` + + **Save file**: *The (zipped) save file you were playing on when the bug happened. THIS IS REQUIRED FOR ANY ISSUE HAPPENING IN-GAME, REGARDLESS OF WHETHER YOU THINK IT HAPPENS EVERYWHERE. DO NOT DELETE OR OMIT THIS LINE UNLESS YOU ARE SURE THAT THE ISSUE DOES NOT HAPPEN IN-GAME.* + + **Crash report**: *The contents of relevant crash report files. REQUIRED if you are reporting a crash.* + + --- + + *Place an X (no spaces) between the brackets to confirm that you have read the line below.* + - [ ] **I have updated to the latest release (https://github.com/Anuken/Mindustry/releases) to make sure my issue has not been fixed.** + - [ ] **I have searched the closed and open issues to make sure that this problem has not already been reported.** + """, + OS.isAndroid ? "Android " + Core.app.getVersion() : (OS.osName + " x" + OS.osArchBits), + Version.combined(), + Vars.mods.list().any() ? Vars.mods.list().select(LoadedMod::enabled).map(l -> l.meta.author + "/" + l.name + ":" + l.meta.version) : "none")); } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 642357fb9e..3489eea88c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=fbdfa0307101b881e208f53666c1f4b7ebf0fe90 +archash=f223b2a9d421d751209efedc615352257fb3773b diff --git a/server/src/mindustry/server/ServerControl.java b/server/src/mindustry/server/ServerControl.java index e25d44d6f5..a75cc39749 100644 --- a/server/src/mindustry/server/ServerControl.java +++ b/server/src/mindustry/server/ServerControl.java @@ -278,7 +278,7 @@ public class ServerControl implements ApplicationListener{ handler.register("version", "Displays server version info.", arg -> { info("Version: Mindustry @-@ @ / build @", Version.number, Version.modifier, Version.type, Version.build + (Version.revision == 0 ? "" : "." + Version.revision)); - info("Java Version: @", System.getProperty("java.version")); + info("Java Version: @", OS.javaVersion); }); handler.register("exit", "Exit the server application.", arg -> {