diff --git a/HMCL/build.gradle b/HMCL/build.gradle index f802dd095..6524be474 100755 --- a/HMCL/build.gradle +++ b/HMCL/build.gradle @@ -19,17 +19,17 @@ import java.util.jar.JarFile import java.util.jar.Pack200 import java.util.zip.GZIPOutputStream import java.security.MessageDigest +import java.util.jar.JarOutputStream +import java.util.zip.ZipEntry +import java.util.zip.ZipFile plugins { id "edu.sc.seis.macAppBundle" version "2.1.6" id "me.tatarka.retrolambda" version "3.5.0" id 'edu.sc.seis.launch4j' version '2.3.0' + id "org.jetbrains.kotlin.jvm" version "1.1.2-2" } -import java.util.jar.JarOutputStream -import java.util.zip.ZipEntry -import java.util.zip.ZipFile - if (!hasProperty('mainClass')) { ext.mainClass = 'org.jackhuang.hmcl.Main' } diff --git a/HMCLAPI/build.gradle b/HMCLAPI/build.gradle index 08dbc7cb1..0bb8722bb 100644 --- a/HMCLAPI/build.gradle +++ b/HMCLAPI/build.gradle @@ -18,6 +18,7 @@ plugins { id "me.tatarka.retrolambda" version "3.5.0" + id "org.jetbrains.kotlin.jvm" version "1.1.2-2" } if (System.getenv("BUILD_NUMBER") != null) diff --git a/HMCLCore/build.gradle b/HMCLCore/build.gradle index 4074a1589..3f0ed1261 100644 --- a/HMCLCore/build.gradle +++ b/HMCLCore/build.gradle @@ -18,6 +18,7 @@ plugins { id "me.tatarka.retrolambda" version "3.5.0" + id "org.jetbrains.kotlin.jvm" version "1.1.2-2" } if (System.getenv("BUILD_NUMBER") != null) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/log/Level.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/log/Level.java index 4a7a985e8..ebec9b1d6 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/log/Level.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/log/Level.java @@ -47,7 +47,7 @@ public enum Level { return this.level <= level.level; } - public static final Pattern MINECRAFT_LOGGER = Pattern.compile("\\[(?[0-9:]+)\\] \\[[^/]+/(?[^\\]]+)\\]"); + public static final Pattern MINECRAFT_LOGGER = Pattern.compile("\\[(?[0-9:]+)\\] \\[[^/]+/(?[^\\]]+)\\] \\[(?[^\\]]+)\\]"); public static final String JAVA_SYMBOL = "([a-zA-Z_$][a-zA-Z\\d_$]*\\.)+[a-zA-Z_$][a-zA-Z\\d_$]*"; public static Level guessLevel(String line, Level preLevel) { @@ -58,26 +58,36 @@ public enum Level { String levelStr = m.group("level"); if (null != levelStr) switch (levelStr) { - case "INFO": - level = INFO; - break; - case "WARN": - level = WARN; - break; - case "ERROR": - level = ERROR; - break; - case "FATAL": - level = FATAL; - break; - case "TRACE": - level = TRACE; - break; - case "DEBUG": - level = DEBUG; - break; - default: - break; + case "INFO": + level = INFO; + break; + case "WARN": + level = WARN; + break; + case "ERROR": + level = ERROR; + break; + case "FATAL": + level = FATAL; + break; + case "TRACE": + level = TRACE; + break; + case "DEBUG": + level = DEBUG; + break; + default: + break; + } + String level2Str = m.group("category"); + if (null != level2Str) + switch(level2Str) { + case "STDOUT": + level = INFO; + break; + case "STDERR": + level = ERROR; + break; } } else { if (line.contains("[INFO]") || line.contains("[CONFIG]") || line.contains("[FINE]") @@ -94,10 +104,10 @@ public enum Level { return FATAL; if (line.contains("Exception in thread") - || line.matches("\\s+at " + JAVA_SYMBOL) - || line.matches("Caused by: " + JAVA_SYMBOL) - || line.matches("([a-zA-Z_$][a-zA-Z\\d_$]*\\.)+[a-zA-Z_$]?[a-zA-Z\\d_$]*(Exception|Error|Throwable)") - || line.matches("... \\d+ more$")) + || line.matches("\\s+at " + JAVA_SYMBOL) + || line.matches("Caused by: " + JAVA_SYMBOL) + || line.matches("([a-zA-Z_$][a-zA-Z\\d_$]*\\.)+[a-zA-Z_$]?[a-zA-Z\\d_$]*(Exception|Error|Throwable)") + || line.matches("... \\d+ more$")) return ERROR; return preLevel.level < level.level ? preLevel : level; } diff --git a/HMCLaF/build.gradle b/HMCLaF/build.gradle index ab3062c7a..a7a27dc46 100755 --- a/HMCLaF/build.gradle +++ b/HMCLaF/build.gradle @@ -18,6 +18,7 @@ plugins { id "me.tatarka.retrolambda" version "3.5.0" + id "org.jetbrains.kotlin.jvm" version "1.1.2-2" } if (System.getenv("BUILD_NUMBER") != null) diff --git a/common.gradle b/common.gradle index f8da1faa2..4259068b5 100755 --- a/common.gradle +++ b/common.gradle @@ -27,6 +27,7 @@ apply plugin: 'maven' dependencies { compile 'com.google.code.gson:gson:2.2.4' // Apache License 2.0 + compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2" } task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {