Skip to content

Commit 975258f

Browse files
committed
refactor: rename default index from "mcpp-index" to "mcpplibs"
Align the default index name with kDefaultNamespace ("mcpplibs") so that the canonical install directory path <ns>-x-<ns>.<short> and the fallback path <indexName>-x-<fqname> naturally unify when the default namespace is used. Also fix a hardcoded "mcpp-index" literal in Fetcher::search() — now uses cfg_.defaultIndex instead.
1 parent ccbe065 commit 975258f

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/bmi_cache.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export namespace mcpp::bmi_cache {
2828
struct CacheKey {
2929
std::filesystem::path mcppHome;
3030
std::string fingerprint;
31-
std::string indexName; // "mcpp-index" / "xim" / ...
31+
std::string indexName; // "mcpplibs" / "xim" / ...
3232
std::string packageName; // "mcpplibs.cmdline"
3333
std::string version; // "0.0.1"
3434

src/cli.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,7 @@ prepare_build(bool print_fingerprint,
20192019
mcpp::lockfile::LockedPackage lp;
20202020
lp.name = name;
20212021
lp.version = spec.version;
2022-
lp.source = std::format("mcpp-index+{}",
2022+
lp.source = std::format("mcpplibs+{}",
20232023
"https://github.com/mcpp-community/mcpp-index.git");
20242024
lp.hash = "sha256:<from-xlings>"; // M3 will populate from install plan
20252025
lock.packages.push_back(std::move(lp));

src/config.cppm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// bin/mcpp mcpp binary (self-contained mode)
66
// registry/ XLINGS_HOME for mcpp's xlings
77
// bin/xlings vendored xlings binary (= <XLINGS_HOME>/bin/xlings)
8-
// .xlings.json seeded with index_repos = [mcpp-index]
8+
// .xlings.json seeded with index_repos = [mcpplibs]
99
// bmi/<fp>/ BMI cache (existing)
1010
// cache/ metadata caches
1111
// config.toml this module's input
@@ -47,7 +47,7 @@ struct GlobalConfig {
4747
std::filesystem::path xlingsHomeOverride; // empty = use registryDir
4848

4949
// From config.toml [index]
50-
std::string defaultIndex; // "mcpp-index"
50+
std::string defaultIndex; // "mcpplibs"
5151
std::vector<IndexRepo> indexRepos;
5252

5353
// From config.toml [cache]
@@ -201,9 +201,9 @@ binary = "bundled"
201201
home = ""
202202
203203
[index]
204-
default = "mcpp-index"
204+
default = "mcpplibs"
205205
206-
[index.repos."mcpp-index"]
206+
[index.repos."mcpplibs"]
207207
url = "https://github.com/mcpp-community/mcpp-index.git"
208208
# xlings auto-adds xim / awesome / scode / d2x as defaults.
209209
@@ -597,7 +597,7 @@ std::expected<GlobalConfig, ConfigError> load_or_init(
597597
cfg.xlingsBinaryMode = doc->get_string("xlings.binary").value_or("bundled");
598598
if (auto h = doc->get_string("xlings.home"); h && !h->empty())
599599
cfg.xlingsHomeOverride = *h;
600-
cfg.defaultIndex = doc->get_string("index.default").value_or("mcpp-index");
600+
cfg.defaultIndex = doc->get_string("index.default").value_or("mcpplibs");
601601
cfg.searchTtlSeconds = doc->get_int("cache.search_ttl_seconds").value_or(3600);
602602
cfg.defaultJobs = doc->get_int("build.default_jobs").value_or(0);
603603
cfg.defaultBackend = doc->get_string("build.default_backend").value_or("ninja");
@@ -613,7 +613,7 @@ std::expected<GlobalConfig, ConfigError> load_or_init(
613613
cfg.indexRepos.push_back({ name, it->second.as_string() });
614614
}
615615
}
616-
// Defaults: only mcpp-index. xlings auto-adds its own standard
616+
// Defaults: only mcpplibs. xlings auto-adds its own standard
617617
// defaults (xim / awesome / scode / d2x) because globalIndexRepos_
618618
// is non-empty (per xlings/src/core/config.cppm). Explicitly listing
619619
// them ourselves can cause cross-index name conflicts during
@@ -623,7 +623,7 @@ std::expected<GlobalConfig, ConfigError> load_or_init(
623623
for (auto& r : cfg.indexRepos) if (r.name == name) return;
624624
cfg.indexRepos.push_back({ std::string(name), std::string(url) });
625625
};
626-
add_default("mcpp-index", "https://github.com/mcpp-community/mcpp-index.git");
626+
add_default("mcpplibs", "https://github.com/mcpp-community/mcpp-index.git");
627627

628628
// 5. Seed registry/.xlings.json if missing
629629
auto xjson = cfg.xlingsHome() / ".xlings.json";

src/pm/dep_spec.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct DependencySpec {
4040
};
4141

4242
// Default namespace for packages declared without an explicit one — the
43-
// mcpp-index "root". Bare `gtest = "1.15.2"` becomes `(mcpp, gtest)`.
43+
// mcpplibs "root". Bare `gtest = "1.15.2"` becomes `(mcpp, gtest)`.
4444
inline constexpr std::string_view kDefaultNamespace = "mcpplibs";
4545

4646
} // namespace mcpp::pm

src/pm/lock_io.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export namespace mcpp::pm {
1818
struct LockedPackage {
1919
std::string name;
2020
std::string version;
21-
std::string source; // e.g. "mcpp-index+https://..." (M2 placeholder)
21+
std::string source; // e.g. "mcpplibs+https://..." (M2 placeholder)
2222
std::string hash; // "sha256:..." or "fnv1a:..."
2323
};
2424

src/pm/package_fetcher.cppm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public:
9292
// High-level helpers (parsed payload for common ops).
9393

9494
struct SearchHit {
95-
std::string source; // "mcpp-index"
95+
std::string source; // "mcpplibs"
9696
std::string name;
9797
std::string description;
9898
};
@@ -479,7 +479,7 @@ Fetcher::search(std::string_view keyword) {
479479
}
480480
// record
481481
if (!name.empty()) {
482-
hits.push_back({"mcpp-index", std::move(name), std::move(desc)});
482+
hits.push_back({cfg_.defaultIndex, std::move(name), std::move(desc)});
483483
}
484484
// advance past ]
485485
while (p < items.size() && items[p] != ']') ++p;
@@ -657,7 +657,7 @@ Fetcher::read_xpkg_lua(std::string_view package_name) const
657657
namespace {
658658

659659
struct ParsedTarget {
660-
std::string indexName; // "xim", "mcpp-index", or "" (default)
660+
std::string indexName; // "xim", "mcpplibs", or "" (default)
661661
std::string packageName;
662662
std::string version;
663663
};
@@ -696,7 +696,7 @@ Fetcher::resolve_xpkg_path(std::string_view target,
696696
EventHandler* handler)
697697
{
698698
// Default to xim namespace for tools/toolchain. Modular libs use
699-
// mcpp-index but consumers (cli) typically pass "<idx>:<name>@<ver>"
699+
// mcpplibs but consumers (cli) typically pass "<idx>:<name>@<ver>"
700700
// explicitly anyway.
701701
auto parsed = parse_target(target, "xim");
702702
if (parsed.packageName.empty() || parsed.version.empty()) {
@@ -735,7 +735,7 @@ Fetcher::resolve_xpkg_path(std::string_view target,
735735
}
736736
XpkgPayload payload;
737737
// For xim packages (gcc, cmake, ...) the version dir IS the root.
738-
// For mcpp-index packages the version dir contains an extracted
738+
// For mcpplibs packages the version dir contains an extracted
739739
// tarball subdirectory; we treat the wrapper subdir as the root
740740
// when its content includes bin/ or include/.
741741
std::error_code ec;

0 commit comments

Comments
 (0)