Karlatemp 2021-04-08 22:22:17 +08:00 committed by GitHub
parent e20313636a
commit 0f54e2aa27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,6 +71,7 @@ object PostKotlinCompile {
}
fun registerForAll(rootProject: Project) {
val checkEnabled = rootProject.hasProperty("mirai.pkc.check.enable")
val validator = rootProject.file("binary-compatibility-validator/kt-compile-edit")
rootProject.subprojects {
val subp: Project = this@subprojects
@ -92,9 +93,11 @@ object PostKotlinCompile {
val diff = DiffUtils.generateUnifiedDiff(logFile.name, logFile.name + ".rebuild", oldLog, patch, 3)
logFile.parentFile.mkdirs()
if (checkEnabled || newLog.isNotEmpty()) { // Kotlin classes not recompiled.
logFile.writeText(newLog.joinToString("\n", postfix = "\n"))
}
val diffMsg = diff.joinToString("\n")
if (rootProject.hasProperty("mirai.pkc.check.enable")) {
if (checkEnabled) {
error(diffMsg)
} else {
println(diffMsg)