From 1b3c898415d79a8253d8d7d620f15e39ae76340f Mon Sep 17 00:00:00 2001 From: Era Dorta Date: Sat, 7 Mar 2026 00:10:43 +0100 Subject: [PATCH] Pretty print the json files --- build.gradle.kts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index fb27dfe4..5f5b7781 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import groovy.json.JsonOutput + plugins { java application @@ -155,7 +157,8 @@ val compileJsonSchemas by tasks.registering(JavaCompile::class) { source = sourceSets.main.get().java include("org/asamk/signal/json/**/*.java") - // Exclude files with @JsonUnwrapped and files that reference them + // Exclude files with @JsonUnwrapped and files that reference them as that breaks + // the annotation generator exclude("org/asamk/signal/json/JsonSyncDataMessage.java") exclude("org/asamk/signal/json/JsonSyncStoryMessage.java") exclude("org/asamk/signal/json/JsonSyncMessage.java") @@ -174,12 +177,18 @@ val compileJsonSchemas by tasks.registering(JavaCompile::class) { ) doLast { - // Copy manual schemas for classes with @JsonUnwrapped copy { from("src/main/resources/META-INF/schemas") into(destinationDirectory.get().dir("META-INF/schemas")) include("*.schema.json") } + + fileTree(destinationDirectory.get().dir("META-INF/schemas").asFile) { + include("*.schema.json") + }.forEach { schemaFile -> + val prettyJson = JsonOutput.prettyPrint(schemaFile.readText()) + schemaFile.writeText("$prettyJson\n") + } } }