From 0e72fe9757baa1825b909d23bce4258245ee96d4 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sun, 24 Apr 2022 15:20:14 +0100 Subject: [PATCH] Use `optIn`, close #1986 --- .../main/kotlin/MiraiConsoleGradlePlugin.kt | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/mirai-console/tools/gradle-plugin/src/main/kotlin/MiraiConsoleGradlePlugin.kt b/mirai-console/tools/gradle-plugin/src/main/kotlin/MiraiConsoleGradlePlugin.kt index 446809959..3011db0ea 100644 --- a/mirai-console/tools/gradle-plugin/src/main/kotlin/MiraiConsoleGradlePlugin.kt +++ b/mirai-console/tools/gradle-plugin/src/main/kotlin/MiraiConsoleGradlePlugin.kt @@ -1,10 +1,10 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 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. + * 此源代码的使用受 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/dev/LICENSE */ @file:JvmMultifileClass @@ -36,12 +36,7 @@ public class MiraiConsoleGradlePlugin : Plugin { } private fun KotlinSourceSet.configureSourceSet(project: Project, target: KotlinTarget) { - try { - @Suppress("DEPRECATION") // user may use 1.4 - languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn") - } catch (e: NoSuchMethodError) { - languageSettings.optIn("kotlin.RequiresOptIn") - } + languageSettings.optIn("kotlin.RequiresOptIn") dependencies { configureDependencies(project, this@configureSourceSet, target) } } @@ -121,7 +116,10 @@ public class MiraiConsoleGradlePlugin : Plugin { BuildMiraiPluginV2::class.java ).also { buildPluginV2 -> buildPluginV2.group = "mirai" - buildPluginV2.registerMetadataTask(tasks, "miraiPrepareMetadata".wrapNameWithPlatform(target, isSingleTarget)) + buildPluginV2.registerMetadataTask( + tasks, + "miraiPrepareMetadata".wrapNameWithPlatform(target, isSingleTarget) + ) buildPluginV2.init(target) } tasks.create(