Move JvmPluginDescription.invoke to top-level

This commit is contained in:
Him188 2020-11-09 14:37:10 +08:00
parent 1a5355db89
commit 64e535d282

View File

@ -29,52 +29,79 @@ import net.mamoe.mirai.console.util.SemVersion
*/ */
public interface JvmPluginDescription : PluginDescription { public interface JvmPluginDescription : PluginDescription {
public companion object { public companion object {
/** @Suppress("UNUSED_PARAMETER")
* 构建 [JvmPluginDescription] @Deprecated(
* @see JvmPluginDescriptionBuilder "Use top-level function instead",
*/ ReplaceWith("JvmPluginDescription(id, version, block)", "net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription"),
DeprecationLevel.ERROR
)
@JvmName("create") @JvmName("create")
@JvmSynthetic public inline fun invoke(
public inline operator fun invoke(
/**
* @see [PluginDescription.id]
*/
@ResolveContext(PLUGIN_ID) id: String, @ResolveContext(PLUGIN_ID) id: String,
/**
* @see [PluginDescription.version]
*/
@ResolveContext(SEMANTIC_VERSION) version: String, @ResolveContext(SEMANTIC_VERSION) version: String,
/**
* @see [PluginDescription.name]
*/
@ResolveContext(PLUGIN_NAME) name: String = id, @ResolveContext(PLUGIN_NAME) name: String = id,
block: JvmPluginDescriptionBuilder.() -> Unit = {}, block: JvmPluginDescriptionBuilder.() -> Unit = {},
): JvmPluginDescription = JvmPluginDescriptionBuilder(id, version).apply { name(name) }.apply(block).build() ): JvmPluginDescription = error("Shouldn't be called")
/** @Suppress("UNUSED_PARAMETER")
* 构建 [JvmPluginDescription] @Deprecated(
* @see JvmPluginDescriptionBuilder "Use top-level function instead",
*/ ReplaceWith("JvmPluginDescription(id, version, block)", "net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription"),
DeprecationLevel.ERROR
)
@JvmName("create") @JvmName("create")
@JvmSynthetic @JvmSynthetic
public inline operator fun invoke( public inline fun invoke(
/**
* @see [PluginDescription.id]
*/
@ResolveContext(PLUGIN_ID) id: String, @ResolveContext(PLUGIN_ID) id: String,
/**
* @see [PluginDescription.version]
*/
version: SemVersion, version: SemVersion,
/**
* @see [PluginDescription.name]
*/
@ResolveContext(PLUGIN_NAME) name: String = id, @ResolveContext(PLUGIN_NAME) name: String = id,
block: JvmPluginDescriptionBuilder.() -> Unit = {}, block: JvmPluginDescriptionBuilder.() -> Unit = {},
): JvmPluginDescription = JvmPluginDescriptionBuilder(id, version).apply { name(name) }.apply(block).build() ): JvmPluginDescription = error("Shouldn't be called")
} }
} }
/**
* 构建 [JvmPluginDescription]
* @see JvmPluginDescriptionBuilder
*/
@JvmSynthetic
public inline fun JvmPluginDescription(
/**
* @see [PluginDescription.id]
*/
@ResolveContext(PLUGIN_ID) id: String,
/**
* @see [PluginDescription.version]
*/
@ResolveContext(SEMANTIC_VERSION) version: String,
/**
* @see [PluginDescription.name]
*/
@ResolveContext(PLUGIN_NAME) name: String = id,
block: JvmPluginDescriptionBuilder.() -> Unit = {},
): JvmPluginDescription = JvmPluginDescriptionBuilder(id, version).apply { name(name) }.apply(block).build()
/**
* 构建 [JvmPluginDescription]
* @see JvmPluginDescriptionBuilder
*/
@JvmSynthetic
public inline fun JvmPluginDescription(
/**
* @see [PluginDescription.id]
*/
@ResolveContext(PLUGIN_ID) id: String,
/**
* @see [PluginDescription.version]
*/
version: SemVersion,
/**
* @see [PluginDescription.name]
*/
@ResolveContext(PLUGIN_NAME) name: String = id,
block: JvmPluginDescriptionBuilder.() -> Unit = {},
): JvmPluginDescription = JvmPluginDescriptionBuilder(id, version).apply { name(name) }.apply(block).build()
/** /**
* [JvmPluginDescription] 构建器. * [JvmPluginDescription] 构建器.
* *