Public API stabilization

This commit is contained in:
Him188 2020-08-01 22:12:52 +08:00
parent e53363482d
commit cc8ec67340
3 changed files with 31 additions and 25 deletions

View File

@ -33,7 +33,6 @@ kotlin {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=enable"
jvmTarget = "1.8"
// useIR = true
}
}
languageSettings.apply {

View File

@ -67,7 +67,7 @@ public suspend inline fun CommandSender.sendMessage(message: String): Unit = sen
public abstract class ConsoleCommandSender internal constructor() : CommandSender {
public final override val bot: Nothing? get() = null
public companion object {
internal companion object {
internal val instance get() = MiraiConsoleImplementationBridge.consoleCommandSender
}
}
@ -117,7 +117,9 @@ public sealed class UserCommandSender : CommandSender, BotAwareCommandSender {
* 代表一个用户私聊机器人执行指令
* @see Friend.asCommandSender
*/
public open class FriendCommandSender(final override val user: Friend) : UserCommandSender() {
public open class FriendCommandSender(
public final override val user: Friend
) : UserCommandSender() {
public override val subject: Contact get() = user
}
@ -125,7 +127,9 @@ public open class FriendCommandSender(final override val user: Friend) : UserCom
* 代表一个用户私聊机器人执行指令
* @see Friend.asCommandSender
*/
public class FriendCommandSenderOnMessage(override val fromEvent: FriendMessageEvent) :
public class FriendCommandSenderOnMessage(
public override val fromEvent: FriendMessageEvent
) :
FriendCommandSender(fromEvent.sender),
MessageEventContextAware<FriendMessageEvent>, MessageEventExtensions<User, Contact> by fromEvent {
public override val subject: Contact get() = super.subject
@ -136,7 +140,9 @@ public class FriendCommandSenderOnMessage(override val fromEvent: FriendMessageE
* 代表一个群成员执行指令.
* @see Member.asCommandSender
*/
public open class MemberCommandSender(final override val user: Member) : UserCommandSender() {
public open class MemberCommandSender(
public final override val user: Member
) : UserCommandSender() {
public inline val group: Group get() = user.group
public override val subject: Contact get() = group
}
@ -145,7 +151,9 @@ public open class MemberCommandSender(final override val user: Member) : UserCom
* 代表一个群成员在群内执行指令.
* @see Member.asCommandSender
*/
public class MemberCommandSenderOnMessage(override val fromEvent: GroupMessageEvent) :
public class MemberCommandSenderOnMessage(
public override val fromEvent: GroupMessageEvent
) :
MemberCommandSender(fromEvent.sender),
MessageEventContextAware<GroupMessageEvent>, MessageEventExtensions<User, Contact> by fromEvent {
public override val subject: Contact get() = super.subject
@ -157,7 +165,9 @@ public class MemberCommandSenderOnMessage(override val fromEvent: GroupMessageEv
* @see Member.asCommandSender
*/
@ConsoleExperimentalAPI
public class TempCommandSenderOnMessage(override val fromEvent: TempMessageEvent) :
public class TempCommandSenderOnMessage(
public override val fromEvent: TempMessageEvent
) :
MemberCommandSender(fromEvent.sender),
MessageEventContextAware<TempMessageEvent>, MessageEventExtensions<User, Contact> by fromEvent {
public override val subject: Contact get() = super.subject

View File

@ -1,5 +1,3 @@
import org.gradle.kotlin.dsl.DependencyHandlerScope
/*
* Copyright 2020 Mamoe Technologies and contributors.
*
@ -10,22 +8,21 @@ import org.gradle.kotlin.dsl.DependencyHandlerScope
*/
object Versions {
object Mirai {
const val core = "1.0.0"
const val console = "0.5.2"
const val consoleGraphical = "0.0.7"
}
const val core = "1.1.3"
const val console = "1.0-M1"
const val consoleGraphical = "0.0.7"
const val consoleTerminal = "0.1.0"
const val consolePure = console
object Kotlin {
const val stdlib = "1.3.72"
const val coroutines = "1.3.5"
const val serialization = "0.20.0"
const val ktor = "1.3.2"
}
}
const val kotlinCompiler = "1.4.0-rc" // for public explict API
const val kotlinStdlib = "1.4.0-rc" // for not overriding dependant's stdlib dependency
@Suppress("unused")
fun DependencyHandlerScope.kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
const val coroutines = "1.3.8-1.4.0-rc"
const val collectionsImmutable = "0.3.2"
const val serialization = "1.0-M1-1.4.0-rc"
const val ktor = "1.3.2-1.4.0-rc"
@Suppress("unused")
fun DependencyHandlerScope.ktor(id: String, version: String = Versions.Kotlin.ktor) = "io.ktor:ktor-$id:$version"
const val androidGradle = "3.6.2"
const val bintray = "1.8.5"
}