mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-30 21:05:58 -05:00
Don't fail setup if a project FMJ is invalid.
This commit is contained in:
@@ -36,9 +36,12 @@ import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.VisibleForTesting;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import net.fabricmc.loom.LoomGradlePlugin;
|
||||
import net.fabricmc.loom.util.FileSystemUtil;
|
||||
@@ -48,6 +51,8 @@ import net.fabricmc.loom.util.gradle.SourceSetHelper;
|
||||
public final class FabricModJsonFactory {
|
||||
public static final String FABRIC_MOD_JSON = "fabric.mod.json";
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FabricModJsonFactory.class);
|
||||
|
||||
private FabricModJsonFactory() {
|
||||
}
|
||||
|
||||
@@ -115,6 +120,11 @@ public final class FabricModJsonFactory {
|
||||
|
||||
try (Reader reader = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) {
|
||||
return create(LoomGradlePlugin.GSON.fromJson(reader, JsonObject.class), new FabricModJsonSource.SourceSetSource(sourceSets));
|
||||
} catch (JsonSyntaxException e) {
|
||||
LOGGER.warn("Failed to parse fabric.mod.json: {}", file.getAbsolutePath());
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException("Failed to read " + file.getAbsolutePath(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class DataGenerationTest extends Specification implements GradleProjectTestTrait
|
||||
|
||||
modDatagenImplementation fabricApi.module("fabric-data-generation-api-v1", "0.90.0+1.20.2")
|
||||
}
|
||||
|
||||
|
||||
println("%%" + loom.runs.datagen.configName + "%%")
|
||||
'''
|
||||
when:
|
||||
|
||||
Reference in New Issue
Block a user