mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-01 02:04:51 +00:00
Restore language sync
- Bring back 5 commits a force push dropped from GitHub master (0aad88c30)
- Keep the thin Bukkit entry; port language sync into IrisRuntime
- Fetch guides through GitHubLanguageSource instead of the removed catalog
This commit is contained in:
commit
5769b0d4e8
53 files changed
+13688
-14119
No files matched your search
+5
-1
@@ -219,7 +219,11 @@ public final class OfflineRegionGenerator {
|
||||
}
|
||||
|
||||
private static void force(Path path) throws IOException {
|
||||
try (FileChannel channel = FileChannel.open(path, Files.isDirectory(path)
|
||||
boolean directory = Files.isDirectory(path);
|
||||
if (directory && File.separatorChar == '\\') {
|
||||
return;
|
||||
}
|
||||
try (FileChannel channel = FileChannel.open(path, directory
|
||||
? StandardOpenOption.READ : StandardOpenOption.WRITE)) {
|
||||
channel.force(true);
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.mockito.MockedStatic;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.file.Files;
|
||||
@@ -78,7 +79,7 @@ public final class OfflineRegionPublicationTest {
|
||||
assertFalse(Files.exists(target));
|
||||
} else {
|
||||
OfflineRegionGenerator.publish(staged, target);
|
||||
assertEquals(List.of(data, nested, staged, output), forced);
|
||||
assertEquals(File.separatorChar == '\\' ? List.of(data) : List.of(data, nested, staged, output), forced);
|
||||
assertEquals("checkpoint", Files.readString(target.resolve("world/data")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ import art.arcane.iris.world.safeguard.RuntimeLockNotice;
|
||||
import art.arcane.iris.world.task.J;
|
||||
import art.arcane.iris.world.tree.TreeFellerSVC;
|
||||
import art.arcane.iris.world.tree.TreeSVC;
|
||||
import art.arcane.volmlib.util.diagnostics.DebugDumpContributor;
|
||||
import art.arcane.volmlib.integration.ReloadAware;
|
||||
import art.arcane.volmlib.nativelib.terrain.ServerShutdownBoundary;
|
||||
import art.arcane.volmlib.util.bukkit.papi.PlaceholderRegistration;
|
||||
@@ -661,10 +662,11 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
IrisLanguage.initialize();
|
||||
debugDump = BukkitDebugDump.create(plugin, new BukkitDebugDump.Options(
|
||||
() -> true,
|
||||
() -> IrisSafeguard::debugReport));
|
||||
IrisRuntime::captureDebugReport));
|
||||
languageSwitcher = BukkitLanguageSwitcher.register(plugin, IrisLanguage.selections(),
|
||||
new BukkitLanguageSwitcher.Options("iris", "iris.all",
|
||||
DirectorMiniMenu.Theme.irisGreen(), IrisLanguage.directorResolver(), IrisLanguage.editorOptions()));
|
||||
DirectorMiniMenu.Theme.irisGreen(), IrisLanguage.directorResolver(), IrisLanguage.editorOptions(),
|
||||
null, IrisLanguage::checkUpstream, IrisLanguage::metaName));
|
||||
updateNotifier = new IrisUpdateNotifier(plugin);
|
||||
PaperLibBootstrap.install();
|
||||
SimdSupport.install();
|
||||
@@ -803,9 +805,15 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
IrisToolbelt.retainMantleDataForSlice(TreeBlockMaterial.class.getCanonicalName());
|
||||
});
|
||||
timings.mark("startupTasks");
|
||||
IrisLanguage.checkUpstream();
|
||||
timings.report();
|
||||
}
|
||||
|
||||
private static DebugDumpContributor.Report captureDebugReport() {
|
||||
String language = IrisLanguage.debugReport();
|
||||
return () -> IrisSafeguard.debugReport() + "\n" + language;
|
||||
}
|
||||
|
||||
private static final class EnableTimings {
|
||||
private static final int REPORTED_SERVICES = 3;
|
||||
|
||||
|
||||
+14
-8
@@ -1,5 +1,6 @@
|
||||
package art.arcane.iris.platform.agent;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.lang.foreign.Arena;
|
||||
@@ -20,21 +21,26 @@ public class AttachSignalTest {
|
||||
private static final int SIGQUIT = 3;
|
||||
private static final int SIGTERM = 15;
|
||||
private static final long ACTION_BYTES = 256;
|
||||
private static final MethodHandle SIGACTION = Linker.nativeLinker().downcallHandle(
|
||||
Linker.nativeLinker().defaultLookup().find("sigaction").orElseThrow(),
|
||||
FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS));
|
||||
private static MethodHandle sigaction;
|
||||
|
||||
@BeforeClass
|
||||
public static void linkSigaction() {
|
||||
assumeFalse(System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("win"));
|
||||
sigaction = Linker.nativeLinker().downcallHandle(
|
||||
Linker.nativeLinker().defaultLookup().find("sigaction").orElseThrow(),
|
||||
FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aConsoleThatResetsQuitGetsTheJvmHandlerBack() throws Throwable {
|
||||
assumeFalse(System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("win"));
|
||||
long jvmHandler = handler(SIGTERM);
|
||||
assertNotEquals(0L, jvmHandler);
|
||||
try (Arena arena = Arena.ofConfined()) {
|
||||
MemorySegment original = arena.allocate(ACTION_BYTES);
|
||||
assertEquals(0, (int) SIGACTION.invokeExact(SIGQUIT, MemorySegment.NULL, original));
|
||||
assertEquals(0, (int) sigaction.invokeExact(SIGQUIT, MemorySegment.NULL, original));
|
||||
try {
|
||||
MemorySegment reset = arena.allocate(ACTION_BYTES);
|
||||
assertEquals(0, (int) SIGACTION.invokeExact(SIGQUIT, reset, MemorySegment.NULL));
|
||||
assertEquals(0, (int) sigaction.invokeExact(SIGQUIT, reset, MemorySegment.NULL));
|
||||
assertEquals(0L, handler(SIGQUIT));
|
||||
|
||||
assertTrue(AttachSignal.restoreJvmHandler());
|
||||
@@ -42,7 +48,7 @@ public class AttachSignalTest {
|
||||
assertEquals(jvmHandler, handler(SIGQUIT));
|
||||
assertFalse(AttachSignal.restoreJvmHandler());
|
||||
} finally {
|
||||
assertEquals(0, (int) SIGACTION.invokeExact(SIGQUIT, original, MemorySegment.NULL));
|
||||
assertEquals(0, (int) sigaction.invokeExact(SIGQUIT, original, MemorySegment.NULL));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +56,7 @@ public class AttachSignalTest {
|
||||
private static long handler(int signal) throws Throwable {
|
||||
try (Arena arena = Arena.ofConfined()) {
|
||||
MemorySegment action = arena.allocate(ACTION_BYTES);
|
||||
assertEquals(0, (int) SIGACTION.invokeExact(signal, MemorySegment.NULL, action));
|
||||
assertEquals(0, (int) sigaction.invokeExact(signal, MemorySegment.NULL, action));
|
||||
return action.get(ValueLayout.JAVA_LONG, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user