From 71c9632d615bcbe58c4004a6ad3e1d1e97d8d8be Mon Sep 17 00:00:00 2001 From: Glavo Date: Tue, 15 Oct 2024 03:13:35 +0800 Subject: [PATCH] =?UTF-8?q?GitHub=20Action=20=E4=BD=BF=E7=94=A8=20Java=208?= =?UTF-8?q?=20=E6=9E=84=E5=BB=BA=20HMCL=20(#3340)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update * update --- .github/workflows/gradle.yml | 4 ++-- HMCLCore/build.gradle.kts | 6 ++++++ .../java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java | 2 +- .../org/jackhuang/hmcl/game/CrashReportAnalyzerTest.java | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index fe45a94b2..acc107f82 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -14,11 +14,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK 8 uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: '11' + java-version: 8 java-package: 'jdk+fx' - name: Build with Gradle run: ./gradlew build --no-daemon diff --git a/HMCLCore/build.gradle.kts b/HMCLCore/build.gradle.kts index e7c4b4ab5..f5cc2f8fb 100644 --- a/HMCLCore/build.gradle.kts +++ b/HMCLCore/build.gradle.kts @@ -14,4 +14,10 @@ dependencies { api("org.apache.commons:commons-compress:1.25.0") api("org.jsoup:jsoup:1.18.1") compileOnlyApi("org.jetbrains:annotations:24.1.0") + + if (JavaVersion.current().isJava8) { + org.gradle.internal.jvm.Jvm.current().toolsJar?.let { + compileOnly(files(it)) + } + } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java index 42e96367e..22cce5a2a 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java @@ -113,7 +113,7 @@ public final class CrashReportAnalyzer { //https://github.com/HMCL-dev/HMCL/pull/2038 MODMIXIN_FAILURE(Pattern.compile("(MixinApplyError|Mixin prepare failed |Mixin apply failed |mixin\\.injection\\.throwables\\.|\\.mixins\\.json\\] FAILED during \\))")),//ModMixin失败 MIXIN_APPLY_MOD_FAILED(Pattern.compile("Mixin apply for mod (?.*) failed"), "id"),//Mixin应用失败 - FORGE_ERROR(Pattern.compile("An exception was thrown, the game will display an error screen and halt\\.(?(.*)[\\n\\r]*((.*)[\\n\\r]*)+)at "), "reason"),//Forge报错,Forge可能已经提供了错误信息 + FORGE_ERROR(Pattern.compile("An exception was thrown, the game will display an error screen and halt\\.\\R*(?.*\\R*(\\s*at .*\\R)+)"), "reason"),//Forge报错,Forge可能已经提供了错误信息 MOD_RESOLUTION0(Pattern.compile("(\tMod File:|-- MOD |\tFailure message:)")), FORGE_REPEAT_INSTALLATION(Pattern.compile("MultipleArgumentsForOptionException: Found multiple arguments for option (.*?), but you asked for only one")),//https://github.com/HMCL-dev/HMCL/issues/1880 OPTIFINE_REPEAT_INSTALLATION(Pattern.compile("ResolutionException: Module optifine reads another module named optifine")),//Optifine 重复安装(及Mod文件夹有,自动安装也有) diff --git a/HMCLCore/src/test/java/org/jackhuang/hmcl/game/CrashReportAnalyzerTest.java b/HMCLCore/src/test/java/org/jackhuang/hmcl/game/CrashReportAnalyzerTest.java index 289573c96..a47f26305 100644 --- a/HMCLCore/src/test/java/org/jackhuang/hmcl/game/CrashReportAnalyzerTest.java +++ b/HMCLCore/src/test/java/org/jackhuang/hmcl/game/CrashReportAnalyzerTest.java @@ -140,7 +140,8 @@ public class CrashReportAnalyzerTest { "\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]\n" + "\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]\n" + "\tat java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]\n" + - "\tat oolloo.jlw.Wrapper.invokeMain(Wrapper.java:58) [JavaWrapper.jar:?]\n").replaceAll("\\s+", ""), + "\tat oolloo.jlw.Wrapper.invokeMain(Wrapper.java:58) [JavaWrapper.jar:?]\n" + + "\tat oolloo.jlw.Wrapper.main(Wrapper.java:51) [JavaWrapper.jar:?]").replaceAll("\\s+", ""), result.getMatcher().group("reason").replaceAll("\\s+", "")); }