From 19abf48aac4ad0eed63fd721ae9723f0686097d5 Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 27 May 2021 13:50:28 +0800 Subject: [PATCH] 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 --- backend/codegen/build.gradle.kts | 10 ++++++++++ backend/codegen/src/MessageScopeCodegen.kt | 10 ++++++---- backend/codegen/src/old/JSettingCodegen.kt | 10 +++++----- backend/codegen/src/util.kt | 12 ++++++------ .../src/command/BuiltInCommands.kt | 3 ++- .../CommandArgumentParserBuiltins.kt | 14 +++++++------- .../src/internal/command/CommandManagerImpl.kt | 12 ++++++------ .../internal/permission/parseFromStringImpl.kt | 10 +++++----- .../src/internal/util/ByteUtils.kt | 10 +++++----- .../src/permission/PermissionService.kt | 12 ++++++------ .../plugin/description/PluginDescription.kt | 16 ++++++++-------- backend/mirai-console/src/util/MessageScope.kt | 10 +++++----- buildSrc/src/main/kotlin/Versions.kt | 18 +++++++++--------- .../src/ConsoleTerminalSettings.kt | 10 +++++----- .../src/noconsole/NoConsole.kt | 12 ++++++------ .../src/main/kotlin/VersionConstants.kt | 4 ++-- tools/intellij-plugin/build.gradle.kts | 7 +++++++ 17 files changed, 100 insertions(+), 80 deletions(-) diff --git a/backend/codegen/build.gradle.kts b/backend/codegen/build.gradle.kts index 1ee334a3f..070dea7fe 100644 --- a/backend/codegen/build.gradle.kts +++ b/backend/codegen/build.gradle.kts @@ -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 { kotlin("jvm") kotlin("plugin.serialization") @@ -21,4 +30,5 @@ kotlin { dependencies { api(kotlin("stdlib-jdk8")) implementation(kotlin("reflect")) + api(`mirai-core-utils`) } \ No newline at end of file diff --git a/backend/codegen/src/MessageScopeCodegen.kt b/backend/codegen/src/MessageScopeCodegen.kt index b444f9586..b49342c3a 100644 --- a/backend/codegen/src/MessageScopeCodegen.kt +++ b/backend/codegen/src/MessageScopeCodegen.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ package net.mamoe.mirai.console.codegen +import net.mamoe.mirai.utils.capitalize + internal val TypeCandidatesForMessageScope = arrayOf( KtType("Contact"), KtType("CommandSender"), diff --git a/backend/codegen/src/old/JSettingCodegen.kt b/backend/codegen/src/old/JSettingCodegen.kt index db9a50905..4d64c9e81 100644 --- a/backend/codegen/src/old/JSettingCodegen.kt +++ b/backend/codegen/src/old/JSettingCodegen.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ @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}>") { - override val funName = item.primitiveName.toLowerCase() + "List" + override val funName = item.primitiveName.lowercase() + "List" } class JArrayClazz(item: JClazz) : JClazz(item.primitiveName + "[]", item.primitiveName + "[]") diff --git a/backend/codegen/src/util.kt b/backend/codegen/src/util.kt index 441df612f..199a591cf 100644 --- a/backend/codegen/src/util.kt +++ b/backend/codegen/src/util.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ @file:Suppress("NOTHING_TO_INLINE", "MemberVisibilityCanBePrivate", "unused", "PRE_RELEASE_CLASS") @@ -44,7 +44,7 @@ sealed class KtType { */ sealed class KtPrimitive( override val standardName: String, - val jPrimitiveName: String = standardName.toLowerCase(), + val jPrimitiveName: String = standardName.lowercase(), val jObjectName: String = standardName ) : KtType() { object KtByte : KtPrimitive("Byte") @@ -95,7 +95,7 @@ operator fun KtType.plus(type: KtType): List { 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() diff --git a/backend/mirai-console/src/command/BuiltInCommands.kt b/backend/mirai-console/src/command/BuiltInCommands.kt index ea00a8199..ba94105aa 100644 --- a/backend/mirai-console/src/command/BuiltInCommands.kt +++ b/backend/mirai-console/src/command/BuiltInCommands.kt @@ -69,7 +69,7 @@ internal interface BuiltInCommandInternal : Command, BuiltInCommand * * [查看文档](https://github.com/mamoe/mirai-console/docs/BuiltInCommands.md) */ -@Suppress("unused") +@Suppress("unused", "RESTRICTED_CONSOLE_COMMAND_OWNER") public object BuiltInCommands { @ConsoleExperimentalApi public val parentPermission: Permission by lazy { @@ -121,6 +121,7 @@ public object BuiltInCommands { private val closingLock = Mutex() + @OptIn(DelicateCoroutinesApi::class) @Handler public suspend fun CommandSender.handle() { GlobalScope.launch { diff --git a/backend/mirai-console/src/command/descriptor/CommandArgumentParserBuiltins.kt b/backend/mirai-console/src/command/descriptor/CommandArgumentParserBuiltins.kt index 947a4cdef..6a7bf091b 100644 --- a/backend/mirai-console/src/command/descriptor/CommandArgumentParserBuiltins.kt +++ b/backend/mirai-console/src/command/descriptor/CommandArgumentParserBuiltins.kt @@ -421,10 +421,10 @@ public class EnumValueArgumentParser>( private val delegate: (String) -> T = kotlin.run { val enums = type.enumConstants.asSequence() // step 1: 分析是否能够忽略大小写 - if (enums.map { it.name.toLowerCase() }.hasDuplicates()) { + if (enums.map { it.name.lowercase() }.hasDuplicates()) { ({ java.lang.Enum.valueOf(type, it) }) } 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 name = elm.name.split('_') @@ -433,18 +433,18 @@ public class EnumValueArgumentParser>( } else { buildString { val iterator = name.iterator() - append(iterator.next().toLowerCase()) + append(iterator.next().lowercase()) for (v in iterator) { if (v.isEmpty()) continue - append(v[0].toUpperCase()) - append(v.substring(1, v.length).toLowerCase()) + append(v[0].uppercase()) + append(v.substring(1, v.length).lowercase()) } } to elm } } val camelCaseDirection = if (( - enums.map { it.name.toLowerCase() } + camelCase.map { it.first.toLowerCase() } + enums.map { it.name.lowercase() } + camelCase.map { it.first.lowercase() } ).hasDuplicates() ) { // 确认驼峰命名与源没有冲突 emptyMap() @@ -454,7 +454,7 @@ public class EnumValueArgumentParser>( ({ camelCaseDirection[it] - ?: lowerCaseEnumDirection[it.toLowerCase()] + ?: lowerCaseEnumDirection[it.lowercase()] ?: noConstant() }) } diff --git a/backend/mirai-console/src/internal/command/CommandManagerImpl.kt b/backend/mirai-console/src/internal/command/CommandManagerImpl.kt index fe9e81570..3bc6a4276 100644 --- a/backend/mirai-console/src/internal/command/CommandManagerImpl.kt +++ b/backend/mirai-console/src/internal/command/CommandManagerImpl.kt @@ -54,9 +54,9 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by MiraiCons */ override fun matchCommand(commandName: String): Command? { 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 @@ -90,13 +90,13 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by MiraiCons _registeredCommands.add(command) if (command.prefixOptional) { for (name in command.allNames) { - val lowerCaseName = name.toLowerCase() + val lowerCaseName = name.lowercase() optionalPrefixCommandMap[lowerCaseName] = command requiredPrefixCommandMap[lowerCaseName] = command } } else { for (name in command.allNames) { - val lowerCaseName = name.toLowerCase() + val lowerCaseName = name.lowercase() optionalPrefixCommandMap.remove(lowerCaseName) // ensure resolution consistency requiredPrefixCommandMap[lowerCaseName] = command } @@ -111,11 +111,11 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by MiraiCons override fun unregisterCommand(command: Command): Boolean = modifyLock.withLock { if (command.prefixOptional) { command.allNames.forEach { - optionalPrefixCommandMap.remove(it.toLowerCase()) + optionalPrefixCommandMap.remove(it.lowercase()) } } command.allNames.forEach { - requiredPrefixCommandMap.remove(it.toLowerCase()) + requiredPrefixCommandMap.remove(it.lowercase()) } _registeredCommands.remove(command) } diff --git a/backend/mirai-console/src/internal/permission/parseFromStringImpl.kt b/backend/mirai-console/src/internal/permission/parseFromStringImpl.kt index d1748d6e5..bb09b2831 100644 --- a/backend/mirai-console/src/internal/permission/parseFromStringImpl.kt +++ b/backend/mirai-console/src/internal/permission/parseFromStringImpl.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ @file:Suppress("unused") @@ -15,7 +15,7 @@ import net.mamoe.mirai.console.permission.AbstractPermitteeId import net.mamoe.mirai.console.permission.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 == "console") return Console if (str == "client*") return AnyOtherClient diff --git a/backend/mirai-console/src/internal/util/ByteUtils.kt b/backend/mirai-console/src/internal/util/ByteUtils.kt index 0b84be55c..6b6c2250f 100644 --- a/backend/mirai-console/src/internal/util/ByteUtils.kt +++ b/backend/mirai-console/src/internal/util/ByteUtils.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ package net.mamoe.mirai.console.internal.util @@ -44,7 +44,7 @@ internal fun ByteArray.toUHexString( return buildString(length * 2) { this@toUHexString.forEachIndexed { index, it -> 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" append(ret) if (index < lastIndex - 1) append(separator) diff --git a/backend/mirai-console/src/permission/PermissionService.kt b/backend/mirai-console/src/permission/PermissionService.kt index 49e25e94b..9542ed089 100644 --- a/backend/mirai-console/src/permission/PermissionService.kt +++ b/backend/mirai-console/src/permission/PermissionService.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ @file:Suppress("NOTHING_TO_INLINE", "unused", "MemberVisibilityCanBePrivate") @@ -107,8 +107,8 @@ public interface PermissionService

{ plugin: Plugin, @ResolveContext(COMMAND_NAME) permissionName: String, ): PermissionId = PermissionId( - plugin.description.id.toLowerCase(), - permissionName.toLowerCase() + plugin.description.id.lowercase(), + permissionName.lowercase() ) /////////////////////////////////////////////////////////////////////////// diff --git a/backend/mirai-console/src/plugin/description/PluginDescription.kt b/backend/mirai-console/src/plugin/description/PluginDescription.kt index 5e164d4f9..472aa3208 100644 --- a/backend/mirai-console/src/plugin/description/PluginDescription.kt +++ b/backend/mirai-console/src/plugin/description/PluginDescription.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ 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.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) { throw IllegalPluginDescriptionException("Plugin does not match regex '${ID_REGEX.pattern}'.") @@ -178,7 +178,7 @@ public interface PluginDescription { @Throws(IllegalPluginDescriptionException::class) public fun checkPluginName(name: String) { 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 -> throw IllegalPluginDescriptionException("Plugin name is illegal: '$illegal'.") } @@ -191,8 +191,8 @@ public interface PluginDescription { */ @Throws(IllegalPluginDescriptionException::class) public fun checkDependencies(pluginId: String, dependencies: Set) { - val lowercaseId = pluginId.toLowerCase() - val lowercaseDependencies = dependencies.mapTo(LinkedHashSet(dependencies.size)) { it.id.toLowerCase() } + val lowercaseId = pluginId.lowercase() + val lowercaseDependencies = dependencies.mapTo(LinkedHashSet(dependencies.size)) { it.id.lowercase() } if (lowercaseDependencies.size != dependencies.size) throw IllegalPluginDescriptionException("Duplicated dependency detected: A plugin cannot depend on different versions of dependencies of the same id") diff --git a/backend/mirai-console/src/util/MessageScope.kt b/backend/mirai-console/src/util/MessageScope.kt index 1b39f9c9f..2194312f3 100644 --- a/backend/mirai-console/src/util/MessageScope.kt +++ b/backend/mirai-console/src/util/MessageScope.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ @file:Suppress( @@ -97,7 +97,7 @@ import kotlin.internal.LowPriorityInOverloadResolution * } * ``` */ -public interface MessageScope { +public sealed interface MessageScope { /** * 如果此 [MessageScope] 仅包含一个消息对象, 则 [realTarget] 指向这个对象. 否则 [realTarget] 为 `null`. * diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 8bdcddd16..8e2c49a4a 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -12,26 +12,26 @@ import org.gradle.api.attributes.Attribute object Versions { - const val core = "2.2.2" // WARNING: This might not be up-to-date since included in mirai build. - const val console = "2.2.2" + 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.6.4-dev-kt15" const val consoleGraphical = "0.0.7" const val consoleTerminal = console - const val kotlinCompiler = "1.4.21" - const val kotlinStdlib = "1.4.21" + const val kotlinCompiler = "1.5.10" + const val kotlinStdlib = "1.5.10" 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 coroutines = "1.4.0" - const val serialization = "1.0.1" - const val ktor = "1.5.0" - const val atomicFU = "0.14.4" + const val coroutines = "1.5.0" + const val atomicFU = "0.16.1" + const val serialization = "1.1.0" + const val ktor = "1.5.4" const val androidGradle = "3.6.2" - const val blockingBridge = "1.6.0" + const val blockingBridge = "1.10.3" const val junit = "5.4.2" diff --git a/frontend/mirai-console-terminal/src/ConsoleTerminalSettings.kt b/frontend/mirai-console-terminal/src/ConsoleTerminalSettings.kt index e652ab4fb..8600e3478 100644 --- a/frontend/mirai-console-terminal/src/ConsoleTerminalSettings.kt +++ b/frontend/mirai-console-terminal/src/ConsoleTerminalSettings.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ /* * @author Karlatemp @@ -29,7 +29,7 @@ annotation class ConsoleTerminalExperimentalApi object ConsoleTerminalSettings { @JvmField var setupAnsi: Boolean = System.getProperty("os.name") - .toLowerCase() + .lowercase() .contains("windows") // Just for Windows @JvmField diff --git a/frontend/mirai-console-terminal/src/noconsole/NoConsole.kt b/frontend/mirai-console-terminal/src/noconsole/NoConsole.kt index bf0c054d6..30fc93b00 100644 --- a/frontend/mirai-console-terminal/src/noconsole/NoConsole.kt +++ b/frontend/mirai-console-terminal/src/noconsole/NoConsole.kt @@ -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 许可证的约束, 可以在以下链接找到该许可证. - * 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. + * 此源代码的使用受 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 + * https://github.com/mamoe/mirai/blob/master/LICENSE */ /* @@ -30,8 +30,8 @@ import java.io.InputStream import java.io.OutputStream import java.io.PrintWriter -private const val LN_INT = '\n'.toInt() -private const val LN_BYTE = '\n'.toByte() +private const val LN_INT = '\n'.code +private const val LN_BYTE = '\n'.code.toByte() internal object NoConsoleNonBlockingReader : NonBlockingReader() { override fun read(timeout: Long, isPeek: Boolean): Int { diff --git a/tools/gradle-plugin/src/main/kotlin/VersionConstants.kt b/tools/gradle-plugin/src/main/kotlin/VersionConstants.kt index 8f37100e3..8787ce0b6 100644 --- a/tools/gradle-plugin/src/main/kotlin/VersionConstants.kt +++ b/tools/gradle-plugin/src/main/kotlin/VersionConstants.kt @@ -10,6 +10,6 @@ package net.mamoe.mirai.console.gradle internal object VersionConstants { - const val CONSOLE_VERSION = "2.6.4" // value is written here automatically during build - const val CORE_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.7-M1-dev-2" // value is written here automatically during build } \ No newline at end of file diff --git a/tools/intellij-plugin/build.gradle.kts b/tools/intellij-plugin/build.gradle.kts index 36c190d78..03982f87a 100644 --- a/tools/intellij-plugin/build.gradle.kts +++ b/tools/intellij-plugin/build.gradle.kts @@ -60,6 +60,13 @@ fun File.resolveMkdir(relative: String): File { return this.resolve(relative).apply { mkdirs() } } +kotlin.target.compilations.all { + kotlinOptions { + apiVersion = "1.4" + languageVersion = "1.4" + } +} + tasks.withType { sinceBuild("201.*") untilBuild("215.*")