Skip to content

fix(site)+feat(tomlplusplus): 文档站点死链修复;build.mcpp 中可 import tomlplusplus - #518

Merged
Sunrisepeak merged 5 commits into
mainfrom
fix/site-links-and-tomlplusplus-build-mcpp
Oct 10, 2026
Merged

Sunrisepeak merged 5 commits into
mainfrom
fix/site-links-and-tomlplusplus-build-mcpp

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

概要

  1. 站点文档死链:例如 https://mcpp.index.xlings.org/zh/docs/contributing/descriptor-examples.md 404。本地构建 + 链接检查共发现 9 页 23 条,本 PR 后为 0。
  2. toml++ 在 build.mcpp 中可 import tomlplusplus;:原 Form B 描述符作为 host module 会失败。项目侧的普通 import 不受影响。

分析与方案见 .agents/docs/2026-10-11-site-doc-links-and-formb-host-module-plan.md。

站点

根因 修复
xpkgindex 只改写指向已注册 guide 的相对链接,其余原样输出 → 404 openxlings/xpkgindex#10:.lua → 包页;目录 → 其 README 对应的 guide;其他仓库文件 → {github}/blob|tree/HEAD/…;不存在则 warning。顺带修复译文 guide 的链接跳回英文页的问题
descriptor-examples、openkal-compat 未注册;repository-and-schema 未挂 zh 译文 .xpkgindex.json 补齐
没有 CI 守卫 site-check 新增 tools/site/check_links.py:产物内任一内部死链即失败
base_url 仍是 mcpplibs.github.io(sitemap/feed) 改为 https://mcpp.index.xlings.org

xpkgindex#10 已合入(bbad1af);site-check 已改回默认分支。

toml++

host-module 失败分两层(详见 mcpp#797):

  • L1:需要 lib root([lib] path 或 src/<name>.cppm),而 Form B 词表里没有 lib;
  • L2:host module 编译时不带包的 include_dirs。

改法:

  • 改为 Form A:mcpp = "*/mcpp.toml",由 install() 写入 mcpp.toml(显式写 [lib] path)和上游 master 的 src/modules/tomlplusplus.cppm。基础源码仍是官方 v3.4.0 tarball,与 CN 镜像 sha256 一致。
  • 模块单元改为相对自身 include 头文件(../../include/toml++/toml.hpp),这是对 L2 的临时绕过,#797 定案后恢复 <toml++/toml.hpp>。
  • 每个平台的条目加 revision = 1:本机已有旧 Form B payload 时会自动重装(本地实测迁移通过)。

测试:

  • 新增成员 tests/examples/marzer.tomlplusplus-build-mcpp:build.mcpp 中 import tomlplusplus;,解析 build-config.toml 后注入 define,由测试断言;
  • 现有 tests/examples/marzer.tomlplusplus(项目侧 import)不变,仍通过。
  • 两者分成两个成员,是因为同一个包同时写在 [dependencies] 和 [build-dependencies](host-module)时,项目侧会丢 BMI。这是 mcpp 的 bug,已在 #797 下追加评论。

已知限制:revision 从 mcpp 2026.9.27.1 起生效,而 min_mcpp = 2026.9.18.3。在这两个版本之间的 mcpp 上,如果本机缓存着旧 payload,需要手动清除。

- .xpkgindex.json:注册 descriptor-examples、openkal-compat(含 zh);
  repository-and-schema 挂 zh 译文;base_url 改为 https://mcpp.index.xlings.org
- site-check:新增 tools/site/check_links.py,产物内任一内部死链即失败
- site-check 临时 pin xpkgindex 到 openxlings/xpkgindex#10(相对链接回退、
  译文 guide 保持语言),合入后改回默认分支

修复 https://mcpp.index.xlings.org/zh/docs/contributing/descriptor-examples.md
等 9 页 23 条 404。
marzer.tomlplusplus 由 Form B 改为 Form A:mcpp = "*/mcpp.toml",install()
把 mcpp.toml([lib] path 显式声明导出面)与上游 master 的
src/modules/tomlplusplus.cppm 写入解包后的 v3.4.0 源码树。

- host module 需要 lib root,Form B 无法声明;mcpp 编译 host module 不带包的
  include_dirs,模块单元改为相对自身 include 头文件(mcpp-community/mcpp#797)
- 各平台 revision = 1,旧 Form B payload 自动重装(实测迁移通过)
- 新成员 tests/examples/marzer.tomlplusplus-build-mcpp:build.mcpp 解析
  build-config.toml 并注入 define;与项目侧测试分开(同包双角色 bug,见 #797)
同时让 CI 选中该成员:描述符变更按 mcpp.toml 中出现 'marzer.tomlplusplus'
字面量选成员,而 [dependencies.marzer] 写法不含该字面量。
@Sunrisepeak
Sunrisepeak merged commit 84ed06e into main Oct 10, 2026
17 checks passed
@Sunrisepeak
Sunrisepeak deleted the fix/site-links-and-tomlplusplus-build-mcpp branch October 10, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant