Skip to content

Commit 52b8cdc

Browse files
authored
Add boost-module package from https://github.com/ZheFeng7110/boost-module (#462)
* Add boost.boost package from https://github.com/ZheFeng7110/boost-module * Change namespace from `boost.boost` to `ZheFeng7110.boost` * Fix the namespace for test * 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.
1 parent 049ac18 commit 52b8cdc

4 files changed

Lines changed: 127 additions & 0 deletions

File tree

‎mcpp.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ members = [
1818
"tests/examples/boost-config",
1919
"tests/examples/boost-ext.ut",
2020
"tests/examples/boost-family",
21+
"tests/examples/boost-module",
2122
"tests/examples/boost-throw-exception",
2223
"tests/examples/boost-type-traits",
2324
"tests/examples/boost-uuid",

‎pkgs/z/ZheFeng7110.boost.lua‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
-- Form A descriptor: boost-module ships its own mcpp.toml at the archive root,
2+
-- and that manifest IS the build. The `mcpp` field therefore points at it
3+
-- rather than inlining a Form B descriptor, because the package needs things an
4+
-- inline descriptor cannot express: a build.mcpp umbrella generator, the
5+
-- vendored Boost source tree (deps/boost/), and the committed generator output
6+
-- under src/gen_exports/.
7+
--
8+
-- Version naming is upstream's wrapper scheme `v<boost version>.<wrapper
9+
-- version>` (this release is Boost 1.91.0 x modules wrapper 0.1.0). Upstream
10+
-- tags are bare semver, so the xpm key carries that string verbatim.
11+
--
12+
-- No mcpp-res mirror is configured yet (no CN access): the plain-string GLOBAL
13+
-- url is the documented fallback for CN consumers until a maintainer creates
14+
-- the mirror.
15+
package = {
16+
spec = "1",
17+
namespace = "ZheFeng7110",
18+
name = "boost",
19+
description = "Boost 1.91.0 as C++23 named modules — import boost.<lib>; or the umbrella import boost;",
20+
licenses = {"BSL-1.0"},
21+
repo = "https://github.com/ZheFeng7110/boost-module",
22+
type = "package",
23+
24+
xpm = {
25+
linux = {
26+
["1.91.0.0.1.0"] = {
27+
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",
28+
sha256 = "63a9aae63140f22e518a4ee758332afd5b5037d916731dc9c8339dea1a1e1010",
29+
},
30+
},
31+
macosx = {
32+
["1.91.0.0.1.0"] = {
33+
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",
34+
sha256 = "63a9aae63140f22e518a4ee758332afd5b5037d916731dc9c8339dea1a1e1010",
35+
},
36+
},
37+
windows = {
38+
["1.91.0.0.1.0"] = {
39+
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",
40+
sha256 = "63a9aae63140f22e518a4ee758332afd5b5037d916731dc9c8339dea1a1e1010",
41+
},
42+
},
43+
},
44+
45+
mcpp = "*/mcpp.toml",
46+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# boost.boost C++23-module package test: selective feature consumption of the
2+
# Boost named-modules wrapper — `import boost.optional;` plus the umbrella
3+
# `import boost;`. The package is Form A (upstream ships its own mcpp.toml), so
4+
# this member is also the only place the descriptor's `mcpp = "*/mcpp.toml"`
5+
# default lookup is exercised.
6+
#
7+
# Overrides the workspace-root redirect: root declares `compat`, this member
8+
# needs `ZheFeng7110`. The table is keyed by NAMESPACE, so the key must be the
9+
# dependency's namespace (`ZheFeng7110`), not the package name (`boost`). A
10+
# member-level [indices] REPLACES the inherited table rather than merging with
11+
# it, which keeps this to ONE project index repo — two repos pointing at the
12+
# same tree make every lookup ambiguous.
13+
[indices]
14+
ZheFeng7110 = { path = "../../.." }
15+
16+
[package]
17+
name = "boost-module-tests"
18+
version = "0.1.0"
19+
20+
# Selective, NOT the package's 49-library default closure: opt out of the
21+
# default set and pick a core sample (header-only optional/type_traits, the
22+
# compiled json, and the version constants). This keeps index CI on the
23+
# validated module surface without building the whole wrapper.
24+
[dependencies.ZheFeng7110]
25+
boost = { version = "1.91.0.0.1.0", default-features = false, features = ["optional", "type_traits", "json", "version"] }
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Public boost.boost module-package end-to-end assertion: consume the Boost
2+
// named-modules wrapper by import only (no `#include <boost/...>` at all).
3+
//
4+
// * `import boost.optional;` — a classic header-only library
5+
// * `import boost.json;` — a compiled library (library TU linked in)
6+
// * `import boost.version;` — the version constants module
7+
// * `import boost;` — the umbrella, re-exporting the active set
8+
9+
import std;
10+
11+
import boost.optional;
12+
import boost.json;
13+
import boost.version;
14+
import boost;
15+
16+
int main() {
17+
int failures = 0;
18+
auto check = [&failures](bool ok, const char* what) {
19+
if (!ok) {
20+
std::println("FAIL: {}", what);
21+
++failures;
22+
}
23+
};
24+
25+
// optional (header-only module)
26+
boost::optional<int> empty;
27+
check(!empty.has_value(), "optional: empty has no value");
28+
boost::optional<int> v(42);
29+
check(v.has_value() && *v == 42, "optional: value round-trip");
30+
check(v.value_or(0) == 42, "optional: value_or hits the value");
31+
empty = 7;
32+
check(empty.value_or(0) == 7, "optional: assignment activates");
33+
34+
// json (compiled library)
35+
boost::json::value j = boost::json::parse(R"({"lib":"boost","ok":true})");
36+
check(j.is_object(), "json: parsed to an object");
37+
boost::json::object& o = j.as_object();
38+
check(o["lib"].as_string() == "boost", "json: string member");
39+
check(o["ok"].as_bool(), "json: bool member");
40+
const std::string ser = boost::json::serialize(j);
41+
check(boost::json::parse(ser).as_object()["lib"].as_string() == "boost",
42+
"json: serialize/parse round-trip");
43+
44+
// version constants
45+
check(boost::BOOST_VERSION == 109100, "version: BOOST_VERSION == 109100");
46+
check(boost::BOOST_LIB_VERSION[0] == '1', "version: BOOST_LIB_VERSION");
47+
48+
// type_traits (reached through the umbrella's active set as well)
49+
check(boost::is_same<int, int>::value, "type_traits: is_same");
50+
51+
if (failures == 0) {
52+
std::println("boost.boost modules ok: BOOST_VERSION={}", boost::BOOST_VERSION);
53+
}
54+
return failures == 0 ? 0 : 1;
55+
}

0 commit comments

Comments
 (0)