Repository navigation
feat(build): allow buildSystems[].run[] to materialize declared runConfigurationTypes - #196
Merged
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 24, 2026 08:31
Merged
21 of 22 tasks
12 tasks done
20 of 23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景 / Why
目前在 Lithe 中,插件既可以通过
buildSystems[].runConfigurationTypes(runConfigurationTypes: 0)声明运行配置类型(拥有自定义分组、包内 SVG 图标、结构化编辑表单与build.runConfigurationPlan启动计划),也可以通过buildSystems[].run[]从构建模型目标自动发现运行配置(默认生成build.provider或裸命令条目)。当同一个构建系统插件同时提供“手动新建的配置类型”和“从模型自动发现的运行目标”时,运行/调试配置对话框会拆出两个不同分组与图标(例如声明类型的自定义图标分组与通用扳手图标的构建分组),自动发现的条目也无法直接使用声明类型的结构化编辑表单。
本 PR 在
runConfigurationTypes0 内做向后兼容补充(API-29,不提升能力版本号):允许任何构建系统插件在buildSystems[].run[]中通过可选字段configurationType与values引用自身声明的runConfigurationTypes,使自动发现的模型目标直接物化为同一声明类型的build.run-type生成层配置,与手动新建配置共用分组、图标、编辑器表单和启动计划。旧宿主 Core 的RunDeclaration已带#[serde(deny_unknown_fields)],会直接以plugin.manifest.invalid拒绝未知字段,不会静默忽略。改动 / Changes
runConfigurationTypes: 0内兼容扩展,不升版):rust/crates/build/src/manifest.rs:校验顺序调整为先校验runConfigurationTypes再校验run。rust/crates/build/src/manifest/run.rs:RunDeclaration新增可选字段configurationType与values;新增validate_run_type_values校验目标类型存在、字段存在与类型匹配、choice枚举值合法、可见必填字段已提供值或默认值、模板变量合法(${root}/${project.*}/${target.*}),并与source: "provider"、debug、entrypoints、fromTasks、arguments、extension、execution互斥。rust/crates/build/src/commands.rs、detect.rs、outputs.rs、plans.rs:向run_entries传入plugin_id;新增run_type_entry_parts展开run.name与run.values模板,在model.run[]输出provider: "build.run-type"与runType: { pluginID, buildSystemID, type, values },并使用<buildSystemID>.<runID>命名空间生成无冲突的id。rust/crates/execution/src/provider_runs.rs:ProviderRunConfiguration扩展为同时支持Provider(ProviderRunSelector)与RunType(GeneratedRunTypeConfiguration),校验路径边界/执行类型/唯一性,物化为确定性 IDgenerated:run-type:<16hex>的build.run-type配置并纳入快照指纹。rust/crates/execution/src/configuration/form.rs:SavedEntry::find从generated -> project -> local顺序读取并合并,支持runConfig.editorForm与runConfig.saveConfiguration直接编辑并覆盖生成层build.run-type配置;当用户将非.的生成工作目录覆盖回.时显式写出"cwd": "."。rust/crates/execution/src/configuration/merge.rs:merge_extensions对包含type键的extensions.build(完整RunTypeReference)执行整体替换,避免被清空的可选字段从生成层回渗。shared/plugins/contract/v1/plugin-manifest.schema.json、shared/plugins/contract/v1/README.md、shared/plugins/reference/capabilities-and-versions.md(中英)、shared/plugins/reference/domains/build-systems.md(中英)及shared/plugins/reference/protocol-changelog.md(登记#196)。rust/crates/core/src/tests/plugin_run_types.rs:使用合成插件dev.lithe.test.generated-run-types新增run_configuration_types_generated_runs_are_validated与generated_run_type_decodes_generates_edits_launches_and_copies,覆盖清单校验、build.decodeModel、runConfig.generate、runConfig.resolve、runConfig.editorForm、runConfig.saveConfiguration(含清空可选字段与重置工作目录为.)、build.runConfigurationPlan及runConfig.copyConfiguration。验证 / Verification
cargo fmt --manifest-path rust/Cargo.toml --check:通过node shared/plugins/scripts/verify-docs.mjs:通过scripts/rust-core/verify-rust-core-comments.sh:通过node scripts/rust-core/verify-platform-tests.mjs:通过(52 crates)cargo test --manifest-path rust/Cargo.toml -p lithe-plugin-model -p lithe-plugin-manifest -p lithe-build -p lithe-execution:通过cargo test --manifest-path rust/Cargo.toml -p lithe-core --lib plugin_run_types:12 passed, 0 failedcargo test --manifest-path rust/Cargo.toml -p lithe-core --lib api_command_table:1 passed, 0 failedLIBSQLITE3_SYS_USE_PKG_CONFIG=1 cargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings:通过