From 45f056451ff228e3fa2b5c6769a456d0a3cfaded Mon Sep 17 00:00:00 2001 From: Zhe Feng Date: Mon, 21 Sep 2026 22:19:02 +0800 Subject: [PATCH 1/4] Add boost.boost package from https://github.com/ZheFeng7110/boost-module --- mcpp.toml | 1 + pkgs/b/boost.lua | 46 ++++++++++++++++ tests/examples/boost-module/mcpp.toml | 23 ++++++++ .../boost-module/tests/boost_module.cpp | 55 +++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 pkgs/b/boost.lua create mode 100644 tests/examples/boost-module/mcpp.toml create mode 100644 tests/examples/boost-module/tests/boost_module.cpp diff --git a/mcpp.toml b/mcpp.toml index 8b091848..60f54db2 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -18,6 +18,7 @@ members = [ "tests/examples/boost-config", "tests/examples/boost-ext.ut", "tests/examples/boost-family", + "tests/examples/boost-module", "tests/examples/boost-throw-exception", "tests/examples/boost-type-traits", "tests/examples/boost-uuid", diff --git a/pkgs/b/boost.lua b/pkgs/b/boost.lua new file mode 100644 index 00000000..97ab5fd4 --- /dev/null +++ b/pkgs/b/boost.lua @@ -0,0 +1,46 @@ +-- Form A descriptor: boost-module ships its own mcpp.toml at the archive root, +-- and that manifest IS the build. The `mcpp` field therefore points at it +-- rather than inlining a Form B descriptor, because the package needs things an +-- inline descriptor cannot express: a build.mcpp umbrella generator, the +-- vendored Boost source tree (deps/boost/), and the committed generator output +-- under src/gen_exports/. +-- +-- Version naming is upstream's wrapper scheme `bw` (this release is Boost 1.91.0 x modules wrapper 0.0.0). Upstream +-- tags are not bare semver, so the xpm key carries that string verbatim. +-- +-- No mcpp-res mirror is configured yet (no CN access): the plain-string GLOBAL +-- url is the documented fallback for CN consumers until a maintainer creates +-- the mirror. +package = { + spec = "1", + namespace = "boost", + name = "boost", + description = "Boost 1.91.0 as C++23 named modules — import boost.; or the umbrella import boost;", + licenses = {"BSL-1.0"}, + repo = "https://github.com/ZheFeng7110/boost-module", + type = "package", + + xpm = { + linux = { + ["b1.91.0w0.0.0"] = { + url = "https://github.com/ZheFeng7110/boost-module/archive/refs/tags/b1.91.0w0.0.0.tar.gz", + sha256 = "7b6434d67383a8598f41bfd563eabb2be7ee23578cc7a65094ff6926c3d23df7", + }, + }, + macosx = { + ["b1.91.0w0.0.0"] = { + url = "https://github.com/ZheFeng7110/boost-module/archive/refs/tags/b1.91.0w0.0.0.tar.gz", + sha256 = "7b6434d67383a8598f41bfd563eabb2be7ee23578cc7a65094ff6926c3d23df7", + }, + }, + windows = { + ["b1.91.0w0.0.0"] = { + url = "https://github.com/ZheFeng7110/boost-module/archive/refs/tags/b1.91.0w0.0.0.tar.gz", + sha256 = "7b6434d67383a8598f41bfd563eabb2be7ee23578cc7a65094ff6926c3d23df7", + }, + }, + }, + + mcpp = "*/mcpp.toml", +} diff --git a/tests/examples/boost-module/mcpp.toml b/tests/examples/boost-module/mcpp.toml new file mode 100644 index 00000000..7e575ef2 --- /dev/null +++ b/tests/examples/boost-module/mcpp.toml @@ -0,0 +1,23 @@ +# boost.boost C++23-module package test: selective feature consumption of the +# Boost named-modules wrapper — `import boost.optional;` plus the umbrella +# `import boost;`. The package is Form A (upstream ships its own mcpp.toml), so +# this member is also the only place the descriptor's `mcpp = "*/mcpp.toml"` +# default lookup is exercised. +# +# Overrides the workspace-root redirect: root declares `compat`, this member +# needs `boost`. A member-level [indices] REPLACES the inherited table rather +# than merging with it, which keeps this to ONE project index repo — two repos +# pointing at the same tree make every lookup ambiguous. +[indices] +boost = { path = "../../.." } + +[package] +name = "boost-module-tests" +version = "0.1.0" + +# Selective, NOT the package's 49-library default closure: opt out of the +# default set and pick a core sample (header-only optional/type_traits, the +# compiled json, and the version constants). This keeps index CI on the +# validated module surface without building the whole wrapper. +[dependencies.boost] +boost = { version = "b1.91.0w0.0.0", default-features = false, features = ["optional", "type_traits", "json", "version"] } diff --git a/tests/examples/boost-module/tests/boost_module.cpp b/tests/examples/boost-module/tests/boost_module.cpp new file mode 100644 index 00000000..9e2df623 --- /dev/null +++ b/tests/examples/boost-module/tests/boost_module.cpp @@ -0,0 +1,55 @@ +// Public boost.boost module-package end-to-end assertion: consume the Boost +// named-modules wrapper by import only (no `#include ` at all). +// +// * `import boost.optional;` — a classic header-only library +// * `import boost.json;` — a compiled library (library TU linked in) +// * `import boost.version;` — the version constants module +// * `import boost;` — the umbrella, re-exporting the active set + +import std; + +import boost.optional; +import boost.json; +import boost.version; +import boost; + +int main() { + int failures = 0; + auto check = [&failures](bool ok, const char* what) { + if (!ok) { + std::println("FAIL: {}", what); + ++failures; + } + }; + + // optional (header-only module) + boost::optional empty; + check(!empty.has_value(), "optional: empty has no value"); + boost::optional v(42); + check(v.has_value() && *v == 42, "optional: value round-trip"); + check(v.value_or(0) == 42, "optional: value_or hits the value"); + empty = 7; + check(empty.value_or(0) == 7, "optional: assignment activates"); + + // json (compiled library) + boost::json::value j = boost::json::parse(R"({"lib":"boost","ok":true})"); + check(j.is_object(), "json: parsed to an object"); + boost::json::object& o = j.as_object(); + check(o["lib"].as_string() == "boost", "json: string member"); + check(o["ok"].as_bool(), "json: bool member"); + const std::string ser = boost::json::serialize(j); + check(boost::json::parse(ser).as_object()["lib"].as_string() == "boost", + "json: serialize/parse round-trip"); + + // version constants + check(boost::BOOST_VERSION == 109100, "version: BOOST_VERSION == 109100"); + check(boost::BOOST_LIB_VERSION[0] == '1', "version: BOOST_LIB_VERSION"); + + // type_traits (reached through the umbrella's active set as well) + check(boost::is_same::value, "type_traits: is_same"); + + if (failures == 0) { + std::println("boost.boost modules ok: BOOST_VERSION={}", boost::BOOST_VERSION); + } + return failures == 0 ? 0 : 1; +} From ec25aa65412ca28ce258fd5fdce54794c4b6e614 Mon Sep 17 00:00:00 2001 From: Zhe Feng Date: Tue, 22 Sep 2026 23:34:50 +0800 Subject: [PATCH 2/4] Change namespace from `boost.boost` to `ZheFeng7110.boost` --- pkgs/{b/boost.lua => z/ZheFeng7110.boost.lua} | 26 +++++++++---------- tests/examples/boost-module/mcpp.toml | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) rename pkgs/{b/boost.lua => z/ZheFeng7110.boost.lua} (60%) diff --git a/pkgs/b/boost.lua b/pkgs/z/ZheFeng7110.boost.lua similarity index 60% rename from pkgs/b/boost.lua rename to pkgs/z/ZheFeng7110.boost.lua index 97ab5fd4..f3465008 100644 --- a/pkgs/b/boost.lua +++ b/pkgs/z/ZheFeng7110.boost.lua @@ -5,16 +5,16 @@ -- vendored Boost source tree (deps/boost/), and the committed generator output -- under src/gen_exports/. -- --- Version naming is upstream's wrapper scheme `bw` (this release is Boost 1.91.0 x modules wrapper 0.0.0). Upstream --- tags are not bare semver, so the xpm key carries that string verbatim. +-- Version naming is upstream's wrapper scheme `v.` (this release is Boost 1.91.0 x modules wrapper 0.1.0). Upstream +-- tags are bare semver, so the xpm key carries that string verbatim. -- -- No mcpp-res mirror is configured yet (no CN access): the plain-string GLOBAL -- url is the documented fallback for CN consumers until a maintainer creates -- the mirror. package = { spec = "1", - namespace = "boost", + namespace = "ZheFeng7110", name = "boost", description = "Boost 1.91.0 as C++23 named modules — import boost.; or the umbrella import boost;", licenses = {"BSL-1.0"}, @@ -23,21 +23,21 @@ package = { xpm = { linux = { - ["b1.91.0w0.0.0"] = { - url = "https://github.com/ZheFeng7110/boost-module/archive/refs/tags/b1.91.0w0.0.0.tar.gz", - sha256 = "7b6434d67383a8598f41bfd563eabb2be7ee23578cc7a65094ff6926c3d23df7", + ["1.91.0.0.1.0"] = { + url = "https://github.com/ZheFeng7110/boost-module/releases/download/v1.91.0.0.1.0/boost-module-v1.91.0.0.1.0.tar.xz", + sha256 = "63a9aae63140f22e518a4ee758332afd5b5037d916731dc9c8339dea1a1e1010", }, }, macosx = { - ["b1.91.0w0.0.0"] = { - url = "https://github.com/ZheFeng7110/boost-module/archive/refs/tags/b1.91.0w0.0.0.tar.gz", - sha256 = "7b6434d67383a8598f41bfd563eabb2be7ee23578cc7a65094ff6926c3d23df7", + ["1.91.0.0.1.0"] = { + url = "https://github.com/ZheFeng7110/boost-module/releases/download/v1.91.0.0.1.0/boost-module-v1.91.0.0.1.0.tar.xz", + sha256 = "63a9aae63140f22e518a4ee758332afd5b5037d916731dc9c8339dea1a1e1010", }, }, windows = { - ["b1.91.0w0.0.0"] = { - url = "https://github.com/ZheFeng7110/boost-module/archive/refs/tags/b1.91.0w0.0.0.tar.gz", - sha256 = "7b6434d67383a8598f41bfd563eabb2be7ee23578cc7a65094ff6926c3d23df7", + ["1.91.0.0.1.0"] = { + url = "https://github.com/ZheFeng7110/boost-module/releases/download/v1.91.0.0.1.0/boost-module-v1.91.0.0.1.0.tar.xz", + sha256 = "63a9aae63140f22e518a4ee758332afd5b5037d916731dc9c8339dea1a1e1010", }, }, }, diff --git a/tests/examples/boost-module/mcpp.toml b/tests/examples/boost-module/mcpp.toml index 7e575ef2..be36a169 100644 --- a/tests/examples/boost-module/mcpp.toml +++ b/tests/examples/boost-module/mcpp.toml @@ -20,4 +20,4 @@ version = "0.1.0" # compiled json, and the version constants). This keeps index CI on the # validated module surface without building the whole wrapper. [dependencies.boost] -boost = { version = "b1.91.0w0.0.0", default-features = false, features = ["optional", "type_traits", "json", "version"] } +boost = { version = "1.91.0.0.1.0", default-features = false, features = ["optional", "type_traits", "json", "version"] } From 91d6f6d1f25e1dceb85cb678ed06bae11c820cfa Mon Sep 17 00:00:00 2001 From: Zhe Feng Date: Tue, 22 Sep 2026 23:38:48 +0800 Subject: [PATCH 3/4] Fix the namespace for test --- tests/examples/boost-module/mcpp.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/examples/boost-module/mcpp.toml b/tests/examples/boost-module/mcpp.toml index be36a169..1806478c 100644 --- a/tests/examples/boost-module/mcpp.toml +++ b/tests/examples/boost-module/mcpp.toml @@ -19,5 +19,5 @@ version = "0.1.0" # default set and pick a core sample (header-only optional/type_traits, the # compiled json, and the version constants). This keeps index CI on the # validated module surface without building the whole wrapper. -[dependencies.boost] +[dependencies.ZheFeng7110] boost = { version = "1.91.0.0.1.0", default-features = false, features = ["optional", "type_traits", "json", "version"] } From 6219f4ef378d478d07f542e3f8bfe814cb346378 Mon Sep 17 00:00:00 2001 From: Zhe Feng Date: Wed, 23 Sep 2026 00:02:02 +0800 Subject: [PATCH 4/4] Fix boost-module index redirect namespace The [indices] table is keyed by namespace, but the member still declared it as `boost` while the dependency moved to namespace `ZheFeng7110`. Registration missed and resolution fell through to the published index: error: dependency 'ZheFeng7110.boost': no package found for exact selector Key the redirect by the dependency's namespace so the checkout's pkgs/z/ZheFeng7110.boost.lua is what gets tested. --- tests/examples/boost-module/mcpp.toml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/examples/boost-module/mcpp.toml b/tests/examples/boost-module/mcpp.toml index 1806478c..2d4def77 100644 --- a/tests/examples/boost-module/mcpp.toml +++ b/tests/examples/boost-module/mcpp.toml @@ -5,11 +5,13 @@ # default lookup is exercised. # # Overrides the workspace-root redirect: root declares `compat`, this member -# needs `boost`. A member-level [indices] REPLACES the inherited table rather -# than merging with it, which keeps this to ONE project index repo — two repos -# pointing at the same tree make every lookup ambiguous. +# needs `ZheFeng7110`. The table is keyed by NAMESPACE, so the key must be the +# dependency's namespace (`ZheFeng7110`), not the package name (`boost`). A +# member-level [indices] REPLACES the inherited table rather than merging with +# it, which keeps this to ONE project index repo — two repos pointing at the +# same tree make every lookup ambiguous. [indices] -boost = { path = "../../.." } +ZheFeng7110 = { path = "../../.." } [package] name = "boost-module-tests"