mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-15 13:00:12 +08:00
Kotlin 1.5 and dependencies updates (#346)
* Kotlin 1.5 and dependencies updates * Make MessageScope sealed * Use Kotlin 1.5.10 * Uses 2.6.4-dev-kt15 in build
This commit is contained in:
parent
9a88998f95
commit
19abf48aac
@ -1,3 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
kotlin("plugin.serialization")
|
kotlin("plugin.serialization")
|
||||||
@ -21,4 +30,5 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api(kotlin("stdlib-jdk8"))
|
api(kotlin("stdlib-jdk8"))
|
||||||
implementation(kotlin("reflect"))
|
implementation(kotlin("reflect"))
|
||||||
|
api(`mirai-core-utils`)
|
||||||
}
|
}
|
@ -1,14 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.mamoe.mirai.console.codegen
|
package net.mamoe.mirai.console.codegen
|
||||||
|
|
||||||
|
import net.mamoe.mirai.utils.capitalize
|
||||||
|
|
||||||
internal val TypeCandidatesForMessageScope = arrayOf(
|
internal val TypeCandidatesForMessageScope = arrayOf(
|
||||||
KtType("Contact"),
|
KtType("Contact"),
|
||||||
KtType("CommandSender"),
|
KtType("CommandSender"),
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress("PRE_RELEASE_CLASS")
|
@file:Suppress("PRE_RELEASE_CLASS")
|
||||||
@ -21,7 +21,7 @@ open class JClazz(val primitiveName: String, val packageName: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class JListClazz(item: JClazz) : JClazz("List<${item.packageName}>", "List<${item.packageName}>") {
|
class JListClazz(item: JClazz) : JClazz("List<${item.packageName}>", "List<${item.packageName}>") {
|
||||||
override val funName = item.primitiveName.toLowerCase() + "List"
|
override val funName = item.primitiveName.lowercase() + "List"
|
||||||
}
|
}
|
||||||
|
|
||||||
class JArrayClazz(item: JClazz) : JClazz(item.primitiveName + "[]", item.primitiveName + "[]")
|
class JArrayClazz(item: JClazz) : JClazz(item.primitiveName + "[]", item.primitiveName + "[]")
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress("NOTHING_TO_INLINE", "MemberVisibilityCanBePrivate", "unused", "PRE_RELEASE_CLASS")
|
@file:Suppress("NOTHING_TO_INLINE", "MemberVisibilityCanBePrivate", "unused", "PRE_RELEASE_CLASS")
|
||||||
@ -44,7 +44,7 @@ sealed class KtType {
|
|||||||
*/
|
*/
|
||||||
sealed class KtPrimitive(
|
sealed class KtPrimitive(
|
||||||
override val standardName: String,
|
override val standardName: String,
|
||||||
val jPrimitiveName: String = standardName.toLowerCase(),
|
val jPrimitiveName: String = standardName.lowercase(),
|
||||||
val jObjectName: String = standardName
|
val jObjectName: String = standardName
|
||||||
) : KtType() {
|
) : KtType() {
|
||||||
object KtByte : KtPrimitive("Byte")
|
object KtByte : KtPrimitive("Byte")
|
||||||
@ -95,7 +95,7 @@ operator fun KtType.plus(type: KtType): List<KtType> {
|
|||||||
return listOf(this, type)
|
return listOf(this, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
val KtType.lowerCaseName: String get() = this.standardName.toLowerCase()
|
val KtType.lowerCaseName: String get() = this.standardName.lowercase()
|
||||||
|
|
||||||
inline fun kCode(@Language("kt") source: String) = source.trimIndent()
|
inline fun kCode(@Language("kt") source: String) = source.trimIndent()
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ internal interface BuiltInCommandInternal : Command, BuiltInCommand
|
|||||||
*
|
*
|
||||||
* [查看文档](https://github.com/mamoe/mirai-console/docs/BuiltInCommands.md)
|
* [查看文档](https://github.com/mamoe/mirai-console/docs/BuiltInCommands.md)
|
||||||
*/
|
*/
|
||||||
@Suppress("unused")
|
@Suppress("unused", "RESTRICTED_CONSOLE_COMMAND_OWNER")
|
||||||
public object BuiltInCommands {
|
public object BuiltInCommands {
|
||||||
@ConsoleExperimentalApi
|
@ConsoleExperimentalApi
|
||||||
public val parentPermission: Permission by lazy {
|
public val parentPermission: Permission by lazy {
|
||||||
@ -121,6 +121,7 @@ public object BuiltInCommands {
|
|||||||
|
|
||||||
private val closingLock = Mutex()
|
private val closingLock = Mutex()
|
||||||
|
|
||||||
|
@OptIn(DelicateCoroutinesApi::class)
|
||||||
@Handler
|
@Handler
|
||||||
public suspend fun CommandSender.handle() {
|
public suspend fun CommandSender.handle() {
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
|
@ -421,10 +421,10 @@ public class EnumValueArgumentParser<T : Enum<T>>(
|
|||||||
private val delegate: (String) -> T = kotlin.run {
|
private val delegate: (String) -> T = kotlin.run {
|
||||||
val enums = type.enumConstants.asSequence()
|
val enums = type.enumConstants.asSequence()
|
||||||
// step 1: 分析是否能够忽略大小写
|
// step 1: 分析是否能够忽略大小写
|
||||||
if (enums.map { it.name.toLowerCase() }.hasDuplicates()) {
|
if (enums.map { it.name.lowercase() }.hasDuplicates()) {
|
||||||
({ java.lang.Enum.valueOf(type, it) })
|
({ java.lang.Enum.valueOf(type, it) })
|
||||||
} else { // step 2: 分析是否能使用小驼峰命名
|
} else { // step 2: 分析是否能使用小驼峰命名
|
||||||
val lowerCaseEnumDirection = enums.map { it.name.toLowerCase() to it }.toList().toMap()
|
val lowerCaseEnumDirection = enums.map { it.name.lowercase() to it }.toList().toMap()
|
||||||
|
|
||||||
val camelCase = enums.mapNotNull { elm ->
|
val camelCase = enums.mapNotNull { elm ->
|
||||||
val name = elm.name.split('_')
|
val name = elm.name.split('_')
|
||||||
@ -433,18 +433,18 @@ public class EnumValueArgumentParser<T : Enum<T>>(
|
|||||||
} else {
|
} else {
|
||||||
buildString {
|
buildString {
|
||||||
val iterator = name.iterator()
|
val iterator = name.iterator()
|
||||||
append(iterator.next().toLowerCase())
|
append(iterator.next().lowercase())
|
||||||
for (v in iterator) {
|
for (v in iterator) {
|
||||||
if (v.isEmpty()) continue
|
if (v.isEmpty()) continue
|
||||||
append(v[0].toUpperCase())
|
append(v[0].uppercase())
|
||||||
append(v.substring(1, v.length).toLowerCase())
|
append(v.substring(1, v.length).lowercase())
|
||||||
}
|
}
|
||||||
} to elm
|
} to elm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val camelCaseDirection = if ((
|
val camelCaseDirection = if ((
|
||||||
enums.map { it.name.toLowerCase() } + camelCase.map { it.first.toLowerCase() }
|
enums.map { it.name.lowercase() } + camelCase.map { it.first.lowercase() }
|
||||||
).hasDuplicates()
|
).hasDuplicates()
|
||||||
) { // 确认驼峰命名与源没有冲突
|
) { // 确认驼峰命名与源没有冲突
|
||||||
emptyMap()
|
emptyMap()
|
||||||
@ -454,7 +454,7 @@ public class EnumValueArgumentParser<T : Enum<T>>(
|
|||||||
|
|
||||||
({
|
({
|
||||||
camelCaseDirection[it]
|
camelCaseDirection[it]
|
||||||
?: lowerCaseEnumDirection[it.toLowerCase()]
|
?: lowerCaseEnumDirection[it.lowercase()]
|
||||||
?: noConstant()
|
?: noConstant()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,9 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by MiraiCons
|
|||||||
*/
|
*/
|
||||||
override fun matchCommand(commandName: String): Command? {
|
override fun matchCommand(commandName: String): Command? {
|
||||||
if (commandName.startsWith(commandPrefix)) {
|
if (commandName.startsWith(commandPrefix)) {
|
||||||
return requiredPrefixCommandMap[commandName.substringAfter(commandPrefix).toLowerCase()]
|
return requiredPrefixCommandMap[commandName.substringAfter(commandPrefix).lowercase()]
|
||||||
}
|
}
|
||||||
return optionalPrefixCommandMap[commandName.toLowerCase()]
|
return optionalPrefixCommandMap[commandName.lowercase()]
|
||||||
}
|
}
|
||||||
///// IMPL
|
///// IMPL
|
||||||
|
|
||||||
@ -90,13 +90,13 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by MiraiCons
|
|||||||
_registeredCommands.add(command)
|
_registeredCommands.add(command)
|
||||||
if (command.prefixOptional) {
|
if (command.prefixOptional) {
|
||||||
for (name in command.allNames) {
|
for (name in command.allNames) {
|
||||||
val lowerCaseName = name.toLowerCase()
|
val lowerCaseName = name.lowercase()
|
||||||
optionalPrefixCommandMap[lowerCaseName] = command
|
optionalPrefixCommandMap[lowerCaseName] = command
|
||||||
requiredPrefixCommandMap[lowerCaseName] = command
|
requiredPrefixCommandMap[lowerCaseName] = command
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (name in command.allNames) {
|
for (name in command.allNames) {
|
||||||
val lowerCaseName = name.toLowerCase()
|
val lowerCaseName = name.lowercase()
|
||||||
optionalPrefixCommandMap.remove(lowerCaseName) // ensure resolution consistency
|
optionalPrefixCommandMap.remove(lowerCaseName) // ensure resolution consistency
|
||||||
requiredPrefixCommandMap[lowerCaseName] = command
|
requiredPrefixCommandMap[lowerCaseName] = command
|
||||||
}
|
}
|
||||||
@ -111,11 +111,11 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by MiraiCons
|
|||||||
override fun unregisterCommand(command: Command): Boolean = modifyLock.withLock {
|
override fun unregisterCommand(command: Command): Boolean = modifyLock.withLock {
|
||||||
if (command.prefixOptional) {
|
if (command.prefixOptional) {
|
||||||
command.allNames.forEach {
|
command.allNames.forEach {
|
||||||
optionalPrefixCommandMap.remove(it.toLowerCase())
|
optionalPrefixCommandMap.remove(it.lowercase())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
command.allNames.forEach {
|
command.allNames.forEach {
|
||||||
requiredPrefixCommandMap.remove(it.toLowerCase())
|
requiredPrefixCommandMap.remove(it.lowercase())
|
||||||
}
|
}
|
||||||
_registeredCommands.remove(command)
|
_registeredCommands.remove(command)
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress("unused")
|
@file:Suppress("unused")
|
||||||
@ -15,7 +15,7 @@ import net.mamoe.mirai.console.permission.AbstractPermitteeId
|
|||||||
import net.mamoe.mirai.console.permission.AbstractPermitteeId.*
|
import net.mamoe.mirai.console.permission.AbstractPermitteeId.*
|
||||||
|
|
||||||
internal fun parseFromStringImpl(string: String): AbstractPermitteeId {
|
internal fun parseFromStringImpl(string: String): AbstractPermitteeId {
|
||||||
val str = string.trim { it.isWhitespace() }.toLowerCase()
|
val str = string.trim { it.isWhitespace() }.lowercase()
|
||||||
if (str == "*") return AnyContact
|
if (str == "*") return AnyContact
|
||||||
if (str == "console") return Console
|
if (str == "console") return Console
|
||||||
if (str == "client*") return AnyOtherClient
|
if (str == "client*") return AnyOtherClient
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.mamoe.mirai.console.internal.util
|
package net.mamoe.mirai.console.internal.util
|
||||||
@ -44,7 +44,7 @@ internal fun ByteArray.toUHexString(
|
|||||||
return buildString(length * 2) {
|
return buildString(length * 2) {
|
||||||
this@toUHexString.forEachIndexed { index, it ->
|
this@toUHexString.forEachIndexed { index, it ->
|
||||||
if (index in offset until lastIndex) {
|
if (index in offset until lastIndex) {
|
||||||
var ret = it.toUByte().toString(16).toUpperCase()
|
var ret = it.toUByte().toString(16).uppercase()
|
||||||
if (ret.length == 1) ret = "0$ret"
|
if (ret.length == 1) ret = "0$ret"
|
||||||
append(ret)
|
append(ret)
|
||||||
if (index < lastIndex - 1) append(separator)
|
if (index < lastIndex - 1) append(separator)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress("NOTHING_TO_INLINE", "unused", "MemberVisibilityCanBePrivate")
|
@file:Suppress("NOTHING_TO_INLINE", "unused", "MemberVisibilityCanBePrivate")
|
||||||
@ -107,8 +107,8 @@ public interface PermissionService<P : Permission> {
|
|||||||
plugin: Plugin,
|
plugin: Plugin,
|
||||||
@ResolveContext(COMMAND_NAME) permissionName: String,
|
@ResolveContext(COMMAND_NAME) permissionName: String,
|
||||||
): PermissionId = PermissionId(
|
): PermissionId = PermissionId(
|
||||||
plugin.description.id.toLowerCase(),
|
plugin.description.id.lowercase(),
|
||||||
permissionName.toLowerCase()
|
permissionName.lowercase()
|
||||||
)
|
)
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.mamoe.mirai.console.plugin.description
|
package net.mamoe.mirai.console.plugin.description
|
||||||
@ -159,7 +159,7 @@ public interface PluginDescription {
|
|||||||
if (id.isBlank()) throw IllegalPluginDescriptionException("Plugin id cannot be blank")
|
if (id.isBlank()) throw IllegalPluginDescriptionException("Plugin id cannot be blank")
|
||||||
if (id.none { it == '.' }) throw IllegalPluginDescriptionException("'$id' is illegal. Plugin id must consist of both domain and name. ")
|
if (id.none { it == '.' }) throw IllegalPluginDescriptionException("'$id' is illegal. Plugin id must consist of both domain and name. ")
|
||||||
|
|
||||||
val lowercaseId = id.toLowerCase()
|
val lowercaseId = id.lowercase()
|
||||||
|
|
||||||
if (ID_REGEX.matchEntire(id) == null) {
|
if (ID_REGEX.matchEntire(id) == null) {
|
||||||
throw IllegalPluginDescriptionException("Plugin does not match regex '${ID_REGEX.pattern}'.")
|
throw IllegalPluginDescriptionException("Plugin does not match regex '${ID_REGEX.pattern}'.")
|
||||||
@ -178,7 +178,7 @@ public interface PluginDescription {
|
|||||||
@Throws(IllegalPluginDescriptionException::class)
|
@Throws(IllegalPluginDescriptionException::class)
|
||||||
public fun checkPluginName(name: String) {
|
public fun checkPluginName(name: String) {
|
||||||
if (name.isBlank()) throw IllegalPluginDescriptionException("Plugin name cannot be blank")
|
if (name.isBlank()) throw IllegalPluginDescriptionException("Plugin name cannot be blank")
|
||||||
val lowercaseName = name.toLowerCase()
|
val lowercaseName = name.lowercase()
|
||||||
FORBIDDEN_ID_NAMES.firstOrNull { it == lowercaseName }?.let { illegal ->
|
FORBIDDEN_ID_NAMES.firstOrNull { it == lowercaseName }?.let { illegal ->
|
||||||
throw IllegalPluginDescriptionException("Plugin name is illegal: '$illegal'.")
|
throw IllegalPluginDescriptionException("Plugin name is illegal: '$illegal'.")
|
||||||
}
|
}
|
||||||
@ -191,8 +191,8 @@ public interface PluginDescription {
|
|||||||
*/
|
*/
|
||||||
@Throws(IllegalPluginDescriptionException::class)
|
@Throws(IllegalPluginDescriptionException::class)
|
||||||
public fun checkDependencies(pluginId: String, dependencies: Set<PluginDependency>) {
|
public fun checkDependencies(pluginId: String, dependencies: Set<PluginDependency>) {
|
||||||
val lowercaseId = pluginId.toLowerCase()
|
val lowercaseId = pluginId.lowercase()
|
||||||
val lowercaseDependencies = dependencies.mapTo(LinkedHashSet(dependencies.size)) { it.id.toLowerCase() }
|
val lowercaseDependencies = dependencies.mapTo(LinkedHashSet(dependencies.size)) { it.id.lowercase() }
|
||||||
|
|
||||||
if (lowercaseDependencies.size != dependencies.size)
|
if (lowercaseDependencies.size != dependencies.size)
|
||||||
throw IllegalPluginDescriptionException("Duplicated dependency detected: A plugin cannot depend on different versions of dependencies of the same id")
|
throw IllegalPluginDescriptionException("Duplicated dependency detected: A plugin cannot depend on different versions of dependencies of the same id")
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress(
|
@file:Suppress(
|
||||||
@ -97,7 +97,7 @@ import kotlin.internal.LowPriorityInOverloadResolution
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
public interface MessageScope {
|
public sealed interface MessageScope {
|
||||||
/**
|
/**
|
||||||
* 如果此 [MessageScope] 仅包含一个消息对象, 则 [realTarget] 指向这个对象. 否则 [realTarget] 为 `null`.
|
* 如果此 [MessageScope] 仅包含一个消息对象, 则 [realTarget] 指向这个对象. 否则 [realTarget] 为 `null`.
|
||||||
*
|
*
|
||||||
|
@ -12,26 +12,26 @@
|
|||||||
import org.gradle.api.attributes.Attribute
|
import org.gradle.api.attributes.Attribute
|
||||||
|
|
||||||
object Versions {
|
object Versions {
|
||||||
const val core = "2.2.2" // WARNING: This might not be up-to-date since included in mirai build.
|
const val core = "2.6.4-dev-kt15" // WARNING: This might not be up-to-date since included in mirai build.
|
||||||
const val console = "2.2.2"
|
const val console = "2.6.4-dev-kt15"
|
||||||
const val consoleGraphical = "0.0.7"
|
const val consoleGraphical = "0.0.7"
|
||||||
const val consoleTerminal = console
|
const val consoleTerminal = console
|
||||||
|
|
||||||
const val kotlinCompiler = "1.4.21"
|
const val kotlinCompiler = "1.5.10"
|
||||||
const val kotlinStdlib = "1.4.21"
|
const val kotlinStdlib = "1.5.10"
|
||||||
|
|
||||||
const val kotlinIntellijPlugin = "211-1.4.32-release-IJ6693.72" // keep to newest as kotlinCompiler
|
const val kotlinIntellijPlugin = "211-1.4.32-release-IJ6693.72" // keep to newest as kotlinCompiler
|
||||||
const val intellij = "2021.1" // don't update easily unless you want your disk space -= 500MB
|
const val intellij = "2021.1" // don't update easily unless you want your disk space -= 500MB
|
||||||
|
|
||||||
|
|
||||||
const val coroutines = "1.4.0"
|
const val coroutines = "1.5.0"
|
||||||
const val serialization = "1.0.1"
|
const val atomicFU = "0.16.1"
|
||||||
const val ktor = "1.5.0"
|
const val serialization = "1.1.0"
|
||||||
const val atomicFU = "0.14.4"
|
const val ktor = "1.5.4"
|
||||||
|
|
||||||
const val androidGradle = "3.6.2"
|
const val androidGradle = "3.6.2"
|
||||||
|
|
||||||
const val blockingBridge = "1.6.0"
|
const val blockingBridge = "1.10.3"
|
||||||
|
|
||||||
const val junit = "5.4.2"
|
const val junit = "5.4.2"
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* @author Karlatemp <karlatemp@vip.qq.com> <https://github.com/Karlatemp>
|
* @author Karlatemp <karlatemp@vip.qq.com> <https://github.com/Karlatemp>
|
||||||
@ -29,7 +29,7 @@ annotation class ConsoleTerminalExperimentalApi
|
|||||||
object ConsoleTerminalSettings {
|
object ConsoleTerminalSettings {
|
||||||
@JvmField
|
@JvmField
|
||||||
var setupAnsi: Boolean = System.getProperty("os.name")
|
var setupAnsi: Boolean = System.getProperty("os.name")
|
||||||
.toLowerCase()
|
.lowercase()
|
||||||
.contains("windows") // Just for Windows
|
.contains("windows") // Just for Windows
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||||
*
|
*
|
||||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
* 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
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -30,8 +30,8 @@ import java.io.InputStream
|
|||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
import java.io.PrintWriter
|
import java.io.PrintWriter
|
||||||
|
|
||||||
private const val LN_INT = '\n'.toInt()
|
private const val LN_INT = '\n'.code
|
||||||
private const val LN_BYTE = '\n'.toByte()
|
private const val LN_BYTE = '\n'.code.toByte()
|
||||||
|
|
||||||
internal object NoConsoleNonBlockingReader : NonBlockingReader() {
|
internal object NoConsoleNonBlockingReader : NonBlockingReader() {
|
||||||
override fun read(timeout: Long, isPeek: Boolean): Int {
|
override fun read(timeout: Long, isPeek: Boolean): Int {
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
package net.mamoe.mirai.console.gradle
|
package net.mamoe.mirai.console.gradle
|
||||||
|
|
||||||
internal object VersionConstants {
|
internal object VersionConstants {
|
||||||
const val CONSOLE_VERSION = "2.6.4" // value is written here automatically during build
|
const val CONSOLE_VERSION = "2.7-M1-dev-2" // value is written here automatically during build
|
||||||
const val CORE_VERSION = "2.6.4" // value is written here automatically during build
|
const val CORE_VERSION = "2.7-M1-dev-2" // value is written here automatically during build
|
||||||
}
|
}
|
@ -60,6 +60,13 @@ fun File.resolveMkdir(relative: String): File {
|
|||||||
return this.resolve(relative).apply { mkdirs() }
|
return this.resolve(relative).apply { mkdirs() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlin.target.compilations.all {
|
||||||
|
kotlinOptions {
|
||||||
|
apiVersion = "1.4"
|
||||||
|
languageVersion = "1.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.intellij.tasks.PatchPluginXmlTask> {
|
tasks.withType<org.jetbrains.intellij.tasks.PatchPluginXmlTask> {
|
||||||
sinceBuild("201.*")
|
sinceBuild("201.*")
|
||||||
untilBuild("215.*")
|
untilBuild("215.*")
|
||||||
|
Loading…
Reference in New Issue
Block a user