diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/description/VersionRequirement.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/description/VersionRequirement.kt index aa00ca886..b8ec88690 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/description/VersionRequirement.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/description/VersionRequirement.kt @@ -7,13 +7,18 @@ public sealed class VersionRequirement { public abstract operator fun contains(version: Semver): Boolean public fun contains(version: String): Boolean = contains(Semver(version, Semver.SemverType.LOOSE)) - public class Exact( + public class Exact + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) + constructor( version: Semver, ) : VersionRequirement() { + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) public val version: Semver = version.toStrict() + @Suppress("DEPRECATION_ERROR") public constructor(version: String) : this(Semver(version, Semver.SemverType.LOOSE)) + @Suppress("DEPRECATION_ERROR") override fun contains(version: Semver): Boolean = this.version.isEquivalentTo(version.toStrict()) } @@ -100,14 +105,17 @@ public sealed class VersionRequirement { } - @Suppress("unused") + @Suppress("unused", "DeprecatedCallableAddReplaceWith") public class Builder { + @Suppress("DEPRECATION_ERROR") + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKafuuChinoForever public fun exact(version: Semver): VersionRequirement = Exact(version) @ILoveKafuuChinoForever public fun exact(version: String): VersionRequirement = Exact(version) + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKafuuChinoForever public fun custom(checker: (version: Semver) -> Boolean): VersionRequirement { return object : Custom() { @@ -139,6 +147,7 @@ public sealed class VersionRequirement { return MatchesCocoapodsPattern(versionPattern) } + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKafuuChinoForever public fun range( begin: Semver, @@ -147,6 +156,7 @@ public sealed class VersionRequirement { endInclusive: Boolean, ): VersionRequirement = InRange(begin, beginInclusive, end, endInclusive) + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKafuuChinoForever public fun range( begin: String, @@ -155,6 +165,7 @@ public sealed class VersionRequirement { endInclusive: Boolean, ): VersionRequirement = InRange(begin, beginInclusive, end, endInclusive) + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKafuuChinoForever public fun range( begin: Semver, @@ -172,6 +183,7 @@ public sealed class VersionRequirement { ): VersionRequirement = InRange(begin, beginInclusive, end, endInclusive) + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKafuuChinoForever public operator fun Semver.rangeTo(endInclusive: Semver): VersionRequirement { return InRange(this, true, endInclusive, true) @@ -190,12 +202,14 @@ public sealed class VersionRequirement { true) } + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKafuuChinoForever public operator fun String.rangeTo(endInclusive: Semver): VersionRequirement { return InRange(Semver(this, Semver.SemverType.LOOSE), true, endInclusive, true) } + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKafuuChinoForever public infix fun Semver.until(endExclusive: Semver): VersionRequirement { return InRange(this, true, endExclusive, false) @@ -214,6 +228,7 @@ public sealed class VersionRequirement { false) } + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKafuuChinoForever public infix fun String.until(endExclusive: Semver): VersionRequirement { return InRange(Semver(this, Semver.SemverType.LOOSE), true, endExclusive, false) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPluginDescription.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPluginDescription.kt index ca417b356..5517ace42 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPluginDescription.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPluginDescription.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:Suppress("unused", "INVISIBLE_REFERENCE", "INVISIBLE_member") +@file:Suppress("unused", "INVISIBLE_REFERENCE", "INVISIBLE_member", "DeprecatedCallableAddReplaceWith") package net.mamoe.mirai.console.plugin.jvm @@ -53,6 +53,8 @@ public interface JvmPluginDescription : PluginDescription { * 构建 [JvmPluginDescription] * @see JvmPluginDescriptionBuilder */ + @Suppress("DEPRECATION_ERROR") + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @JvmSynthetic public operator fun invoke( /** @@ -93,10 +95,13 @@ public interface JvmPluginDescription : PluginDescription { * * @see [JvmPluginDescription.invoke] */ -public class JvmPluginDescriptionBuilder( +public class JvmPluginDescriptionBuilder +@Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) +constructor( private var id: String, private var version: Semver, ) { + @Suppress("DEPRECATION_ERROR") public constructor(name: String, version: String) : this(name, Semver(version, Semver.SemverType.LOOSE)) private var name: String = id @@ -107,10 +112,12 @@ public class JvmPluginDescriptionBuilder( @ILoveKuriyamaMiraiForever public fun name(value: String): JvmPluginDescriptionBuilder = apply { this.name = value.trim() } + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKuriyamaMiraiForever public fun version(value: String): JvmPluginDescriptionBuilder = apply { this.version = Semver(value, Semver.SemverType.LOOSE) } + @Deprecated("Semver 将会在 1.0-RC 被替换为 Console 自己实现的版本。请临时使用 String。", level = DeprecationLevel.ERROR) @ILoveKuriyamaMiraiForever public fun version(value: Semver): JvmPluginDescriptionBuilder = apply { this.version = value }