mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-03 03:31:32 +00:00
Declutter the boot log
This commit is contained in:
1 parent
2f82ad34a3
commit
673dda2860
15 files changed
+206
-114
No files matched your search
@@ -24,6 +24,8 @@ import art.arcane.iris.configuration.IrisSettings;
|
|||||||
import art.arcane.iris.configuration.SettingsHotloadWatch;
|
import art.arcane.iris.configuration.SettingsHotloadWatch;
|
||||||
import art.arcane.iris.diagnostics.LogFilterSVC;
|
import art.arcane.iris.diagnostics.LogFilterSVC;
|
||||||
import art.arcane.iris.diagnostics.splash.IrisSplashComposer;
|
import art.arcane.iris.diagnostics.splash.IrisSplashComposer;
|
||||||
|
import art.arcane.iris.diagnostics.splash.IrisSplashPackScanner;
|
||||||
|
import art.arcane.iris.pack.DefaultPackBootstrapProvisioner;
|
||||||
import art.arcane.iris.generation.concurrent.MultiBurst;
|
import art.arcane.iris.generation.concurrent.MultiBurst;
|
||||||
import art.arcane.iris.generation.decoration.tree.TreeBlockMaterial;
|
import art.arcane.iris.generation.decoration.tree.TreeBlockMaterial;
|
||||||
import art.arcane.iris.generation.runtime.BlockEditAccess;
|
import art.arcane.iris.generation.runtime.BlockEditAccess;
|
||||||
@@ -144,6 +146,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@@ -259,7 +262,7 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
|||||||
if (current == null) {
|
if (current == null) {
|
||||||
Iris plugin = Iris.instance;
|
Iris plugin = Iris.instance;
|
||||||
current = new VolmitSender(Bukkit.getConsoleSender());
|
current = new VolmitSender(Bukkit.getConsoleSender());
|
||||||
current.setTag(plugin == null ? IrisSafeguard.mode().tag("") : plugin.getTag());
|
current.setTag(IrisSafeguard.mode().logTag());
|
||||||
sender = current;
|
sender = current;
|
||||||
}
|
}
|
||||||
return current;
|
return current;
|
||||||
@@ -309,14 +312,14 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
|||||||
ComponentLog.logMarkup(
|
ComponentLog.logMarkup(
|
||||||
plugin,
|
plugin,
|
||||||
Logger.getLogger("Iris"),
|
Logger.getLogger("Iris"),
|
||||||
logPrefix(plugin),
|
logPrefix(),
|
||||||
Level.INFO,
|
Level.INFO,
|
||||||
string,
|
string,
|
||||||
null);
|
null);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
try {
|
try {
|
||||||
Iris plugin = Iris.instance;
|
Iris plugin = Iris.instance;
|
||||||
String plainPrefix = ComponentText.legacy(logPrefix(plugin)).plain();
|
String plainPrefix = ComponentText.legacy(logPrefix()).plain();
|
||||||
Logger.getLogger("Iris").log(Level.INFO, plainPrefix + IrisLogging.clean(string));
|
Logger.getLogger("Iris").log(Level.INFO, plainPrefix + IrisLogging.clean(string));
|
||||||
} catch (Throwable inner) {
|
} catch (Throwable inner) {
|
||||||
System.err.println("[Iris] Failed to emit log message: " + inner.getMessage());
|
System.err.println("[Iris] Failed to emit log message: " + inner.getMessage());
|
||||||
@@ -602,14 +605,14 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
|||||||
ComponentLog.logLegacy(
|
ComponentLog.logLegacy(
|
||||||
plugin,
|
plugin,
|
||||||
Logger.getLogger("Iris"),
|
Logger.getLogger("Iris"),
|
||||||
logPrefix(plugin),
|
logPrefix(),
|
||||||
level,
|
level,
|
||||||
message,
|
message,
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String logPrefix(Iris plugin) {
|
private static String logPrefix() {
|
||||||
return plugin == null ? ComponentLog.discriminator("Iris", "&a") : plugin.getTag();
|
return IrisSafeguard.mode().logTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int irisVersion(String input) {
|
static int irisVersion(String input) {
|
||||||
@@ -715,7 +718,7 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
|||||||
timings.mark("datapacks");
|
timings.mark("datapacks");
|
||||||
IrisSafeguard.execute();
|
IrisSafeguard.execute();
|
||||||
timings.mark("safeguard");
|
timings.mark("safeguard");
|
||||||
getSender().setTag(plugin.getTag());
|
getSender().setTag(IrisSafeguard.mode().logTag());
|
||||||
// A cosmetic banner must never abort the bootstrap.
|
// A cosmetic banner must never abort the bootstrap.
|
||||||
J.attempt(this::splash);
|
J.attempt(this::splash);
|
||||||
IrisSafeguard.printReports();
|
IrisSafeguard.printReports();
|
||||||
@@ -814,19 +817,17 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final class EnableTimings {
|
private static final class EnableTimings {
|
||||||
private static final int REPORTED_SERVICES = 3;
|
private static final long REPORTED_PHASE_MIN_MS = 100;
|
||||||
|
private static final long SLOW_SERVICE_MIN_MS = 1000;
|
||||||
|
|
||||||
private final long startedAt = System.nanoTime();
|
private final long startedAt = System.nanoTime();
|
||||||
private final StringBuilder phases = new StringBuilder();
|
private final Map<String, Long> phaseMillis = new LinkedHashMap<>();
|
||||||
private final Map<String, Long> serviceMillis = new LinkedHashMap<>();
|
private final Map<String, Long> serviceMillis = new LinkedHashMap<>();
|
||||||
private long lastMark = startedAt;
|
private long lastMark = startedAt;
|
||||||
|
|
||||||
private void mark(String phase) {
|
private void mark(String phase) {
|
||||||
long now = System.nanoTime();
|
long now = System.nanoTime();
|
||||||
if (!phases.isEmpty()) {
|
phaseMillis.put(phase, TimeUnit.NANOSECONDS.toMillis(now - lastMark));
|
||||||
phases.append(' ');
|
|
||||||
}
|
|
||||||
phases.append(phase).append('=').append(TimeUnit.NANOSECONDS.toMillis(now - lastMark)).append("ms");
|
|
||||||
lastMark = now;
|
lastMark = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,17 +836,26 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void report() {
|
private void report() {
|
||||||
IrisLogging.notice("Enabled in %dms (%s)",
|
String total = seconds(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startedAt));
|
||||||
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startedAt), phases);
|
String phases = slowestFirst(phaseMillis, REPORTED_PHASE_MIN_MS);
|
||||||
String slowest = serviceMillis.entrySet().stream()
|
IrisLogging.notice(phases.isEmpty() ? "Enabled in " + total : "Enabled in " + total + " (" + phases + ")");
|
||||||
.sorted(Map.Entry.<String, Long>comparingByValue().reversed())
|
String slowServices = slowestFirst(serviceMillis, SLOW_SERVICE_MIN_MS);
|
||||||
.limit(REPORTED_SERVICES)
|
if (!slowServices.isEmpty()) {
|
||||||
.map(entry -> entry.getKey() + "=" + entry.getValue() + "ms")
|
IrisLogging.notice("Slow services: " + slowServices);
|
||||||
.collect(Collectors.joining(" "));
|
|
||||||
if (!slowest.isBlank()) {
|
|
||||||
IrisLogging.notice("Slowest services: %s", slowest);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String slowestFirst(Map<String, Long> millisByName, long minimumMillis) {
|
||||||
|
return millisByName.entrySet().stream()
|
||||||
|
.filter(entry -> entry.getValue() >= minimumMillis)
|
||||||
|
.sorted(Map.Entry.<String, Long>comparingByValue().reversed())
|
||||||
|
.map(entry -> entry.getKey() + " " + seconds(entry.getValue()))
|
||||||
|
.collect(Collectors.joining(", "));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String seconds(long millis) {
|
||||||
|
return String.format(Locale.ROOT, "%.1fs", millis / 1000.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getTemp() {
|
private File getTemp() {
|
||||||
@@ -1489,15 +1499,34 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void splash() {
|
private void splash() {
|
||||||
Iris.info("Custom Biomes: " + INMS.get().countCustomBiomes());
|
File packFolder = Iris.service(StudioSVC.class).getWorkspaceFolder();
|
||||||
printPacks();
|
List<IrisSplashPackScanner.SplashPackMetadata> packs = IrisSplashPackScanner.collect(packFolder, Iris::reportError);
|
||||||
|
List<List<IrisSplashComposer.Detail>> startupFacts = startupFacts(packs);
|
||||||
IrisSafeguard.mode().trySplash();
|
if (IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
||||||
|
printWithoutLogPrefix(IrisSafeguard.mode().composeSplash(startupFacts));
|
||||||
|
} else {
|
||||||
|
startupFacts.forEach(row -> Iris.info(IrisSplashComposer.plainRow(row)));
|
||||||
|
}
|
||||||
|
announcePackUpdates(packs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printPacks() {
|
private void printWithoutLogPrefix(String text) {
|
||||||
File packFolder = Iris.service(StudioSVC.class).getWorkspaceFolder();
|
ComponentLog.logLegacy(plugin, Logger.getLogger("Iris"), "", Level.INFO, text, null);
|
||||||
IrisSplashComposer.composePackLines(packFolder, Iris::reportError).thenAccept(lines -> {
|
}
|
||||||
|
|
||||||
|
private static List<List<IrisSplashComposer.Detail>> startupFacts(List<IrisSplashPackScanner.SplashPackMetadata> packs) {
|
||||||
|
boolean eagerInjection = IrisSettings.get().getGeneral().isEagerRuntimeInjection();
|
||||||
|
boolean datapackFromBootstrap = DefaultPackBootstrapProvisioner.wasProvisionedThisStartup();
|
||||||
|
return List.of(
|
||||||
|
List.of(new IrisSplashComposer.Detail("Packs", IrisSplashComposer.packSummary(packs))),
|
||||||
|
List.of(new IrisSplashComposer.Detail("Custom biomes", String.valueOf(INMS.get().countCustomBiomes()))),
|
||||||
|
List.of(new IrisSplashComposer.Detail("SIMD", SimdSupport.shortStatus()),
|
||||||
|
new IrisSplashComposer.Detail("Datapack", datapackFromBootstrap ? "bootstrap" : "startup install"),
|
||||||
|
new IrisSplashComposer.Detail("Injection", eagerInjection ? "eager" : "deferred")));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void announcePackUpdates(List<IrisSplashPackScanner.SplashPackMetadata> packs) {
|
||||||
|
IrisSplashComposer.composeUpdateLines(packs).thenAccept(lines -> {
|
||||||
if (plugin.isEnabled()) {
|
if (plugin.isEnabled()) {
|
||||||
lines.forEach(Iris::info);
|
lines.forEach(Iris::info);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -243,12 +243,10 @@ public final class IrisWorldGeneratorResolver {
|
|||||||
Iris.info("Pack '" + result.getPackName() + "' is waiting for external block providers to initialize.");
|
Iris.info("Pack '" + result.getPackName() + "' is waiting for external block providers to initialize.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PackBootReporter.logBroken(result);
|
PackBootReporter.logBroken(result, minecraftVersion);
|
||||||
} else {
|
} else {
|
||||||
PackBootReporter.logValidated(result, minecraftVersion, cached.isEmpty());
|
PackBootReporter.logValidated(result, minecraftVersion, false);
|
||||||
}
|
}
|
||||||
// Cache hits carry the persisted findings, so the listing prints on every boot, not only after a miss.
|
|
||||||
PackBootReporter.logCompat(result, minecraftVersion);
|
|
||||||
}
|
}
|
||||||
IrisStartupValidation.markPacksReady();
|
IrisStartupValidation.markPacksReady();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,9 +145,8 @@ public final class ModdedStartup {
|
|||||||
if (result.isLoadable()) {
|
if (result.isLoadable()) {
|
||||||
PackBootReporter.logValidated(result, minecraftVersion, true);
|
PackBootReporter.logValidated(result, minecraftVersion, true);
|
||||||
} else {
|
} else {
|
||||||
PackBootReporter.logBroken(result);
|
PackBootReporter.logBroken(result, minecraftVersion);
|
||||||
}
|
}
|
||||||
PackBootReporter.logCompat(result, minecraftVersion);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
ModdedIrisLog.error("Iris pack validation failed for '{}'", packDir.getName(), e);
|
ModdedIrisLog.error("Iris pack validation failed for '{}'", packDir.getName(), e);
|
||||||
String detail = e.getMessage();
|
String detail = e.getMessage();
|
||||||
|
|||||||
@@ -3,21 +3,68 @@ package art.arcane.iris.diagnostics.splash;
|
|||||||
import art.arcane.iris.BuildConstants;
|
import art.arcane.iris.BuildConstants;
|
||||||
import art.arcane.iris.pack.BuiltInPackUpdates;
|
import art.arcane.iris.pack.BuiltInPackUpdates;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public final class IrisSplashComposer {
|
public final class IrisSplashComposer {
|
||||||
private static final String SPLASH_PADDING = " ".repeat(4);
|
private static final String SPLASH_PADDING = " ".repeat(4);
|
||||||
|
private static final int FIRST_SPARE_INFO_ROW = 8;
|
||||||
|
private static final int SPARE_INFO_ROWS = 3;
|
||||||
|
private static final int PACKS_SHOWN = 6;
|
||||||
|
private static final int SHORT_COMMIT_LENGTH = 7;
|
||||||
|
|
||||||
private IrisSplashComposer() {
|
private IrisSplashComposer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] composeInfo(String version, String serverLine, InfoStyle style) {
|
public static String[] composeInfo(String version, String serverLine, InfoStyle style) {
|
||||||
|
return composeInfo(version, serverLine, style, List.of());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String[] composeInfo(String version, String serverLine, InfoStyle style, List<List<Detail>> detailRows) {
|
||||||
|
String[] info = composeHeader(version, serverLine, style);
|
||||||
|
int rows = Math.min(detailRows.size(), SPARE_INFO_ROWS);
|
||||||
|
for (int row = 0; row < rows; row++) {
|
||||||
|
info[FIRST_SPARE_INFO_ROW + row] = style.linePrefix() + styledRow(detailRows.get(row), style);
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String plainRow(List<Detail> row) {
|
||||||
|
return styledRow(row, InfoStyle.PLAIN).strip();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String packSummary(List<IrisSplashPackScanner.SplashPackMetadata> packs) {
|
||||||
|
if (packs.isEmpty()) {
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
|
String shown = packs.stream()
|
||||||
|
.limit(PACKS_SHOWN)
|
||||||
|
.map(pack -> pack.name() + " v" + pack.version())
|
||||||
|
.collect(Collectors.joining(", "));
|
||||||
|
int hidden = packs.size() - PACKS_SHOWN;
|
||||||
|
return hidden > 0 ? shown + " +" + hidden + " more" : shown;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String styledRow(List<Detail> row, InfoStyle style) {
|
||||||
|
StringBuilder styled = new StringBuilder();
|
||||||
|
for (Detail detail : row) {
|
||||||
|
String separator = styled.isEmpty() ? " " : " | ";
|
||||||
|
styled.append(style.label(separator + detail.label() + ": ")).append(style.value(detail.value()));
|
||||||
|
}
|
||||||
|
return styled.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String shortCommit() {
|
||||||
|
String commit = BuildConstants.COMMIT;
|
||||||
|
return commit.length() > SHORT_COMMIT_LENGTH ? commit.substring(0, SHORT_COMMIT_LENGTH) : commit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String[] composeHeader(String version, String serverLine, InfoStyle style) {
|
||||||
String releaseTrain = releaseTrain(version);
|
String releaseTrain = releaseTrain(version);
|
||||||
String prefix = style.linePrefix();
|
String prefix = style.linePrefix();
|
||||||
return new String[]{
|
return new String[]{
|
||||||
@@ -28,7 +75,7 @@ public final class IrisSplashComposer {
|
|||||||
prefix + style.label(" Web: ") + style.value("VolmitSoftware.com"),
|
prefix + style.label(" Web: ") + style.value("VolmitSoftware.com"),
|
||||||
prefix + style.label(" Server: ") + style.value(serverLine),
|
prefix + style.label(" Server: ") + style.value(serverLine),
|
||||||
prefix + style.label(" Java: ") + style.value(javaVersion() < 0 ? "unknown" : String.valueOf(javaVersion())) + style.label(" | Date: ") + style.value(startupDate()),
|
prefix + style.label(" Java: ") + style.value(javaVersion() < 0 ? "unknown" : String.valueOf(javaVersion())) + style.label(" | Date: ") + style.value(startupDate()),
|
||||||
prefix + style.label(" Commit: ") + style.value(BuildConstants.COMMIT) + style.label("/") + style.value(BuildConstants.ENVIRONMENT),
|
prefix + style.label(" Commit: ") + style.value(shortCommit()) + style.label("/") + style.value(BuildConstants.ENVIRONMENT),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
""
|
""
|
||||||
@@ -43,25 +90,14 @@ public final class IrisSplashComposer {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompletableFuture<List<String>> composePackLines(File packFolder, IrisSplashPackScanner.SplashPackErrorReporter reporter) {
|
public static CompletableFuture<List<String>> composeUpdateLines(List<IrisSplashPackScanner.SplashPackMetadata> packs) {
|
||||||
List<IrisSplashPackScanner.SplashPackMetadata> packs = IrisSplashPackScanner.collect(packFolder, reporter);
|
|
||||||
return BuiltInPackUpdates.check(packs.stream().map(IrisSplashPackScanner.SplashPackMetadata::name).toList())
|
return BuiltInPackUpdates.check(packs.stream().map(IrisSplashPackScanner.SplashPackMetadata::name).toList())
|
||||||
.thenApply(updates -> composePackLines(packs, updates));
|
.thenApply(updates -> composeUpdateLines(packs, updates));
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<String> composePackLines(List<IrisSplashPackScanner.SplashPackMetadata> packs,
|
static List<String> composeUpdateLines(List<IrisSplashPackScanner.SplashPackMetadata> packs,
|
||||||
Map<String, BuiltInPackUpdates.Update> updates) {
|
Map<String, BuiltInPackUpdates.Update> updates) {
|
||||||
if (packs.isEmpty()) {
|
List<String> lines = new ArrayList<>();
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> lines = new ArrayList<>(packs.size() + 1);
|
|
||||||
lines.add("Custom Dimensions: " + packs.size());
|
|
||||||
for (IrisSplashPackScanner.SplashPackMetadata pack : packs) {
|
|
||||||
BuiltInPackUpdates.Update update = updates.get(pack.name());
|
|
||||||
lines.add(" " + pack.name() + " v" + pack.version()
|
|
||||||
+ (update == null ? "" : update.suffix(pack.version())));
|
|
||||||
}
|
|
||||||
for (IrisSplashPackScanner.SplashPackMetadata pack : packs) {
|
for (IrisSplashPackScanner.SplashPackMetadata pack : packs) {
|
||||||
BuiltInPackUpdates.Update update = updates.get(pack.name());
|
BuiltInPackUpdates.Update update = updates.get(pack.name());
|
||||||
if (update != null && update.newerThan(pack.version())) {
|
if (update != null && update.newerThan(pack.version())) {
|
||||||
@@ -106,6 +142,9 @@ public final class IrisSplashComposer {
|
|||||||
return LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
return LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public record Detail(String label, String value) {
|
||||||
|
}
|
||||||
|
|
||||||
public interface InfoStyle {
|
public interface InfoStyle {
|
||||||
InfoStyle PLAIN = new InfoStyle() {
|
InfoStyle PLAIN = new InfoStyle() {
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import art.arcane.iris.spi.IrisLogging;
|
|||||||
import art.arcane.iris.configuration.IrisSettings;
|
import art.arcane.iris.configuration.IrisSettings;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public final class SimdSupport {
|
public final class SimdSupport {
|
||||||
private static final String VECTOR_MODULE = "jdk.incubator.vector";
|
private static final String VECTOR_MODULE = "jdk.incubator.vector";
|
||||||
|
private static final Pattern VECTOR_SHAPE_BITS = Pattern.compile("^.*S_(\\d+)_BIT.*$");
|
||||||
private static final boolean MODULE_PRESENT = ModuleLayer.boot().findModule(VECTOR_MODULE).isPresent();
|
private static final boolean MODULE_PRESENT = ModuleLayer.boot().findModule(VECTOR_MODULE).isPresent();
|
||||||
private static final AtomicReference<Throwable> KERNEL_FAILURE = new AtomicReference<>();
|
private static final AtomicReference<Throwable> KERNEL_FAILURE = new AtomicReference<>();
|
||||||
private static final SimdKernels KERNELS = selectKernels();
|
private static final SimdKernels KERNELS = selectKernels();
|
||||||
@@ -54,8 +56,19 @@ public final class SimdSupport {
|
|||||||
return "scalar kernels active; the Vector API reported no usable vector shape on this CPU";
|
return "scalar kernels active; the Vector API reported no usable vector shape on this CPU";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String shortStatus() {
|
||||||
|
if (!isVectorized()) {
|
||||||
|
return "scalar";
|
||||||
|
}
|
||||||
|
return VECTOR_SHAPE_BITS.matcher(KERNELS.describe()).replaceFirst("$1-bit");
|
||||||
|
}
|
||||||
|
|
||||||
public static void install() {
|
public static void install() {
|
||||||
IrisLogging.info("SIMD: " + kernelStatus());
|
if (isVectorized()) {
|
||||||
|
IrisLogging.debug("SIMD: " + kernelStatus());
|
||||||
|
} else {
|
||||||
|
IrisLogging.info("SIMD: " + kernelStatus());
|
||||||
|
}
|
||||||
|
|
||||||
Throwable failure = KERNEL_FAILURE.get();
|
Throwable failure = KERNEL_FAILURE.get();
|
||||||
if (failure != null) {
|
if (failure != null) {
|
||||||
|
|||||||
@@ -615,11 +615,11 @@ public final class IrisLanguage {
|
|||||||
IrisLogging.info("Updated Iris language " + locale + " from " + source + ": " + result.summary() + ".");
|
IrisLogging.info("Updated Iris language " + locale + " from " + source + ": " + result.summary() + ".");
|
||||||
}
|
}
|
||||||
if (report.coolingDown()) {
|
if (report.coolingDown()) {
|
||||||
IrisLogging.info("Iris language source " + sourceDescription() + " was checked recently; the next check is allowed in "
|
IrisLogging.debug("Iris language source " + sourceDescription() + " was checked recently; the next check is allowed in "
|
||||||
+ report.cooldownRemaining() + ".");
|
+ report.cooldownRemaining() + ".");
|
||||||
} else if (report.failure().isEmpty() && report.changedLocales().isEmpty() && report.failures().isEmpty()
|
} else if (report.failure().isEmpty() && report.changedLocales().isEmpty() && report.failures().isEmpty()
|
||||||
&& report.revision().isPresent()) {
|
&& report.revision().isPresent()) {
|
||||||
IrisLogging.info("Iris languages match " + sourceDescription() + " (" + revision + ").");
|
IrisLogging.debug("Iris languages match " + sourceDescription() + " (" + revision + ").");
|
||||||
}
|
}
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,53 +3,60 @@ package art.arcane.iris.pack;
|
|||||||
import art.arcane.iris.localization.ChatReport;
|
import art.arcane.iris.localization.ChatReport;
|
||||||
import art.arcane.iris.pack.validation.PackCompatReport;
|
import art.arcane.iris.pack.validation.PackCompatReport;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/** Console output for pack validation at startup, shared by every platform so the boot log reads the same. */
|
/** Console output for pack validation at startup, shared by every platform so the boot log reads the same. */
|
||||||
public final class PackBootReporter {
|
public final class PackBootReporter {
|
||||||
private static final int BOOT_ITEM_LIMIT = 5;
|
private static final int BOOT_ITEM_LIMIT = 5;
|
||||||
private static final int COMPAT_SUBJECTS_PER_KEY = 3;
|
private static final int COMPAT_KEYS_SHOWN = 2;
|
||||||
|
private static final Pattern SENTENCE_BREAK = Pattern.compile("(?<=[.!?])\\s+(?=[A-Z\\[])");
|
||||||
|
|
||||||
private PackBootReporter() {
|
private PackBootReporter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logBroken(PackValidationResult result) {
|
public static void logBroken(PackValidationResult result, String minecraftVersion) {
|
||||||
String pack = result.getPackName();
|
String pack = result.getPackName();
|
||||||
logCapped(ChatReport.Tone.ERROR,
|
logReport(ChatReport.Tone.ERROR,
|
||||||
"Pack '" + pack + "' failed validation; world and Studio creation with it are refused",
|
"Pack '" + pack + "' failed validation, worlds and Studio refuse it",
|
||||||
pack, result.getBlockingErrors());
|
result, minecraftVersion, result.getBlockingErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logValidated(PackValidationResult result, String minecraftVersion, boolean announceClean) {
|
public static void logValidated(PackValidationResult result, String minecraftVersion, boolean announceClean) {
|
||||||
String pack = result.getPackName();
|
String pack = result.getPackName();
|
||||||
String compatSummary = PackValidator.compatSummary(result, minecraftVersion);
|
int warnings = result.getWarnings().size();
|
||||||
String compatSuffix = compatSummary.isEmpty() ? "" : " " + compatSummary;
|
if (warnings > 0) {
|
||||||
if (!result.getWarnings().isEmpty()) {
|
logReport(ChatReport.Tone.WARNING,
|
||||||
logCapped(ChatReport.Tone.WARNING,
|
"Pack '" + pack + "': " + warnings + (warnings == 1 ? " warning" : " warnings"),
|
||||||
"Pack '" + pack + "' validated with " + result.getWarnings().size() + " warning(s)." + compatSuffix,
|
result, minecraftVersion, result.getWarnings());
|
||||||
pack, result.getWarnings());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (announceClean || !compatSummary.isEmpty()) {
|
if (!result.getCompatFindings().isEmpty()) {
|
||||||
ChatReport.of(ChatReport.Tone.SUCCESS, "Pack '" + pack + "' validated." + compatSuffix).build().log();
|
logReport(ChatReport.Tone.WARNING, "Pack '" + pack + "': content unavailable",
|
||||||
|
result, minecraftVersion, List.of());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (announceClean) {
|
||||||
|
ChatReport.of(ChatReport.Tone.SUCCESS, "Pack '" + pack + "' validated").build().log();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logCompat(PackValidationResult result, String minecraftVersion) {
|
private static void logReport(ChatReport.Tone tone, String title, PackValidationResult result,
|
||||||
if (result == null || result.getCompatFindings().isEmpty()) {
|
String minecraftVersion, List<String> reasons) {
|
||||||
return;
|
String pack = result.getPackName();
|
||||||
|
List<String> items = new ArrayList<>(reasons.size() + 1);
|
||||||
|
reasons.forEach(reason -> items.add(firstSentence(reason)));
|
||||||
|
String details = "/iris pack validate " + pack;
|
||||||
|
if (!result.getCompatFindings().isEmpty()) {
|
||||||
|
items.add(PackCompatReport.of(result.getCompatFindings())
|
||||||
|
.bootItem(PackValidator.versionOf(result, minecraftVersion), COMPAT_KEYS_SHOWN));
|
||||||
|
details += ", /iris pack compat " + pack;
|
||||||
}
|
}
|
||||||
PackCompatReport.of(result.getCompatFindings())
|
ChatReport.of(tone, title).items(items).limit(BOOT_ITEM_LIMIT).hint("Details: " + details, null).build().log();
|
||||||
.bootReport(result.getPackName(), PackValidator.versionOf(result, minecraftVersion),
|
|
||||||
COMPAT_SUBJECTS_PER_KEY, BOOT_ITEM_LIMIT)
|
|
||||||
.log();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void logCapped(ChatReport.Tone tone, String title, String pack, List<String> items) {
|
private static String firstSentence(String reason) {
|
||||||
ChatReport.Builder report = ChatReport.of(tone, title).items(items).limit(BOOT_ITEM_LIMIT);
|
return SENTENCE_BREAK.split(reason, 2)[0];
|
||||||
if (items.size() > BOOT_ITEM_LIMIT) {
|
|
||||||
report.hint("/iris pack validate " + pack + " lists everything", null);
|
|
||||||
}
|
|
||||||
report.build().log();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ public final class DatapackIngestService {
|
|||||||
urls,
|
urls,
|
||||||
localFingerprint)) {
|
localFingerprint)) {
|
||||||
DatapackStartupValidation.activeStartupValidation = cached;
|
DatapackStartupValidation.activeStartupValidation = cached;
|
||||||
IrisLogging.info("External datapacks match the persisted startup validation; remote resolution and full revalidation were skipped.");
|
IrisLogging.debug("External datapacks match the persisted startup validation; remote resolution and full revalidation were skipped.");
|
||||||
IrisStartupValidation.markDatapacksReady();
|
IrisStartupValidation.markDatapacksReady();
|
||||||
return StartupValidationOutcome.READY;
|
return StartupValidationOutcome.READY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public class ServerConfigurator {
|
|||||||
&& pinLoadedDatapackCompilerInputs(
|
&& pinLoadedDatapackCompilerInputs(
|
||||||
DefaultPackBootstrapProvisioner.compilerInputFingerprintThisStartup())
|
DefaultPackBootstrapProvisioner.compilerInputFingerprintThisStartup())
|
||||||
&& pinLoadedDatapackRegistryRequirements();
|
&& pinLoadedDatapackRegistryRequirements();
|
||||||
IrisLogging.info("Paper loaded the Iris datapack during bootstrap; skipping the legacy startup install.");
|
IrisLogging.debug("Paper loaded the Iris datapack during bootstrap; skipping the legacy startup install.");
|
||||||
} else {
|
} else {
|
||||||
DatapackInstallResult result = installDataPacks(true);
|
DatapackInstallResult result = installDataPacks(true);
|
||||||
loadedDatapackRuntimeReady = result.succeeded()
|
loadedDatapackRuntimeReady = result.succeeded()
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package art.arcane.iris.pack.validation;
|
package art.arcane.iris.pack.validation;
|
||||||
|
|
||||||
import art.arcane.iris.localization.ChatReport;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@@ -167,16 +166,15 @@ public final class PackCompatReport {
|
|||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The boot listing as a themed report, capped to {@code maxKeys} keys; null when there are no findings. */
|
/** {@code 4 content keys unavailable on Minecraft 26.3: create:limestone, create:scoria +2 more} */
|
||||||
public synchronized ChatReport bootReport(String packName, String minecraftVersion, int perKeyCap, int maxKeys) {
|
public synchronized String bootItem(String minecraftVersion, int maxKeys) {
|
||||||
if (findings.isEmpty()) {
|
List<String> keys = byKey().values().stream().map(group -> group.getFirst().key()).toList();
|
||||||
return null;
|
int shown = Math.min(maxKeys, keys.size());
|
||||||
}
|
int hidden = keys.size() - shown;
|
||||||
return ChatReport.of(ChatReport.Tone.WARNING, bootHeader(packName, minecraftVersion))
|
return keys.size() + (keys.size() == 1 ? " content key" : " content keys")
|
||||||
.items(keyLines(perKeyCap))
|
+ " unavailable on Minecraft " + versionOrUnknown(minecraftVersion) + ": "
|
||||||
.limit(maxKeys)
|
+ String.join(", ", keys.subList(0, shown))
|
||||||
.hint(bootRemedy(packName), null)
|
+ (hidden > 0 ? " +" + hidden + " more" : "");
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String bootHeader(String packName, String minecraftVersion) {
|
private static String bootHeader(String packName, String minecraftVersion) {
|
||||||
|
|||||||
@@ -67,8 +67,7 @@ public class Agent {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IrisLogging.info("Installing Java Agent...");
|
IrisLogging.info("Installing Java agent, the JVM warnings below are expected");
|
||||||
IrisLogging.info("Note: JVM [Attach Listener/ERROR] [STDERR] warning lines during this step are expected and not Iris errors.");
|
|
||||||
ByteBuddyAgent.attach(AGENT_JAR, ByteBuddyAgent.ProcessProvider.ForCurrentVm.INSTANCE);
|
ByteBuddyAgent.attach(AGENT_JAR, ByteBuddyAgent.ProcessProvider.ForCurrentVm.INSTANCE);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
IrisLogging.error("Failed to install Java Agent: " + e.getMessage());
|
IrisLogging.error("Failed to install Java Agent: " + e.getMessage());
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class StudioSVC implements IrisService {
|
|||||||
String configuredPack = IrisSettings.get().getGenerator().getDefaultWorldType();
|
String configuredPack = IrisSettings.get().getGenerator().getDefaultWorldType();
|
||||||
if (!PackDownloader.isPackPresent(getWorkspaceFolder(), configuredPack)) {
|
if (!PackDownloader.isPackPresent(getWorkspaceFolder(), configuredPack)) {
|
||||||
IrisLogging.warn("Default pack '" + configuredPack
|
IrisLogging.warn("Default pack '" + configuredPack
|
||||||
+ "' is not installed. Install a built-in pack with /iris download pack=overworld or provide /iris download link=<zip-url>.");
|
+ "' is not installed: /iris download pack=overworld");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -105,12 +105,16 @@ public final class IrisSafeguard {
|
|||||||
|
|
||||||
public static void printReports() {
|
public static void printReports() {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case STABLE -> IrisLogging.info(C.BLUE + "0 Conflicts found");
|
case STABLE -> {
|
||||||
|
}
|
||||||
case WARNING -> IrisLogging.warn(C.GOLD + "%s Issues found", count);
|
case WARNING -> IrisLogging.warn(C.GOLD + "%s Issues found", count);
|
||||||
case UNSTABLE -> IrisLogging.error(C.DARK_RED + "%s Issues found", count);
|
case UNSTABLE -> IrisLogging.error(C.DARK_RED + "%s Issues found", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CheckResult value : results.values()) {
|
for (CheckResult value : results.values()) {
|
||||||
|
if (value.mode() == Mode.STABLE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Without the stack trace: Diagnostic.Logger splits on newlines, so a trace became one log
|
// Without the stack trace: Diagnostic.Logger splits on newlines, so a trace became one log
|
||||||
// record per frame at the diagnostic's own severity. Traces go through reportError.
|
// record per frame at the diagnostic's own severity. Traces go through reportError.
|
||||||
value.log(true, false);
|
value.log(true, false);
|
||||||
@@ -119,7 +123,7 @@ public final class IrisSafeguard {
|
|||||||
|
|
||||||
public static void printFooter() {
|
public static void printFooter() {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case STABLE -> IrisLogging.info(C.BLUE + "Iris is running Stable");
|
case STABLE -> IrisLogging.info(C.BLUE + "Stable, 0 conflicts");
|
||||||
case WARNING -> warning();
|
case WARNING -> warning();
|
||||||
case UNSTABLE -> unstable();
|
case UNSTABLE -> unstable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package art.arcane.iris.world.safeguard;
|
package art.arcane.iris.world.safeguard;
|
||||||
|
|
||||||
import art.arcane.iris.configuration.IrisSettings;
|
|
||||||
import art.arcane.iris.diagnostics.splash.IrisSplashComposer;
|
import art.arcane.iris.diagnostics.splash.IrisSplashComposer;
|
||||||
import art.arcane.iris.diagnostics.splash.IrisSplashRenderer;
|
import art.arcane.iris.diagnostics.splash.IrisSplashRenderer;
|
||||||
import art.arcane.iris.platform.bukkit.BukkitPlatform;
|
import art.arcane.iris.platform.bukkit.BukkitPlatform;
|
||||||
import art.arcane.iris.spi.IrisLogging;
|
|
||||||
import art.arcane.iris.localization.C;
|
import art.arcane.iris.localization.C;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public enum Mode {
|
public enum Mode {
|
||||||
@@ -43,18 +42,15 @@ public enum Mode {
|
|||||||
return wrap("Iris") + " " + wrap(subTag) + C.GRAY + ": ";
|
return wrap("Iris") + " " + wrap(subTag) + C.GRAY + ": ";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void trySplash() {
|
public String logTag() {
|
||||||
if (!IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
return color.toString() + C.BOLD + "Iris" + C.RESET + C.DARK_GRAY + " | " + C.RESET;
|
||||||
return;
|
|
||||||
}
|
|
||||||
splash();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void splash() {
|
public String composeSplash(List<List<IrisSplashComposer.Detail>> detailRows) {
|
||||||
String version = BukkitPlatform.plugin().getDescription().getVersion();
|
String version = BukkitPlatform.plugin().getDescription().getVersion();
|
||||||
String[] splash = IrisSplashRenderer.render(this::splashTone);
|
String[] splash = IrisSplashRenderer.render(this::splashTone);
|
||||||
String[] info = IrisSplashComposer.composeInfo(version, getServerVersion(), infoStyle());
|
String[] info = IrisSplashComposer.composeInfo(version, getServerVersion(), infoStyle(), detailRows);
|
||||||
IrisLogging.info(IrisSplashComposer.compose(splash, info));
|
return IrisSplashComposer.compose(splash, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IrisSplashComposer.InfoStyle infoStyle() {
|
private IrisSplashComposer.InfoStyle infoStyle() {
|
||||||
|
|||||||
@@ -11,16 +11,26 @@ import static org.junit.Assert.assertFalse;
|
|||||||
|
|
||||||
public class IrisSplashComposerTest {
|
public class IrisSplashComposerTest {
|
||||||
@Test
|
@Test
|
||||||
public void packLinesShowUpdatesAndKeepCustomPacks() {
|
public void updateLinesNameOnlyOutdatedPacks() {
|
||||||
List<IrisSplashPackScanner.SplashPackMetadata> packs = List.of(
|
List<IrisSplashPackScanner.SplashPackMetadata> packs = List.of(
|
||||||
new IrisSplashPackScanner.SplashPackMetadata("custom", "7"),
|
new IrisSplashPackScanner.SplashPackMetadata("custom", "7"),
|
||||||
new IrisSplashPackScanner.SplashPackMetadata("overworld", "4009"),
|
new IrisSplashPackScanner.SplashPackMetadata("overworld", "4009"),
|
||||||
new IrisSplashPackScanner.SplashPackMetadata("underworld", "1012"));
|
new IrisSplashPackScanner.SplashPackMetadata("underworld", "1012"));
|
||||||
assertEquals(List.of("Custom Dimensions: 3", " custom v7", " overworld v4009 -> v4010 available",
|
assertEquals(List.of("Update overworld: /iris download pack=overworld overwrite=true"),
|
||||||
" underworld v1012", "Update overworld: /iris download pack=overworld overwrite=true"),
|
IrisSplashComposer.composeUpdateLines(packs, Map.of(
|
||||||
IrisSplashComposer.composePackLines(packs, Map.of(
|
|
||||||
"overworld", new BuiltInPackUpdates.Update("4010"),
|
"overworld", new BuiltInPackUpdates.Update("4010"),
|
||||||
"underworld", new BuiltInPackUpdates.Update("1012"))));
|
"underworld", new BuiltInPackUpdates.Update("1012"))));
|
||||||
|
assertEquals("custom v7, overworld v4009, underworld v1012", IrisSplashComposer.packSummary(packs));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void detailRowsFillTheSpareSplashRows() {
|
||||||
|
String[] info = IrisSplashComposer.composeInfo("4.0.0-26.2", "Paper 26.2", IrisSplashComposer.InfoStyle.PLAIN,
|
||||||
|
List.of(List.of(new IrisSplashComposer.Detail("SIMD", "256-bit"),
|
||||||
|
new IrisSplashComposer.Detail("Injection", "deferred"))));
|
||||||
|
|
||||||
|
assertEquals(11, info.length);
|
||||||
|
assertEquals(" SIMD: 256-bit | Injection: deferred", info[8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in new issue
Block a user