[FIX] Oshi requires slf4j api

This commit is contained in:
Gravita 2024-03-23 14:09:47 +07:00
parent e5840243b3
commit bd677c26ba
2 changed files with 3 additions and 5 deletions

View file

@ -47,9 +47,7 @@
pack project(':LauncherAPI') pack project(':LauncherAPI')
pack project(':LauncherClient') pack project(':LauncherClient')
pack project(':LauncherStart') pack project(':LauncherStart')
bundle(group: 'com.github.oshi', name: 'oshi-core', version: rootProject['verOshiCore']) { bundle(group: 'com.github.oshi', name: 'oshi-core', version: rootProject['verOshiCore'])
exclude group: 'org.slf4j'
}
} }
tasks.register('genRuntimeJS', Zip) { tasks.register('genRuntimeJS', Zip) {

View file

@ -23,7 +23,7 @@ public final class LogHelper {
public static final String DEV_PROPERTY = "launcher.dev"; public static final String DEV_PROPERTY = "launcher.dev";
public static final String STACKTRACE_PROPERTY = "launcher.stacktrace"; public static final String STACKTRACE_PROPERTY = "launcher.stacktrace";
public static final String NO_JANSI_PROPERTY = "launcher.noJAnsi"; public static final String NO_JANSI_PROPERTY = "launcher.noJAnsi";
public static final String NO_SLF4J_PROPERTY = "launcher.noSlf4j"; public static final String SLF4J_PROPERTY = "launcher.useSlf4j";
private static final Set<Consumer<Throwable>> EXCEPTIONS_CALLBACKS = Collections.newSetFromMap(new ConcurrentHashMap<>(2)); private static final Set<Consumer<Throwable>> EXCEPTIONS_CALLBACKS = Collections.newSetFromMap(new ConcurrentHashMap<>(2));
private static final LogHelperAppender impl; private static final LogHelperAppender impl;
@ -31,7 +31,7 @@ public final class LogHelper {
boolean useSlf4j = false; boolean useSlf4j = false;
try { try {
Class.forName("org.slf4j.Logger", false, LogHelper.class.getClassLoader()); Class.forName("org.slf4j.Logger", false, LogHelper.class.getClassLoader());
useSlf4j = !Boolean.getBoolean(NO_SLF4J_PROPERTY); useSlf4j = Boolean.getBoolean(SLF4J_PROPERTY);
} catch (ClassNotFoundException ignored) { } catch (ClassNotFoundException ignored) {
} }
if (useSlf4j) { if (useSlf4j) {