mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Handle fabric.mod.json file being empty (#1280)
* Throw a nicer error when the fabric.mod.json file is empty * Don't fail just log.
This commit is contained in:
@@ -116,7 +116,15 @@ 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(project, sourceSets));
|
||||
final JsonObject modJson = LoomGradlePlugin.GSON.fromJson(reader, JsonObject.class);
|
||||
|
||||
if (modJson == null) {
|
||||
// fromJson returns null if the file is empty
|
||||
LOGGER.warn("Failed to parse empty fabric.mod.json: {}", file.getAbsolutePath());
|
||||
return null;
|
||||
}
|
||||
|
||||
return create(modJson, new FabricModJsonSource.SourceSetSource(project, sourceSets));
|
||||
} catch (JsonSyntaxException e) {
|
||||
LOGGER.warn("Failed to parse fabric.mod.json: {}", file.getAbsolutePath());
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user