io.appmetrica.gradle.aarcheck.module.ModuleNormalizer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aar-check Show documentation
Show all versions of aar-check Show documentation
Provides plugin for check aar
The newest version!
package io.appmetrica.gradle.aarcheck.module
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
object ModuleNormalizer {
fun normalize(module: String): String {
val json = JsonSlurper().parseText(module) as Map<*, *>
json.getMap("createdBy").getMap("gradle")["buildId"] = ""
json.getList("variants").forEach { variant ->
variant.getList("files").forEach { file ->
file["size"] = -1
file["sha512"] = ""
file["sha256"] = ""
file["sha1"] = ""
file["md5"] = ""
}
}
return JsonBuilder(json).toPrettyString() + "\n"
}
@Suppress("UNCHECKED_CAST")
private fun Map<*, *>.getMap(key: String): MutableMap =
this[key] as MutableMap
@Suppress("UNCHECKED_CAST")
private fun Map<*, *>.getList(key: String): List> =
this[key] as List>
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy