Add ResolveContext for PluginDependency

This commit is contained in:
Him188 2020-09-20 18:58:26 +08:00
parent 09de9e7cd7
commit 47750c5060

View File

@ -11,6 +11,8 @@
package net.mamoe.mirai.console.plugin.description package net.mamoe.mirai.console.plugin.description
import net.mamoe.mirai.console.compiler.common.ResolveContext
import net.mamoe.mirai.console.compiler.common.ResolveContext.Kind.PLUGIN_ID
import net.mamoe.mirai.console.util.SemVersion import net.mamoe.mirai.console.util.SemVersion
/** /**
@ -22,7 +24,7 @@ public data class PluginDependency @JvmOverloads constructor(
/** /**
* 依赖插件 ID, [PluginDescription.id] * 依赖插件 ID, [PluginDescription.id]
*/ */
public val id: String, @ResolveContext(PLUGIN_ID) public val id: String,
/** /**
* 依赖版本号. null 时则为不限制版本. * 依赖版本号. null 时则为不限制版本.
* *
@ -48,7 +50,10 @@ public data class PluginDependency @JvmOverloads constructor(
/** /**
* @see PluginDependency * @see PluginDependency
*/ */
public constructor(name: String, isOptional: Boolean = false) : this( public constructor(
name, null, isOptional @ResolveContext(PLUGIN_ID) id: String,
isOptional: Boolean = false,
) : this(
id, null, isOptional
) )
} }