From d92f15759a4d4fe0feb418af039b5891aeeb657f Mon Sep 17 00:00:00 2001 From: Zhe Feng Date: Tue, 1 Dec 2026 13:35:45 +0000 Subject: [PATCH] mcpplibs.mwrap.boost 1.92.0: descriptor, consumer, relocated-notices check --- .../docs/2026-12-01-add-boost-mwrap-plan.md | 44 +++++++++++++++++++ .github/workflows/validate.yml | 5 +++ mcpp.toml | 1 + pkgs/mwrap/boost.lua | 43 ++++++++++++++++++ tests/mwrap/boost-libs/mcpp.toml | 8 ++++ tests/mwrap/boost-libs/tests/behavior.cpp | 38 ++++++++++++++++ tests/mwrap/boost-libs/tests/side_header.cpp | 18 ++++++++ tests/mwrap/check_installed_template.py | 21 +++++++++ 8 files changed, 178 insertions(+) create mode 100644 .agents/docs/2026-12-01-add-boost-mwrap-plan.md create mode 100644 pkgs/mwrap/boost.lua create mode 100644 tests/mwrap/boost-libs/mcpp.toml create mode 100644 tests/mwrap/boost-libs/tests/behavior.cpp create mode 100644 tests/mwrap/boost-libs/tests/side_header.cpp diff --git a/.agents/docs/2026-12-01-add-boost-mwrap-plan.md b/.agents/docs/2026-12-01-add-boost-mwrap-plan.md new file mode 100644 index 00000000..c7979fba --- /dev/null +++ b/.agents/docs/2026-12-01-add-boost-mwrap-plan.md @@ -0,0 +1,44 @@ +# 收录 mcpplibs.mwrap.boost 1.92.0(boost-m) + +> 日期:2026-12-01 + +## 1. 来源与形态 + +- 来源:(b) 基于 mcpp 开发的库,[mcpplibs/boost-m](https://github.com/mcpplibs/boost-m),tag / release `mwrap-1.92.0`。 +- 形态:Form A,描述符只声明元数据与下载地址。Boost 1.92.0 源码 vendor 在归档内,不依赖 `compat.boost-*`。 +- 版本:首发等于上游版本,不带封装修订尾号。旧身份 `ZheFeng7110.boost` 的描述符、归档和成员不改动。 +- 许可:封装 Apache-2.0,Boost 为 BSL-1.0;包经 `runtime.deploy` 部署封装、Boost 与旧封装三处的通知,目录互不覆盖。 +- 归档 `boost-m-1.92.0.tar.gz`,sha256 `02c09eff17ef18ad911194a305d19421c2795335c9333ed936233324a9a0f2d0`: + 从 release 下载两次一致,并与 tag 提交的本地 `git archive` 逐字节一致。 + +## 2. 镜像 + +暂无 CN 镜像,`url` 用纯字符串(lint 允许);镜像由维护者后续补充。 + +## 3. feature 与自动更新 + +- feature 在 boost-m 的清单中(每库一个,默认闭包 51 库,`all-modules` 为全集)。成员以 `default-features = false` + 只选 `optional`、`json`、`filesystem`、`version`,不构建整个封装。 +- `extensions.autoupdate` 跟随 `mwrap-${version}` tag 的 release 资产。 + +## 4. 消费者与验收 + +- `tests/mwrap/boost-libs`:`behavior.cpp` 覆盖纯头库、编译库、类型化 catch 与版本常量;`side_header.cpp` 覆盖 + `` 与根模块 import 的混用,原始宏与映射常量分别验证。 +- `check_installed_template.py` 增加 Boost 的 `--deploy` 契约:boost-m 的封装许可在 `licenses/boost/wrapper/`, + 与 `STATIC_NOTICES` 的布局不同,所以单列分支。`validate.yml` 加对应步骤。 + +本地结果(Linux x86_64,mcpp 2026.11.23.1,独立 MCPP_HOME,GLOBAL): + +| 命令 | 工具链 | 结果 | +|---|---|---| +| `run_members.sh boost-libs` | gcc@16.2.0(默认) | 2 passed | +| `run_members.sh boost-libs --cache local` | llvm@23.1.3 | 2 passed | +| `check_installed_template.py --package mcpplibs.mwrap.boost --deploy` | llvm@23.1.3 | 通过,6 份通知逐字节一致 | + +描述符的各项 lint 与 `mcpp xpkg parse` 通过;Windows 与 macOS 由 CI 验证。 + +## 5. 注意事项 + +- 归档内 `examples/git-dep` 仍写迁移前的 `boost::BOOST_VERSION`,不能编译;示例不属于包的构建,模块、模板与测试不受影响。 +- 未更新 `tests/member-timings.tsv`:本地 gcc 的首次耗时含工具链下载,不能代表 CI。 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index d153b03a..0d443686 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1817,6 +1817,11 @@ jobs: shell: bash run: python3 tests/mwrap/check_installed_template.py --mcpp "$MCPP" --package mcpplibs.mwrap.zlib --deploy + - name: Installed Boost wrapper archive, actual default optional template and its relocated notices + if: contains(format(' {0} ', env.MEMBERS), ' boost-libs ') && matrix.toolchain == 'default' + shell: bash + run: python3 tests/mwrap/check_installed_template.py --mcpp "$MCPP" --package mcpplibs.mwrap.boost --deploy + - name: Installed zstd wrapper archive, actual default compression template and its relocated notices if: contains(format(' {0} ', env.MEMBERS), ' zstd-squeeze ') && matrix.toolchain == 'default' shell: bash diff --git a/mcpp.toml b/mcpp.toml index 6833614f..f4869bd0 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -63,6 +63,7 @@ members = [ "tests/mwrap/godot-sdk", "tests/mwrap/onnxruntime-sdk", "tests/mwrap/mbedtls-hashes", + "tests/mwrap/boost-libs", "tests/examples/abseil", "tests/examples/archive", "tests/examples/argparse", diff --git a/pkgs/mwrap/boost.lua b/pkgs/mwrap/boost.lua new file mode 100644 index 00000000..e168b935 --- /dev/null +++ b/pkgs/mwrap/boost.lua @@ -0,0 +1,43 @@ +-- Immutable upstream-aligned mwrap source release (boost-m mwrap-1.92.0). +-- GLOBAL only: the CN mirror is a later step; the plain string form is what the +-- lint allows until then (docs/cn-mirror.md). +-- +-- The wrapper is Apache-2.0; the Boost 1.92.0 tree it vendors is under BSL-1.0 +-- and compiled into the consumer: the package deploys the notices of both, and +-- of the wrapper it continues (ZheFeng7110.boost), beside programs +-- (runtime.deploy). That earlier identity stays as published. +package = { + spec = "1", + namespace = "mcpplibs.mwrap", + name = "boost", + description = "boost-m: Boost 1.92.0 as C++23 named modules (import mcpplibs.mwrap.boost.), API spelling unchanged", + licenses = { "Apache-2.0" }, + repo = "https://github.com/mcpplibs/boost-m", + type = "package", + extensions = { + autoupdate = { + tag = "mwrap-${version}", + url = "https://github.com/mcpplibs/boost-m/releases/download/${tag}/boost-m-${version}.tar.gz", + }, + }, + xpm = { + linux = { + ["1.92.0"] = { + url = "https://github.com/mcpplibs/boost-m/releases/download/mwrap-1.92.0/boost-m-1.92.0.tar.gz", + sha256 = "02c09eff17ef18ad911194a305d19421c2795335c9333ed936233324a9a0f2d0", + }, + }, + macosx = { + ["1.92.0"] = { + url = "https://github.com/mcpplibs/boost-m/releases/download/mwrap-1.92.0/boost-m-1.92.0.tar.gz", + sha256 = "02c09eff17ef18ad911194a305d19421c2795335c9333ed936233324a9a0f2d0", + }, + }, + windows = { + ["1.92.0"] = { + url = "https://github.com/mcpplibs/boost-m/releases/download/mwrap-1.92.0/boost-m-1.92.0.tar.gz", + sha256 = "02c09eff17ef18ad911194a305d19421c2795335c9333ed936233324a9a0f2d0", + }, + }, + }, +} diff --git a/tests/mwrap/boost-libs/mcpp.toml b/tests/mwrap/boost-libs/mcpp.toml new file mode 100644 index 00000000..b4adda8a --- /dev/null +++ b/tests/mwrap/boost-libs/mcpp.toml @@ -0,0 +1,8 @@ +[package] +name = "boost-libs" +version = "1.92.0" +description = "Consume the immutable Boost wrapper: header-only Optional, compiled JSON and Filesystem with their exceptions, the version constants, the side header beside the import" + +# A selection, not the package's 51-library default closure. +[dependencies] +mcpplibs.mwrap.boost = { version = "1.92.0", default-features = false, features = ["optional", "json", "filesystem", "version"] } diff --git a/tests/mwrap/boost-libs/tests/behavior.cpp b/tests/mwrap/boost-libs/tests/behavior.cpp new file mode 100644 index 00000000..95f58f54 --- /dev/null +++ b/tests/mwrap/boost-libs/tests/behavior.cpp @@ -0,0 +1,38 @@ +// The installed Boost wrapper through single modules: a header-only library, +// two compiled ones, and an exception of each kind caught by its type. +import std; +import mcpplibs.mwrap.boost.optional; +import mcpplibs.mwrap.boost.json; +import mcpplibs.mwrap.boost.filesystem; +import mcpplibs.mwrap.boost.version; + +namespace macros = mcpplibs::mwrap::boost::macros; +static_assert(macros::BOOST_VERSION == 109200); + +int main() { + if (std::string_view(macros::BOOST_LIB_VERSION) != "1_92") return 1; + + boost::optional value; + if (value || value.value_or(7) != 7) return 2; + bool caught = false; + try { (void)value.value(); } catch (const boost::bad_optional_access&) { caught = true; } + if (!caught) return 3; + value = 42; + if (*value != 42) return 4; + + const auto parsed = boost::json::parse(R"({"name":"boost","parts":[1,2,3]})"); + const auto& object = parsed.as_object(); + if (object.at("name").as_string() != "boost") return 5; + if (object.at("parts").as_array().size() != 3) return 6; + if (boost::json::parse(boost::json::serialize(parsed)) != parsed) return 7; + + const boost::filesystem::path path("a/b/file.txt"); + if (path.filename() != "file.txt" || path.extension() != ".txt") return 8; + caught = false; + try { + (void)boost::filesystem::file_size("no-such-directory/no-such-file"); + } catch (const boost::filesystem::filesystem_error&) { caught = true; } + if (!caught) return 9; + std::println("boost {}: optional, json, filesystem", macros::BOOST_LIB_VERSION); + return 0; +} diff --git a/tests/mwrap/boost-libs/tests/side_header.cpp b/tests/mwrap/boost-libs/tests/side_header.cpp new file mode 100644 index 00000000..39ad0856 --- /dev/null +++ b/tests/mwrap/boost-libs/tests/side_header.cpp @@ -0,0 +1,18 @@ +// Raw macros come from the side header, included before the first import; the +// umbrella re-exports the selected modules. +#include +#if BOOST_VERSION != 109200 +#error "the side header does not provide Boost 1.92.0's BOOST_VERSION" +#endif +#define BOOST_LIBS_TEXT BOOST_LIB_VERSION "!" +constexpr int raw_version = BOOST_VERSION; +#undef BOOST_VERSION +import std; +import mcpplibs.mwrap.boost; + +int main() { + if (mcpplibs::mwrap::boost::macros::BOOST_VERSION != raw_version) return 1; + if (std::string_view(BOOST_LIBS_TEXT) != "1_92!") return 2; + const boost::optional value{boost::json::parse("[1]")}; + return value && value->as_array().size() == 1 ? 0 : 3; +} diff --git a/tests/mwrap/check_installed_template.py b/tests/mwrap/check_installed_template.py index f68b8d1d..4897e472 100644 --- a/tests/mwrap/check_installed_template.py +++ b/tests/mwrap/check_installed_template.py @@ -506,6 +506,27 @@ def main(): assert b"Apache License" in (roots[0] / "LICENSE").read_bytes() assert b"mcpp-community" in (roots[0] / "NOTICE").read_bytes() print(f"Verified {len(declared)} byte-identical wrapper/SDL license files", flush=True) + elif identity == "mcpplibs.mwrap.boost": + # Boost (BSL-1.0) is vendored and compiled into the program. Three + # components have notices, each in its own directory: the wrapper, + # Boost, and the wrapper this one continues. + sources = [path for store in (home / "xpkgs", home / "registry/data/xpkgs") + for path in store.glob(f"mcpplibs.mwrap-x-boost/{version}/*/src/boost.cppm")] + assert len(sources) == 1, sources + source = sources[0].parent.parent + declared = tomllib.loads((source / "mcpp.toml").read_text(encoding="utf-8"))["runtime"]["deploy"] + roots = list(relocated.rglob("licenses/boost")) + assert len(roots) == 1, f"Missing Boost runtime license tree: {roots}" + for entry in declared: + notice = source / entry["from"] + copied = roots[0].parent.parent / entry["to"] / notice.name + assert copied.is_file() and copied.read_bytes() == notice.read_bytes(), copied + for component in ("boost/LICENSE_1_0.txt", "boost-module/LICENSE"): + assert b"Boost Software License" in (roots[0] / "upstream" / component).read_bytes(), component + assert b"Apache License" in (roots[0] / "wrapper/LICENSE").read_bytes() + notice = (roots[0] / "wrapper/NOTICE").read_bytes() + assert b"mcpp-community" in notice and b"Boost Software License" in notice + print(f"Verified {len(declared)} byte-identical wrapper/Boost license files", flush=True) elif identity in STATIC_NOTICES: # A statically linked library whose notices the package # deploys beside the wrapper's (libc-m: the wrapper's only).