Include api-versions.xml in repo

This commit is contained in:
Karlatemp 2021-02-26 18:32:44 +08:00
parent b7c0f40d7e
commit 7b7730601f
No known key found for this signature in database
GPG Key ID: 21FBDDF664FF06F8
2 changed files with 82287 additions and 14 deletions

View File

@ -210,20 +210,7 @@ object AndroidApiLevelCheck {
@Suppress("UNCHECKED_CAST")
fun check(classes: File, level: Int, project: Project) {
val apiVersionsFile = project.rootProject.buildDir.resolve("android-api-versions.xml")
if (!apiVersionsFile.isFile) {
apiVersionsFile.parentFile.mkdirs()
println("Downloading AndroidSDK/api-versions.xml")
val apiVersionsFileTmp = project.rootProject.buildDir.resolve("android-api-versions.xml.tmp")
URL("https://github.com/aosp-mirror/platform_development/raw/master/sdk/api-versions.xml")
.openStream().use { upstream ->
apiVersionsFileTmp.outputStream().use { upstream.copyTo(it) }
}
if (!apiVersionsFileTmp.renameTo(apiVersionsFile)) {
apiVersionsFileTmp.copyTo(apiVersionsFile, overwrite = true)
apiVersionsFileTmp.delete()
}
}
val apiVersionsFile = project.rootProject.projectDir.resolve("buildSrc/src/main/resources/androidutil/api-versions.xml")
val classesInfos = mutableMapOf<String, ClassInfo>()
XmlParser().parse(apiVersionsFile).children().forEach { classNode ->
classNode as Node

File diff suppressed because it is too large Load Diff