mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Check version on init for PluginDependency
This commit is contained in:
parent
06895e2a6d
commit
b2ad961e8d
@ -46,6 +46,7 @@ public data class PluginDependency @JvmOverloads constructor(
|
|||||||
init {
|
init {
|
||||||
kotlin.runCatching {
|
kotlin.runCatching {
|
||||||
PluginDescription.checkPluginId(id)
|
PluginDescription.checkPluginId(id)
|
||||||
|
if (versionRequirement != null) SemVersion.parseRangeRequirement(versionRequirement)
|
||||||
}.getOrElse {
|
}.getOrElse {
|
||||||
throw IllegalArgumentException(it)
|
throw IllegalArgumentException(it)
|
||||||
}
|
}
|
||||||
@ -63,7 +64,10 @@ public data class PluginDependency @JvmOverloads constructor(
|
|||||||
|
|
||||||
public override fun toString(): String = buildString {
|
public override fun toString(): String = buildString {
|
||||||
append(id)
|
append(id)
|
||||||
versionRequirement?.let(::append)
|
versionRequirement?.let {
|
||||||
|
append(":")
|
||||||
|
append(it)
|
||||||
|
}
|
||||||
if (isOptional) {
|
if (isOptional) {
|
||||||
append('?')
|
append('?')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user