mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-30 18:50:10 +08:00
Update to Kotlin 1.4-M1
This commit is contained in:
parent
f2bd321838
commit
eb7afb6cff
@ -5,26 +5,22 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
maven(url = "https://mirrors.huaweicloud.com/repository/maven")
|
maven(url = "https://mirrors.huaweicloud.com/repository/maven")
|
||||||
|
maven(url = "https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
jcenter()
|
jcenter()
|
||||||
// mavenCentral()
|
|
||||||
google()
|
google()
|
||||||
// maven (url="https://dl.bintray.com/kotlin/kotlin-eap")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
val kotlinVersion: String by project
|
classpath("com.android.tools.build:gradle:${Versions.Android.androidGradlePlugin}")
|
||||||
val atomicFuVersion: String by project
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.Kotlin.stdlib}")
|
||||||
|
classpath("org.jetbrains.kotlin:kotlin-serialization:${Versions.Kotlin.stdlib}")
|
||||||
classpath("com.android.tools.build:gradle:3.5.3")
|
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${Versions.Kotlin.atomicFU}")
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
|
||||||
// classpath("com.github.jengelman.gradle.plugins:shadow:5.2.0")
|
|
||||||
classpath("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
|
|
||||||
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicFuVersion")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("org.jetbrains.dokka") version "0.10.1" apply false
|
id("org.jetbrains.dokka") version Versions.Kotlin.dokka apply false
|
||||||
|
id("com.jfrog.bintray") version Versions.Publishing.bintray apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
runCatching {
|
runCatching {
|
||||||
@ -43,11 +39,9 @@ allprojects {
|
|||||||
version = getProperty("miraiVersion")
|
version = getProperty("miraiVersion")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
|
||||||
maven(url = "https://mirrors.huaweicloud.com/repository/maven")
|
maven(url = "https://mirrors.huaweicloud.com/repository/maven")
|
||||||
|
maven(url = "https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
jcenter()
|
jcenter()
|
||||||
// mavenCentral()
|
|
||||||
google()
|
google()
|
||||||
// maven (url="https://dl.bintray.com/kotlin/kotlin-eap")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
7
buildSrc/build.gradle.kts
Normal file
7
buildSrc/build.gradle.kts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
42
buildSrc/src/main/kotlin/dependencies.kt
Normal file
42
buildSrc/src/main/kotlin/dependencies.kt
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
object Versions {
|
||||||
|
object Mirai {
|
||||||
|
const val version = "0.30.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
object Kotlin {
|
||||||
|
const val stdlib = "1.4-M1"
|
||||||
|
const val coroutines = "1.3.5-1.4-M1"
|
||||||
|
const val atomicFU = "0.14.2-1.4-M1"
|
||||||
|
const val serialization = "0.20.0-1.4-M1"
|
||||||
|
const val ktor = "1.3.2-1.4-M1"
|
||||||
|
|
||||||
|
const val io = "0.1.16"
|
||||||
|
const val coroutinesIo = "0.1.16"
|
||||||
|
const val dokka = "0.10.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
object Android {
|
||||||
|
const val androidGradlePlugin = "3.5.3"
|
||||||
|
}
|
||||||
|
|
||||||
|
object Publishing {
|
||||||
|
const val bintray = "1.8.4-jetbrains-3"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
|
@ -7,11 +7,6 @@ plugins {
|
|||||||
|
|
||||||
description = "Binary and source compatibility validator for mirai-core and mirai-core-qqandroid"
|
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 {
|
kotlin {
|
||||||
sourceSets {
|
sourceSets {
|
||||||
all {
|
all {
|
||||||
@ -23,7 +18,7 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api(kotlin("stdlib"))
|
api(kotlin("stdlib"))
|
||||||
api(project(":mirai-core-qqandroid"))
|
api(project(":mirai-core-qqandroid"))
|
||||||
api(kotlinx("coroutines-core", coroutinesVersion))
|
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,5 @@
|
|||||||
# style guide
|
# style guide
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
# config
|
# config
|
||||||
miraiVersion=0.29.1
|
|
||||||
kotlin.incremental.multiplatform=true
|
kotlin.incremental.multiplatform=true
|
||||||
kotlin.parallel.tasks.in.project=true
|
kotlin.parallel.tasks.in.project=true
|
||||||
# kotlin
|
|
||||||
kotlinVersion=1.3.70
|
|
||||||
# kotlin libraries
|
|
||||||
serializationVersion=0.20.0
|
|
||||||
coroutinesVersion=1.3.4
|
|
||||||
atomicFuVersion=0.14.1
|
|
||||||
kotlinXIoVersion=0.1.16
|
|
||||||
coroutinesIoVersion=0.1.16
|
|
||||||
# utility
|
|
||||||
ktorVersion=1.3.2
|
|
@ -3,34 +3,15 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("multiplatform")
|
kotlin("multiplatform")
|
||||||
id("kotlinx-atomicfu")
|
id("kotlinx-atomicfu")
|
||||||
id("kotlinx-serialization")
|
kotlin("plugin.serialization")
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
id("com.jfrog.bintray") version "1.8.4-jetbrains-3"
|
id("com.jfrog.bintray")
|
||||||
}
|
}
|
||||||
|
|
||||||
val kotlinVersion: String by rootProject.ext
|
|
||||||
val atomicFuVersion: String by rootProject.ext
|
|
||||||
val coroutinesVersion: String by rootProject.ext
|
|
||||||
val kotlinXIoVersion: String by rootProject.ext
|
|
||||||
val coroutinesIoVersion: String by rootProject.ext
|
|
||||||
|
|
||||||
|
|
||||||
val ktorVersion: String by rootProject.ext
|
|
||||||
|
|
||||||
val serializationVersion: String by rootProject.ext
|
|
||||||
|
|
||||||
fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
|
|
||||||
|
|
||||||
fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
|
|
||||||
|
|
||||||
|
|
||||||
description = "QQ protocol library"
|
description = "QQ protocol library"
|
||||||
|
|
||||||
val isAndroidSDKAvailable: Boolean by project
|
val isAndroidSDKAvailable: Boolean by project
|
||||||
|
|
||||||
val miraiVersion: String by project
|
|
||||||
version = miraiVersion
|
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
if (isAndroidSDKAvailable) {
|
if (isAndroidSDKAvailable) {
|
||||||
apply(from = rootProject.file("gradle/android.gradle"))
|
apply(from = rootProject.file("gradle/android.gradle"))
|
||||||
@ -58,30 +39,29 @@ kotlin {
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
all {
|
all {
|
||||||
languageSettings.enableLanguageFeature("InlineClasses")
|
languageSettings.enableLanguageFeature("InlineClasses")
|
||||||
|
|
||||||
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
|
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":mirai-core"))
|
api(project(":mirai-core"))
|
||||||
|
|
||||||
api(kotlin("stdlib", kotlinVersion))
|
|
||||||
|
|
||||||
api("org.jetbrains.kotlinx:atomicfu:$atomicFuVersion")
|
|
||||||
api(kotlinx("io", kotlinXIoVersion))
|
|
||||||
api(kotlinx("coroutines-io", coroutinesIoVersion))
|
|
||||||
api(kotlinx("coroutines-core", coroutinesVersion))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(kotlinx("serialization-runtime-common", serializationVersion))
|
api(kotlin("stdlib", Versions.Kotlin.stdlib))
|
||||||
api(kotlinx("serialization-protobuf-common", serializationVersion))
|
api(kotlinx("serialization-runtime-common", Versions.Kotlin.serialization))
|
||||||
|
api(kotlinx("serialization-protobuf-common", Versions.Kotlin.serialization))
|
||||||
|
api("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}")
|
||||||
|
api(kotlinx("io", Versions.Kotlin.io))
|
||||||
|
api(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo))
|
||||||
|
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commonTest {
|
commonTest {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(kotlin("test-annotations-common"))
|
implementation(kotlin("test-annotations-common"))
|
||||||
api(kotlin("test-common"))
|
implementation(kotlin("test-common"))
|
||||||
implementation(kotlin("script-runtime"))
|
implementation(kotlin("script-runtime"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,14 +69,14 @@ kotlin {
|
|||||||
if (isAndroidSDKAvailable) {
|
if (isAndroidSDKAvailable) {
|
||||||
val androidMain by getting {
|
val androidMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(kotlinx("serialization-protobuf", serializationVersion))
|
api(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val androidTest by getting {
|
val androidTest by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test", kotlinVersion))
|
implementation(kotlin("test", Versions.Kotlin.stdlib))
|
||||||
implementation(kotlin("test-junit", kotlinVersion))
|
implementation(kotlin("test-junit", Versions.Kotlin.stdlib))
|
||||||
implementation(kotlin("test-annotations-common"))
|
implementation(kotlin("test-annotations-common"))
|
||||||
implementation(kotlin("test-common"))
|
implementation(kotlin("test-common"))
|
||||||
}
|
}
|
||||||
@ -106,16 +86,16 @@ kotlin {
|
|||||||
val jvmMain by getting {
|
val jvmMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
|
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
|
||||||
api(kotlinx("serialization-runtime", serializationVersion))
|
api(kotlinx("serialization-runtime", Versions.Kotlin.serialization))
|
||||||
//api(kotlinx("serialization-protobuf", serializationVersion))
|
//api(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val jvmTest by getting {
|
val jvmTest by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(kotlin("test", kotlinVersion))
|
implementation(kotlin("test", Versions.Kotlin.stdlib))
|
||||||
api(kotlin("test-junit", kotlinVersion))
|
implementation(kotlin("test-junit", Versions.Kotlin.stdlib))
|
||||||
implementation("org.pcap4j:pcap4j-distribution:1.8.2")
|
implementation("org.pcap4j:pcap4j-distribution:1.8.2")
|
||||||
|
|
||||||
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
|
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
|
||||||
@ -124,9 +104,5 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
//tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
|
||||||
// kotlinOptions.jvmTarget = "1.8"
|
|
||||||
//}
|
|
||||||
|
|
||||||
apply(from = rootProject.file("gradle/publish.gradle"))
|
apply(from = rootProject.file("gradle/publish.gradle"))
|
||||||
|
@ -3,35 +3,16 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("multiplatform")
|
kotlin("multiplatform")
|
||||||
id("kotlinx-atomicfu")
|
id("kotlinx-atomicfu")
|
||||||
id("kotlinx-serialization")
|
kotlin("plugin.serialization")
|
||||||
id("org.jetbrains.dokka")
|
id("org.jetbrains.dokka")
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
id("com.jfrog.bintray") version "1.8.4-jetbrains-3"
|
id("com.jfrog.bintray")
|
||||||
}
|
}
|
||||||
|
|
||||||
val kotlinVersion: String by rootProject.ext
|
|
||||||
val atomicFuVersion: String by rootProject.ext
|
|
||||||
val coroutinesVersion: String by rootProject.ext
|
|
||||||
val kotlinXIoVersion: String by rootProject.ext
|
|
||||||
val coroutinesIoVersion: String by rootProject.ext
|
|
||||||
|
|
||||||
|
|
||||||
val ktorVersion: String by rootProject.ext
|
|
||||||
|
|
||||||
val serializationVersion: String by rootProject.ext
|
|
||||||
|
|
||||||
fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
|
|
||||||
|
|
||||||
fun ktor(id: String, version: String) = "io.ktor:ktor-$id:$version"
|
|
||||||
|
|
||||||
|
|
||||||
description = "QQ protocol library"
|
description = "QQ protocol library"
|
||||||
|
|
||||||
val isAndroidSDKAvailable: Boolean by project
|
val isAndroidSDKAvailable: Boolean by project
|
||||||
|
|
||||||
val miraiVersion: String by project
|
|
||||||
version = miraiVersion
|
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
if (isAndroidSDKAvailable) {
|
if (isAndroidSDKAvailable) {
|
||||||
apply(from = rootProject.file("gradle/android.gradle"))
|
apply(from = rootProject.file("gradle/android.gradle"))
|
||||||
@ -63,22 +44,22 @@ kotlin {
|
|||||||
|
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(kotlin("stdlib", kotlinVersion))
|
api(kotlin("stdlib"))
|
||||||
api(kotlin("serialization", kotlinVersion))
|
api(kotlin("serialization"))
|
||||||
api(kotlin("reflect", kotlinVersion))
|
api(kotlin("reflect"))
|
||||||
|
|
||||||
api(kotlinx("coroutines-core-common", coroutinesVersion))
|
api(kotlinx("coroutines-core-common", Versions.Kotlin.coroutines))
|
||||||
api(kotlinx("serialization-runtime-common", serializationVersion))
|
api(kotlinx("serialization-runtime-common", Versions.Kotlin.serialization))
|
||||||
api(kotlinx("serialization-protobuf-common", serializationVersion))
|
api(kotlinx("serialization-protobuf-common", Versions.Kotlin.serialization))
|
||||||
api(kotlinx("io", kotlinXIoVersion))
|
api(kotlinx("io", Versions.Kotlin.io))
|
||||||
api(kotlinx("coroutines-io", coroutinesIoVersion))
|
api(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo))
|
||||||
api(kotlinx("coroutines-core", coroutinesVersion))
|
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
||||||
|
|
||||||
api("org.jetbrains.kotlinx:atomicfu-common:$atomicFuVersion")
|
api("org.jetbrains.kotlinx:atomicfu-common:${Versions.Kotlin.atomicFU}")
|
||||||
|
|
||||||
api(ktor("client-cio", ktorVersion))
|
api(ktor("client-cio", Versions.Kotlin.ktor))
|
||||||
api(ktor("client-core", ktorVersion))
|
api(ktor("client-core", Versions.Kotlin.ktor))
|
||||||
api(ktor("network", ktorVersion))
|
api(ktor("network", Versions.Kotlin.ktor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
commonTest {
|
commonTest {
|
||||||
@ -91,22 +72,22 @@ kotlin {
|
|||||||
if (isAndroidSDKAvailable) {
|
if (isAndroidSDKAvailable) {
|
||||||
val androidMain by getting {
|
val androidMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(kotlin("reflect", kotlinVersion))
|
api(kotlin("reflect"))
|
||||||
|
|
||||||
api(kotlinx("io-jvm", kotlinXIoVersion))
|
api(kotlinx("io-jvm", Versions.Kotlin.io))
|
||||||
api(kotlinx("serialization-runtime", serializationVersion))
|
api(kotlinx("serialization-runtime", Versions.Kotlin.serialization))
|
||||||
api(kotlinx("serialization-protobuf", serializationVersion))
|
api(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
|
||||||
api(kotlinx("coroutines-android", coroutinesVersion))
|
api(kotlinx("coroutines-android", Versions.Kotlin.coroutines))
|
||||||
api(kotlinx("coroutines-io-jvm", coroutinesIoVersion))
|
api(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo))
|
||||||
|
|
||||||
api(ktor("client-android", ktorVersion))
|
api(ktor("client-android", Versions.Kotlin.ktor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val androidTest by getting {
|
val androidTest by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test", kotlinVersion))
|
implementation(kotlin("test"))
|
||||||
implementation(kotlin("test-junit", kotlinVersion))
|
implementation(kotlin("test-junit"))
|
||||||
implementation(kotlin("test-annotations-common"))
|
implementation(kotlin("test-annotations-common"))
|
||||||
implementation(kotlin("test-common"))
|
implementation(kotlin("test-common"))
|
||||||
}
|
}
|
||||||
@ -115,16 +96,16 @@ kotlin {
|
|||||||
|
|
||||||
val jvmMain by getting {
|
val jvmMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
//api(kotlin("stdlib-jdk8", kotlinVersion))
|
//api(kotlin("stdlib-jdk8"))
|
||||||
//api(kotlin("stdlib-jdk7", kotlinVersion))
|
//api(kotlin("stdlib-jdk7"))
|
||||||
api(kotlin("reflect", kotlinVersion))
|
api(kotlin("reflect"))
|
||||||
|
|
||||||
api(ktor("client-core-jvm", ktorVersion))
|
api(ktor("client-core-jvm", Versions.Kotlin.ktor))
|
||||||
api(kotlinx("io-jvm", kotlinXIoVersion))
|
api(kotlinx("io-jvm", Versions.Kotlin.io))
|
||||||
api(kotlinx("serialization-runtime", serializationVersion))
|
api(kotlinx("serialization-runtime", Versions.Kotlin.serialization))
|
||||||
api(kotlinx("serialization-protobuf", serializationVersion))
|
api(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
|
||||||
api(kotlinx("coroutines-io-jvm", coroutinesIoVersion))
|
api(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo))
|
||||||
api(kotlinx("coroutines-core", coroutinesVersion))
|
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
||||||
|
|
||||||
api("org.bouncycastle:bcprov-jdk15on:1.64")
|
api("org.bouncycastle:bcprov-jdk15on:1.64")
|
||||||
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
|
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
|
||||||
@ -133,8 +114,8 @@ kotlin {
|
|||||||
|
|
||||||
val jvmTest by getting {
|
val jvmTest by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test", kotlinVersion))
|
implementation(kotlin("test"))
|
||||||
implementation(kotlin("test-junit", kotlinVersion))
|
implementation(kotlin("test-junit"))
|
||||||
implementation("org.pcap4j:pcap4j-distribution:1.8.2")
|
implementation("org.pcap4j:pcap4j-distribution:1.8.2")
|
||||||
|
|
||||||
runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE
|
runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE
|
||||||
@ -142,10 +123,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
//tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
|
||||||
// kotlinOptions.jvmTarget = "1.8"
|
|
||||||
//}
|
|
||||||
tasks {
|
tasks {
|
||||||
val dokka by getting(org.jetbrains.dokka.gradle.DokkaTask::class) {
|
val dokka by getting(org.jetbrains.dokka.gradle.DokkaTask::class) {
|
||||||
outputFormat = "html"
|
outputFormat = "html"
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package net.mamoe.mirai.event.internal
|
package net.mamoe.mirai.event.internal
|
||||||
|
|
||||||
|
import net.mamoe.mirai.event.Event
|
||||||
|
import net.mamoe.mirai.event.Listener
|
||||||
|
import net.mamoe.mirai.utils.LockFreeLinkedList
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
internal actual class MiraiAtomicBoolean actual constructor(initial: Boolean) {
|
internal actual class MiraiAtomicBoolean actual constructor(initial: Boolean) {
|
||||||
private val delegate: AtomicBoolean = AtomicBoolean(initial)
|
private val delegate: AtomicBoolean = AtomicBoolean(initial)
|
||||||
@ -15,3 +19,24 @@ internal actual class MiraiAtomicBoolean actual constructor(initial: Boolean) {
|
|||||||
delegate.set(value)
|
delegate.set(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal actual class EventListeners<E : Event> actual constructor(clazz: KClass<E>) :
|
||||||
|
LockFreeLinkedList<Listener<E>>() {
|
||||||
|
@Suppress("UNCHECKED_CAST", "UNSUPPORTED", "NO_REFLECTION_IN_CLASS_PATH")
|
||||||
|
actual val supertypes: Set<KClass<out Event>> by lazy {
|
||||||
|
val supertypes = mutableSetOf<KClass<out Event>>()
|
||||||
|
|
||||||
|
fun addSupertypes(clazz: KClass<out Event>) {
|
||||||
|
clazz.supertypes.forEach {
|
||||||
|
val classifier = it.classifier as? KClass<out Event>
|
||||||
|
if (classifier != null) {
|
||||||
|
supertypes.add(classifier)
|
||||||
|
addSupertypes(classifier)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addSupertypes(clazz)
|
||||||
|
|
||||||
|
supertypes
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,10 @@
|
|||||||
package net.mamoe.mirai.event.internal
|
package net.mamoe.mirai.event.internal
|
||||||
|
|
||||||
|
import net.mamoe.mirai.event.Event
|
||||||
|
import net.mamoe.mirai.event.Listener
|
||||||
|
import net.mamoe.mirai.utils.LockFreeLinkedList
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
|
|
||||||
internal actual class MiraiAtomicBoolean actual constructor(initial: Boolean) {
|
internal actual class MiraiAtomicBoolean actual constructor(initial: Boolean) {
|
||||||
@ -16,3 +20,24 @@ internal actual class MiraiAtomicBoolean actual constructor(initial: Boolean) {
|
|||||||
delegate.set(value)
|
delegate.set(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal actual class EventListeners<E : Event> actual constructor(clazz: KClass<E>) :
|
||||||
|
LockFreeLinkedList<Listener<E>>() {
|
||||||
|
@Suppress("UNCHECKED_CAST", "UNSUPPORTED", "NO_REFLECTION_IN_CLASS_PATH")
|
||||||
|
actual val supertypes: Set<KClass<out Event>> by lazy {
|
||||||
|
val supertypes = mutableSetOf<KClass<out Event>>()
|
||||||
|
|
||||||
|
fun addSupertypes(clazz: KClass<out Event>) {
|
||||||
|
clazz.supertypes.forEach {
|
||||||
|
val classifier = it.classifier as? KClass<out Event>
|
||||||
|
if (classifier != null) {
|
||||||
|
supertypes.add(classifier)
|
||||||
|
addSupertypes(classifier)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addSupertypes(clazz)
|
||||||
|
|
||||||
|
supertypes
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user