Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[console] Pre check plugin duplication & console requirement #2703

Merged
merged 10 commits into from
Jul 26, 2023

Conversation

cssxsh
Copy link
Contributor

@cssxsh cssxsh commented Jun 21, 2023

@cssxsh cssxsh changed the title feat: check in load plugin fix: check in load plugin Jun 21, 2023
@Karlatemp
Copy link
Member

consoleRequirement 方法似乎是多余的, dependsOn 已经能表示 console require 了吧

@cssxsh
Copy link
Contributor Author

cssxsh commented Jun 26, 2023

dependsOn

@Karlatemp

dependsOn 有多个同名函数,适合拓展 console version 判断的只有 (必须指定 versionRequirement)

    @ILoveKuriyamaMiraiForever
    public fun dependsOn(
        @ResolveContext(PLUGIN_ID) pluginId: String,
        @ResolveContext(VERSION_REQUIREMENT) versionRequirement: String,
        isOptional: Boolean = false,
    ): JvmPluginDescriptionBuilder = apply {
        // XXX: 兼容性
        if (pluginId == "net.mamoe.mirai.console" || pluginId == "net.mamoe.mirai") {
            consoleRequirement = versionRequirement
            return@apply
        }
        this.dependencies.add(PluginDependency(pluginId, versionRequirement, isOptional))
    }

而且参数名已经敲定了 pluginId

@Karlatemp
Copy link
Member

dependsOn 是最符合直觉也可以直接扩展的,没人规定不能存在特殊值,plugin id 可以把 net.mamoe.mirai-console 用作特殊值

Copy link
Member

@Him188 Him188 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外看起来没有支持 YAML 加载

@cssxsh cssxsh requested a review from Him188 July 12, 2023 10:06
@Karlatemp Karlatemp added t:enhancement 类型: 现有功能上的优化 s:console 子系统: mirai-console labels Jul 25, 2023
@Karlatemp Karlatemp added this to the 2.16.0-RC milestone Jul 25, 2023
@Karlatemp Karlatemp added the z:ready-to-merge 状态: PR 已经可以合并, 正在等待一些安排 label Jul 25, 2023
@Karlatemp Karlatemp changed the title fix: check in load plugin [console] Pre check plugin duplication & console requirement Jul 25, 2023
@Karlatemp Karlatemp merged commit 7daf2d5 into mamoe:dev Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s:console 子系统: mirai-console t:enhancement 类型: 现有功能上的优化 z:ready-to-merge 状态: PR 已经可以合并, 正在等待一些安排
Projects
None yet
3 participants