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") + } } }