mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-30 21:05:58 -05:00
Refactor and improve tests (#466)
* Install and run a production server in tests * Small improvements * Add FabricAPI build test Create new GradleProjectTestTrait replacing the old trait Improve groovy code formatting. * Refactor tests * Fix MultiProjectTest + fix logging for fabric api test * Cleanup and fixes * Update fabric api + run in parallel for speed * Set server memory + fix error
This commit is contained in:
@@ -29,6 +29,7 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -36,6 +37,7 @@ import java.util.stream.StreamSupport;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import org.gradle.api.Project;
|
||||
@@ -108,7 +110,13 @@ public final class MixinRefmapHelper {
|
||||
|
||||
@NotNull
|
||||
private static Collection<String> getMixinConfigurationFiles(JsonObject fabricModJson) {
|
||||
return StreamSupport.stream(fabricModJson.getAsJsonArray("mixins").spliterator(), false)
|
||||
JsonArray mixins = fabricModJson.getAsJsonArray("mixins");
|
||||
|
||||
if (mixins == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return StreamSupport.stream(mixins.spliterator(), false)
|
||||
.map(e -> {
|
||||
if (e instanceof JsonPrimitive str) {
|
||||
return str.getAsString();
|
||||
|
||||
@@ -54,7 +54,7 @@ public class MinecraftProcessedProvider extends MinecraftMappedProvider {
|
||||
protected void addDependencies(DependencyInfo dependency, Consumer<Runnable> postPopulationScheduler) {
|
||||
if (jarProcessorManager.isInvalid(projectMappedJar) || isRefreshDeps()) {
|
||||
getProject().getLogger().info(":processing mapped jar");
|
||||
invalidateJars();
|
||||
invalidateJar();
|
||||
|
||||
try {
|
||||
FileUtils.copyFile(super.getMappedJar(), projectMappedJar);
|
||||
@@ -69,16 +69,14 @@ public class MinecraftProcessedProvider extends MinecraftMappedProvider {
|
||||
getProject().getDependencies().module("net.minecraft:minecraft-" + projectMappedClassifier + ":" + getMinecraftProvider().minecraftVersion() + "/" + getExtension().getMappingsProvider().mappingsIdentifier()));
|
||||
}
|
||||
|
||||
private void invalidateJars() {
|
||||
File dir = projectMappedJar.getParentFile();
|
||||
|
||||
if (dir.exists()) {
|
||||
getProject().getLogger().warn("Invalidating project jars");
|
||||
private void invalidateJar() {
|
||||
if (projectMappedJar.exists()) {
|
||||
getProject().getLogger().warn("Invalidating project jar");
|
||||
|
||||
try {
|
||||
FileUtils.cleanDirectory(dir);
|
||||
FileUtils.forceDelete(projectMappedJar);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to invalidate jars, try stopping gradle daemon or closing the game", e);
|
||||
throw new RuntimeException("Failed to invalidate jar, try stopping gradle daemon or closing the game", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user