Add module 'compatibility-validator'

This commit is contained in:
Him188 2020-03-22 14:25:15 +08:00
parent 53fdcd41f7
commit f95a11a248
3 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,39 @@
@file:Suppress("UNUSED_VARIABLE")
plugins {
kotlin("jvm")
java
}
description = "Binary and source compatibility validator for mirai-core and mirai-core-qqandroid"
val kotlinVersion: String by rootProject.ext
val coroutinesVersion: String by rootProject.ext
fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
kotlin {
sourceSets {
all {
languageSettings.enableLanguageFeature("InlineClasses")
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
}
main {
dependencies {
api(kotlin("stdlib"))
api(project(":mirai-core-qqandroid"))
api(kotlinx("coroutines-core", coroutinesVersion))
}
}
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@ -0,0 +1,20 @@
package compatibility;
import net.mamoe.mirai.Bot;
import net.mamoe.mirai.BotFactoryJvm;
/*
* Copyright 2020 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
*/
public class CompatibilityTest {
public static void main(String[] args) {
Bot bot = BotFactoryJvm.newBot(Long.parseLong(System.getenv("qq")), System.getenv("password"));
bot.getFriend(123).sendMessage("");
}
}

View File

@ -23,6 +23,7 @@ rootProject.name = 'mirai'
include(':mirai-core')
include(':mirai-core-qqandroid')
include(':compatibility-validator')
// include(':mirai-api-http')
enableFeaturePreview('GRADLE_METADATA')