From e75888a6e9bd2bdd8a23cd458c59bf7ddbe3bdf3 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 9 May 2020 15:37:02 +0800 Subject: [PATCH] Add binary-validator --- build.gradle.kts | 5 +++++ buildSrc/src/main/kotlin/Versions.kt | 1 + gradle/api-validation.gradle | 13 +++++++++++++ .../qqandroid/network/protocol/data/proto/MsgSvc.kt | 7 ++++--- .../network/protocol/data/proto/msgType0x210.kt | 6 ++++-- 5 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 gradle/api-validation.gradle diff --git a/build.gradle.kts b/build.gradle.kts index e68c513ce..322996654 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,6 +18,7 @@ buildscript { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.Kotlin.stdlib}") classpath("org.jetbrains.kotlin:kotlin-serialization:${Versions.Kotlin.stdlib}") classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${Versions.Kotlin.atomicFU}") + classpath("org.jetbrains.kotlinx:binary-compatibility-validator:${Versions.Kotlin.binaryValidator}") } } @@ -26,6 +27,10 @@ plugins { // id("com.jfrog.bintray") version Versions.Publishing.bintray apply false } +// https://github.com/kotlin/binary-compatibility-validator +apply(plugin = "binary-compatibility-validator") + + project.ext.set("isAndroidSDKAvailable", false) // until diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 53cf6548b..a2a8e023d 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -18,6 +18,7 @@ object Versions { const val atomicFU = "0.14.2" const val serialization = "0.20.0" const val ktor = "1.3.2" + const val binaryValidator = "0.2.3" const val io = "0.1.16" const val coroutinesIo = "0.1.16" diff --git a/gradle/api-validation.gradle b/gradle/api-validation.gradle new file mode 100644 index 000000000..c18c40cdc --- /dev/null +++ b/gradle/api-validation.gradle @@ -0,0 +1,13 @@ +apiValidation { + ignoredPackages += [ + "net.mamoe.mirai.event.internal", + "net.mamoe.mirai.utils.internal" + ] + + ignoredPackages += [ + "net.mamoe.mirai.qqandroid.contact", + "net.mamoe.mirai.qqandroid.message", + "net.mamoe.mirai.qqandroid.network", + "net.mamoe.mirai.qqandroid.utils" + ] +} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.kt index 3fd42d44e..7f9da3362 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.kt @@ -504,8 +504,8 @@ internal class MsgSvc : ProtoBuf { @Serializable internal class SecretFileHead( - @ProtoId(1) @JvmField val secretFileMsg: SubMsgType0xc1.MsgBody? = null, - @ProtoId(2) @JvmField val secretFileStatus: SubMsgType0x1a.MsgBody? = null + @ProtoId(1) @JvmField val secretFileMsg: SubMsgType0xc1.MsgBody? = null + // @ProtoId(2) @JvmField val secretFileStatus: SubMsgType0x1a.MsgBody? = null ) @Serializable @@ -815,6 +815,7 @@ internal class SubMsgType0xc1 { ) : ProtoBuf } +/* @Serializable internal class SubMsgType0x1a { @Serializable @@ -830,4 +831,4 @@ internal class SubMsgType0x1a { @ProtoId(9) @JvmField val fromUin: Long = 0L, @ProtoId(10) @JvmField val toUin: Long = 0L ) : ProtoBuf -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt index d19d4f6f6..208cc38f4 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt @@ -515,6 +515,7 @@ internal class Submsgtype0x129 { } +/* internal class Submsgtype0x1a { internal class SubMsgType0x1a : ProtoBuf { @Serializable @@ -531,7 +532,7 @@ internal class Submsgtype0x1a { @ProtoId(10) @JvmField val toUin: Long = 0L ) : ProtoBuf } -} +}*/ internal class Submsgtype0x26 { @@ -2730,6 +2731,7 @@ internal class Submsgtype0xbe { } +/* internal class Submsgtype0xc1 { internal class Submsgtype0xc1 : ProtoBuf { @Serializable @@ -2740,7 +2742,7 @@ internal class Submsgtype0xc1 { ) : ProtoBuf } } - +*/ internal class Submsgtype0xc3 { internal class Submsgtype0xc3 : ProtoBuf {