Initial branch: codex/imgui-mcpp-dependency-fixes
Follow-up branch: codex/fix-git-dependency-cache-lock
This document tracks the mcpp-side changes discovered while validating the
imgui-private package and its compat.imgui / compat.glfw /
compat.opengl dependency chain. The imgui package work stays outside this
branch; this branch is only for mcpp fixes.
The imgui validation exposed two separate mcpp-side problems.
-
C++ build flags dropped package include dirs.
src/build/flags.cppmbuiltCompileFlags::cxxwith fewer{}format placeholders than arguments. The finalinclude_flagsargument was not emitted into the C++ baseline flags, whileCompileFlags::ccdid include it.Impact: module scanning and C++ compilation for the current package could miss include dirs propagated from direct dependencies. In imgui, this showed up as scanner failures like
imgui.hor backend.cppfiles not found.Why gtest did not prove this path: gtest's existing success path did not exercise the same current-package C++ baseline include propagation shape. It could compile through its own package metadata while imgui needed direct dependency include dirs during current-package module/backend scans.
-
Version dependency lookup reused stale unmarked xpkg directories.
loadVersionDep()accepted an installed path ifinstall_path()found a directory. That bypassed the stricter.mcpp_okinstall marker semantics already used inresolve_xpkg_path().Impact: an old
compat.glfw@3.4sandbox directory with layout3.4/glfw-3.4/includeand3.4/glfw-3.4/srcwas reused even though the current index metadata expectsincludeandsrcat the version root after the install hook. mcpp then skipped GLFW's own source files, linked only imgui and GLFW consumers, and failed with undefinedglfwInit,glfwCreateWindow, etc. -
Git branch dependencies reused stale source clones and wrote misleading lock entries.
prepare_build()cached git dependencies byurl + ref-kind + ref. Forbranch = "main", that cache key stays stable even after the remote branch advances, somcpp update <dep>removed the lock entry but the next build still reused the old clone. The lock writer also treated every non-path dependency as a registry dependency and emittedsource = "index+mcpplibs@"for git dependencies.Impact: a consumer using
imgui = { git = ".../imgui-private.git", branch = "main" }could keep compiling an old cached checkout that only provided the obsoleteimguimodule instead of the currentimgui.coreandimgui.backend.*modules. The lock file also obscured the real dependency source. -
Bare dependency selectors could not fall back to independent root packages.
resolve_dependency_selector("imgui")produced onlymcpplibs/imgui. That missed the intended rule that bare names first try the omittedmcpplibsroot and then fall back to an independent root package.The failure had a second layer: the default-namespace strict lookup uses
imgui.luaas its canonical filename, which is the same descriptor filename used by an independent rootimguipackage. Without checking the xpkg descriptor's declaredpackage.name/package.namespace, the first candidate could consume the independent package asmcpplibs.imgui.
-
src/build/flags.cppm- Fixed the
std::formatplaceholder count forCompileFlags::cxx, soinclude_flagsis emitted for C++ scan/compile rules.
- Fixed the
-
tests/unit/test_ninja_backend.cpp- Added
NinjaBackend.CxxFlagsIncludeBuildIncludeDirsto lock the C++ include propagation behavior.
- Added
-
src/cli.cppm- In version dependency loading, require either
.mcpp_okor a layout that matches the current index entry'smcppmetadata before reusing an existing xpkg directory. - Adopt and mark compatible pre-marker installs; clean stale unmarked directories whose layout no longer matches the index before reinstall.
- Mark the install path complete after a successful version dependency install.
- In version dependency loading, require either
-
tests/e2e/60_stale_xpkg_cache_reinstall.sh- Added a stale-cache regression that creates an old unmarked xpkg layout and verifies mcpp reinstalls it instead of linking against the stale contents.
-
src/cli.cppm- For
branchgit dependencies, resolve the branch to a concrete commit withgit ls-remotebefore creating the cache key. - Include the resolved commit in the git cache key so an advanced branch maps to a fresh cache directory while unchanged branches still reuse the cache.
- Record git dependencies in
mcpp.lockasgit+<url>#branch=<name>@<sha>instead ofindex+....
- For
-
tests/e2e/24_git_dependency.sh- Added a branch dependency regression that verifies
mcpp update <dep>refreshes a moved branch and that lock source metadata is marked as git.
- Added a branch dependency regression that verifies
-
src/pm/dependency_selector.cppm- Bare selectors now produce ordered candidates:
mcpplibs/<name>, then independent root<name>.
- Bare selectors now produce ordered candidates:
-
src/manifest.cppm- Added
extract_xpkg_name()alongsideextract_xpkg_namespace()so resolver code can validate package identity from the xpkg descriptor.
- Added
-
src/cli.cppm- Candidate selection now validates that a matched xpkg descriptor belongs to the candidate coordinate before selecting it.
- Independent root packages keep an empty package namespace in
mcpp.lockinstead of being rewritten asmcpplibs.
-
tests/unit/test_pm_compat.cpp- Added a bare selector regression for
imgui -> mcpplibs/imgui, then imgui.
- Added a bare selector regression for
-
tests/e2e/63_bare_dependency_peer_root_priority.sh- Added a no-network regression that provides only an independent root
imguipackage in a temporary default index and verifiesimgui = "1.0.0"builds/runs without locking the package asmcpplibs.
- Added a no-network regression that provides only an independent root
-
Red test for the include bug:
NinjaBackend.CxxFlagsIncludeBuildIncludeDirsfailed before the flags fix becauseflags.cxxwas-std=c++23 -fmodules -O2without-I....
-
Green unit suite after the flags fix and current resolver change:
- Command:
mcpp test -- --gtest_filter=NinjaBackend.CxxFlagsIncludeBuildIncludeDirs - Result: full mcpp test run completed with
18 passed; 0 failed.
- Command:
-
imgui-private validation after clearing stale
compat.glfw@3.4cache:backend_test ... okimgui_test ... oktest result ok. 2 passed; 0 failed
-
Red e2e for stale-cache behavior before the resolver fix:
tests/e2e/60_stale_xpkg_cache_reinstall.shfailed withundefined reference to stale_value, proving the stale dependency sources were not linked.
-
Green e2e after rebuilding the mcpp CLI with the resolver fix:
- Command:
MCPP=<mcpp-bin> bash tests/e2e/60_stale_xpkg_cache_reinstall.sh - Result:
OK
- Command:
-
Boundary regression caught and fixed:
tests/e2e/52_local_path_namespaced_index.shinitially failed after a marker-only implementation because it intentionally pre-populates a compatible project-local xpkg layout without.mcpp_ok.- The resolver now adopts an unmarked directory only when the current index's
mcppmetadata can resolve the package source/manifest from that root.
-
Latest focused verification with rebuilt CLI:
mcpp test:18 passed; 0 failedtests/e2e/52_local_path_namespaced_index.sh:OKtests/e2e/54_package_owned_ldflags.sh:OKtests/e2e/55_dependency_shared_artifact.sh:OKtests/e2e/56_transitive_shared_artifact.sh:OKtests/e2e/57_static_dep_shared_artifact.sh:OKtests/e2e/60_stale_xpkg_cache_reinstall.sh:OK
-
Red e2e for git dependency lock/cache behavior before the fix:
- Command:
MCPP=$(command -v mcpp) bash tests/e2e/24_git_dependency.sh - Result: failed with
FAIL: git dep lock source is not marked as gitand a lock entry containingsource = "index+mcpplibs@".
- Command:
-
Green e2e after rebuilding the mcpp CLI with the git dependency fix:
- Command:
MCPP=<mcpp-bin> bash tests/e2e/24_git_dependency.sh - Result:
OK
- Command:
-
Focused regression after the final git dependency change:
mcpp test:18 passed; 0 failedtests/e2e/23_remove_update.sh:OKtests/e2e/24_git_dependency.sh:OKtests/e2e/62_dotted_dependency_selector_priority.sh:OK
-
Red unit test for bare selector fallback before the fix:
DependencySelector.BareSelectorBuildsOmittedMcpplibsThenPeerRootCandidatesfailed becauseselector.candidates.size()was1, expected2.
-
Green focused verification after the bare selector and candidate identity fix:
mcpp test -- --gtest_filter=DependencySelector.BareSelectorBuildsOmittedMcpplibsThenPeerRootCandidates:18 passed; 0 failedtests/e2e/62_dotted_dependency_selector_priority.sh:OKtests/e2e/63_bare_dependency_peer_root_priority.sh:OK
-
Full local verification after the final edits:
mcpp test:18 passed; 0 failedtests/e2e/run_all.sh:67 passed, 0 failed, 0 skippedtests/e2e/62_dotted_dependency_selector_priority.sh:OKtests/e2e/63_bare_dependency_peer_root_priority.sh:OK
-
External mcpp-index imgui smoke with the rebuilt mcpp CLI:
- Command shape:
MCPP=<mcpp-bin> bash tests/smoke_imgui_module.sh - Result:
Dear ImGui 1.92.8 module package ok - Observed install target:
mcpplibs:imgui@0.0.1, meaning default index packageimgui; notmcpplibs.imgui.
- Command shape:
-
Fresh external
imgui-privategit consumer with rebuilt mcpp CLI:- Command:
MCPP_HOME=<tmp-home> <mcpp-bin> run - Result:
external git consumer imported Dear ImGui 1.92.8 - Lock source:
git+git@github.com:mcpplibs/imgui-private.git#branch=main@07ea0c3c088331517e1eda898c267d966173206d
- Command:
-
imgui-privatepackage validation with rebuilt mcpp CLI and existing dependency caches:mcpp clean && mcpp build && mcpp test:backend_test ... ok,imgui_test ... okexamples/basic:Dear ImGui 1.92.8 module frame okexamples/glfw_opengl3: build completed successfully
- Before opening a PR, decide whether to run the full e2e suite or rely on the focused unit/e2e/imgui-private validation plus CI.
- Before opening a PR, decide whether to also run the full e2e suite or leave that to CI after the focused dependency set above.
- The imgui package itself is currently not the blocker after a fresh GLFW install. The observed backend tests pass once the dependency cache layout is corrected.
- The mcpp fixes should be submitted as a separate PR from imgui package/index updates.
- Public
imguipackage identity is independent rootimgui, notmcpplibs.imgui; mcpp's omitted-mcpplibspriority must not rewrite that identity after the fallback candidate is selected.