Skip to content

Commit

Permalink
Add compatibility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Him188 committed Apr 22, 2020
1 parent 4b05cb4 commit 15527b5
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
6 changes: 2 additions & 4 deletions compatibility-validator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ kotlin {
dependencies {
api(kotlin("stdlib"))
runtimeOnly(project(":mirai-core-qqandroid"))
compileOnly("net.mamoe:mirai-core-qqandroid-jvm:0.33.0")
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
compileOnly("net.mamoe:mirai-core-qqandroid:0.38.0")
}
}

Expand All @@ -34,8 +33,7 @@ kotlin {
api(kotlin("test"))
api(kotlin("test-junit"))
runtimeOnly(project(":mirai-core-qqandroid"))
compileOnly("net.mamoe:mirai-core-qqandroid-jvm:0.33.0")
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
compileOnly("net.mamoe:mirai-core-qqandroid:0.38.0")
}
}
}
Expand Down
47 changes: 47 additions & 0 deletions java-compatibility-validator/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@file:Suppress("UNUSED_VARIABLE")

plugins {
kotlin("jvm")
java
}

description = "Java compatibility validator for mirai-core and mirai-core-qqandroid"

repositories {
mavenCentral()
jcenter()
}

kotlin {
sourceSets {
all {
languageSettings.enableLanguageFeature("InlineClasses")
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
}

main {
dependencies {
api(kotlin("stdlib"))
api(project(":mirai-core-qqandroid"))
}
}

test {
dependencies {
api(kotlin("stdlib"))
api(kotlin("test"))
api(kotlin("test-junit"))
api(project(":mirai-core-qqandroid"))
}
}
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package test;

import net.mamoe.mirai.Bot;
import net.mamoe.mirai.contact.Contact;
import net.mamoe.mirai.contact.QQ;

/*
* 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 MPPCompatibilityTest {
public static void main(String[] args) {
final QQ next = Bot.getInstances().get(0).getFriends().iterator().next();
((Contact) next).sendMessage("");
}
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ rootProject.name = 'mirai'
include(':mirai-core')
include(':mirai-core-qqandroid')
//include(':compatibility-validator') // THIS WILL CAUSE A DEPENDENCY RESOLUTION BUG
//include(':java-compatibility-validator')

// include(':mirai-api-http')
enableFeaturePreview('GRADLE_METADATA')

0 comments on commit 15527b5

Please sign in to comment.