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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
> 本文件追踪 `mcpp-community/mcpp` 公开仓的版本演进。
> 格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。

## [0.0.40] — 2026-06-01

### 修复

- 修复 project-local index 包的 xpm hook 工具依赖无法解析官方 `xim`
索引的问题。项目级 xlings 配置现在会在 custom/local index 旁边显式暴露
官方 `xim` 索引,让 `xim:python` 等 hook 工具依赖可用。

## [0.0.39] — 2026-06-01

### 修复
Expand Down
2 changes: 1 addition & 1 deletion mcpp.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mcpp"
version = "0.0.39"
version = "0.0.40"
description = "Modern C++ build & package management tool"
license = "Apache-2.0"
authors = ["mcpp-community"]
Expand Down
17 changes: 15 additions & 2 deletions src/config.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -674,10 +674,24 @@ bool ensure_project_index_dir(
customRepos.emplace_back(name, spec.url);
}

auto officialIndex = cfg.xlingsHome() / "data" / "xim-pkgindex";
std::error_code ec;
if (!customRepos.empty() && std::filesystem::exists(officialIndex / "pkgs", ec)) {
bool hasXim = false;
for (auto const& [name, _] : customRepos) {
if (name == "xim") {
hasXim = true;
break;
}
}
if (!hasXim) {
customRepos.emplace_back("xim", officialIndex.generic_string());
}
}

if (customRepos.empty()) return false; // nothing to do

auto dotMcpp = projectDir / ".mcpp";
std::error_code ec;
std::filesystem::create_directories(dotMcpp, ec);

// Seed .xlings.json with the custom index entries.
Expand Down Expand Up @@ -725,7 +739,6 @@ bool ensure_project_index_dir(
// project data dir. Expose the global official xim index there too, so
// package deps like `xim:python@latest` can resolve without falling back
// to unrelated remote index updates or system tools.
auto officialIndex = cfg.xlingsHome() / "data" / "xim-pkgindex";
if (std::filesystem::exists(officialIndex / "pkgs", ec)) {
auto projectData = dotMcpp / ".xlings" / "data";
auto projectOfficial = projectData / "xim-pkgindex";
Expand Down
2 changes: 1 addition & 1 deletion src/toolchain/fingerprint.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import mcpp.toolchain.detect;

export namespace mcpp::toolchain {

inline constexpr std::string_view MCPP_VERSION = "0.0.39";
inline constexpr std::string_view MCPP_VERSION = "0.0.40";

struct FingerprintInputs {
Toolchain toolchain;
Expand Down
20 changes: 20 additions & 0 deletions tests/e2e/52_local_path_namespaced_index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@ FAKE_REGISTRY="$TMP/fake-registry"
FAKE_LOG="$TMP/fake-xlings.log"
FAKE_DIRECT_LOG="$TMP/fake-xlings-direct.log"
mkdir -p "$FAKE_REGISTRY/data"
mkdir -p "$FAKE_REGISTRY/data/xim-pkgindex/pkgs/p"
cat > "$FAKE_REGISTRY/data/xim-pkgindex/pkgs/p/python.lua" <<'EOF'
package = {
spec = "1",
name = "python",
xpm = {
linux = {
["3"] = {
url = "https://example.invalid/python.tar.gz",
sha256 = "0000000000000000000000000000000000000000000000000000000000000000",
},
},
},
}
EOF
if [[ -d "$USER_MCPP/registry/data/xpkgs" ]]; then
ln -s "$USER_MCPP/registry/data/xpkgs" "$FAKE_REGISTRY/data/xpkgs"
fi
Expand Down Expand Up @@ -121,6 +136,11 @@ fi

if [[ "${1:-}" == "install" ]]; then
printf '%s\n' "$*" > "${FAKE_XLINGS_DIRECT_LOG:?}"
if ! grep -q '"name": "xim"' "${XLINGS_PROJECT_DIR:?}/.xlings.json"; then
echo "missing official xim index in project .xlings.json" >&2
cat "${XLINGS_PROJECT_DIR:?}/.xlings.json" >&2 2>/dev/null || true
exit 24
fi
if [[ ! -d "${XLINGS_PROJECT_DIR:?}/.xlings/data/compat/pkgs" \
&& ! -d "${XLINGS_PROJECT_DIR:?}/data/compat/pkgs" ]]; then
echo "missing project local path index link" >&2
Expand Down
Loading