Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .agents/docs/2026-12-01-add-boost-mwrap-plan.md
Original file line number Diff line number Diff line change
@@ -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` 覆盖
`<mwrap/boost/macros.hpp>` 与根模块 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。
5 changes: 5 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
43 changes: 43 additions & 0 deletions pkgs/mwrap/boost.lua
Original file line number Diff line number Diff line change
@@ -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.<lib>), 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",
},
},
},
}
8 changes: 8 additions & 0 deletions tests/mwrap/boost-libs/mcpp.toml
Original file line number Diff line number Diff line change
@@ -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"] }
38 changes: 38 additions & 0 deletions tests/mwrap/boost-libs/tests/behavior.cpp
Original file line number Diff line number Diff line change
@@ -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<int> 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;
}
18 changes: 18 additions & 0 deletions tests/mwrap/boost-libs/tests/side_header.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Raw macros come from the side header, included before the first import; the
// umbrella re-exports the selected modules.
#include <mwrap/boost/macros.hpp>
#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<boost::json::value> value{boost::json::parse("[1]")};
return value && value->as_array().size() == 1 ? 0 : 3;
}
21 changes: 21 additions & 0 deletions tests/mwrap/check_installed_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Loading