Pretty print the json files

This commit is contained in:
Era Dorta 2026-03-07 00:10:43 +01:00
parent a215294c68
commit 1b3c898415

View File

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