mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-09-01 06:28:11 +00:00
Pretty print the json files
This commit is contained in:
parent
a215294c68
commit
1b3c898415
@ -1,3 +1,5 @@
|
|||||||
|
import groovy.json.JsonOutput
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
application
|
application
|
||||||
@ -155,7 +157,8 @@ val compileJsonSchemas by tasks.registering(JavaCompile::class) {
|
|||||||
source = sourceSets.main.get().java
|
source = sourceSets.main.get().java
|
||||||
include("org/asamk/signal/json/**/*.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/JsonSyncDataMessage.java")
|
||||||
exclude("org/asamk/signal/json/JsonSyncStoryMessage.java")
|
exclude("org/asamk/signal/json/JsonSyncStoryMessage.java")
|
||||||
exclude("org/asamk/signal/json/JsonSyncMessage.java")
|
exclude("org/asamk/signal/json/JsonSyncMessage.java")
|
||||||
@ -174,12 +177,18 @@ val compileJsonSchemas by tasks.registering(JavaCompile::class) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
// Copy manual schemas for classes with @JsonUnwrapped
|
|
||||||
copy {
|
copy {
|
||||||
from("src/main/resources/META-INF/schemas")
|
from("src/main/resources/META-INF/schemas")
|
||||||
into(destinationDirectory.get().dir("META-INF/schemas"))
|
into(destinationDirectory.get().dir("META-INF/schemas"))
|
||||||
include("*.schema.json")
|
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")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user