Be non verbose by default

With so many chains now - sometimes seeing an error in CI takes scrolling. So not be so verbose by default
This commit is contained in:
ligi 2022-11-04 02:20:36 +01:00
parent 5783b49464
commit b2bc4c4635

View File

@ -27,7 +27,11 @@ private val allIconFiles = allIconFilesList.filter { !it.isDirectory }
fun main(args: Array<String>) { fun main(args: Array<String>) {
doChecks(doRPCConnect = args.contains("rpcConnect"), doIconDownload = args.contains("iconDownload")) doChecks(
doRPCConnect = args.contains("rpcConnect"),
doIconDownload = args.contains("iconDownload"),
verbose = args.contains("verbose")
)
createOutputFiles() createOutputFiles()
} }
@ -109,15 +113,15 @@ private fun createOutputFiles() {
File(buildPath, "CNAME").writeText("chainid.network") File(buildPath, "CNAME").writeText("chainid.network")
} }
private fun doChecks(doRPCConnect: Boolean, doIconDownload: Boolean) { private fun doChecks(doRPCConnect: Boolean, doIconDownload: Boolean, verbose: Boolean) {
allChainFiles.forEach { allChainFiles.forEach {
checkChain(it, doRPCConnect) checkChain(it, doRPCConnect, verbose)
} }
val allIcons = iconsPath.listFiles() ?: return val allIcons = iconsPath.listFiles() ?: return
val allIconCIDs = mutableSetOf<String>() val allIconCIDs = mutableSetOf<String>()
allIcons.forEach { allIcons.forEach {
checkIcon(it, doIconDownload, allIconCIDs) checkIcon(it, doIconDownload, allIconCIDs, verbose)
} }
iconsDownloadPath.listFiles().forEach { iconsDownloadPath.listFiles().forEach {
@ -129,10 +133,12 @@ private fun doChecks(doRPCConnect: Boolean, doIconDownload: Boolean) {
} }
} }
fun checkIcon(icon: File, withIconDownload: Boolean, allIconCIDs: MutableSet<String>) { fun checkIcon(icon: File, withIconDownload: Boolean, allIconCIDs: MutableSet<String>, verbose: Boolean) {
println("checking Icon " + icon.name)
val obj: JsonArray<*> = Klaxon().parseJsonArray(icon.reader()) val obj: JsonArray<*> = Klaxon().parseJsonArray(icon.reader())
if (verbose) {
println("checking Icon " + icon.name)
println("found variants " + obj.size) println("found variants " + obj.size)
}
obj.forEach { it -> obj.forEach { it ->
if (it !is JsonObject) { if (it !is JsonObject) {
error("Icon variant must be an object") error("Icon variant must be an object")
@ -187,8 +193,10 @@ fun checkIcon(icon: File, withIconDownload: Boolean, allIconCIDs: MutableSet<Str
} }
} }
fun checkChain(chainFile: File, connectRPC: Boolean) { fun checkChain(chainFile: File, connectRPC: Boolean, verbose: Boolean = false) {
if (verbose) {
println("processing $chainFile") println("processing $chainFile")
}
val jsonObject = Klaxon().parseJsonObject(chainFile.reader()) val jsonObject = Klaxon().parseJsonObject(chainFile.reader())
val chainAsLong = getNumber(jsonObject, "chainId") val chainAsLong = getNumber(jsonObject, "chainId")