Use optIn, close #1986

This commit is contained in:
Him188 2022-04-24 15:20:14 +01:00
parent ffbe540800
commit 0e72fe9757

View File

@ -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 许可证的约束, 可以在以下链接找到该许可证. * 此源代码的使用受 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. * 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 @file:JvmMultifileClass
@ -36,12 +36,7 @@ public class MiraiConsoleGradlePlugin : Plugin<Project> {
} }
private fun KotlinSourceSet.configureSourceSet(project: Project, target: KotlinTarget) { 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) } dependencies { configureDependencies(project, this@configureSourceSet, target) }
} }
@ -121,7 +116,10 @@ public class MiraiConsoleGradlePlugin : Plugin<Project> {
BuildMiraiPluginV2::class.java BuildMiraiPluginV2::class.java
).also { buildPluginV2 -> ).also { buildPluginV2 ->
buildPluginV2.group = "mirai" buildPluginV2.group = "mirai"
buildPluginV2.registerMetadataTask(tasks, "miraiPrepareMetadata".wrapNameWithPlatform(target, isSingleTarget)) buildPluginV2.registerMetadataTask(
tasks,
"miraiPrepareMetadata".wrapNameWithPlatform(target, isSingleTarget)
)
buildPluginV2.init(target) buildPluginV2.init(target)
} }
tasks.create( tasks.create(