Add binary compatibility validator

This commit is contained in:
Him188 2021-01-21 14:16:03 +08:00
parent 0a23efa113
commit f1c6677af9
5 changed files with 58 additions and 5 deletions

View File

@ -0,0 +1,36 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@file:Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("kotlinx-atomicfu")
id("net.mamoe.kotlin-jvm-blocking-bridge")
}
description = "Mirai API binary compatibility validator"
tasks.withType(kotlinx.validation.KotlinApiBuildTask::class) {
inputClassesDirs = files(inputClassesDirs.files, project(":mirai-core-api").buildDir)
}
// tasks["apiDump"].dependsOn(project(":mirai-core-api").tasks["build"])
// this dependency is set in mirai-core-api since binary validator is configured before mirai-core-api

View File

@ -44,8 +44,19 @@ plugins {
}
// https://github.com/kotlin/binary-compatibility-validator
//apply(plugin = "binary-compatibility-validator")
apply(plugin = "binary-compatibility-validator")
configure<kotlinx.validation.ApiValidationExtension> {
ignoredProjects.add("mirai-core")
ignoredProjects.add("mirai-core-api")
ignoredProjects.add("mirai-core-utils")
ignoredProjects.add("mirai-core-all")
ignoredProjects.add("mirai")
ignoredPackages.add("net.mamoe.mirai.internal")
nonPublicMarkers.add("net.mamoe.mirai.MiraiInternalApi")
nonPublicMarkers.add("net.mamoe.mirai.MiraiExperimentalApi")
}
project.ext.set("isAndroidSDKAvailable", false)

View File

@ -23,7 +23,7 @@ object Versions {
const val serialization = "1.0.1"
const val ktor = "1.5.0"
const val binaryValidator = "0.2.3"
const val binaryValidator = "0.3.0"
const val io = "0.1.16"
const val coroutinesIo = "0.1.16"

View File

@ -111,4 +111,8 @@ fun org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler.api1(dependencyNo
exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-core-metadata")
}
configureMppPublishing()
configureMppPublishing()
afterEvaluate {
project(":binary-compatibility-validator").tasks["apiBuild"].dependsOn(project(":mirai-core-api").tasks["build"])
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 Mamoe Technologies and contributors.
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
@ -26,4 +26,6 @@ rootProject.name = "mirai"
include(":mirai-core-utils")
include(":mirai-core-api")
include(":mirai-core")
include(":mirai-core-all")
include(":mirai-core-all")
include(":binary-compatibility-validator")