You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f886901
Browse filesBrowse the repository at this point in the historyBrowse files
fix(platform): #254 host and target platform axes become distinct types; xpkg per-OS sections key on the target
mcpp resolves "which platform?" along two axes that coincide only for a
native build: the host (where mcpp runs — correct for toolchain payloads and
other host tools) and the target (where the produced binaries run — correct
for anything compiled INTO the user's build).
Both were std::string_view, so mixing them cost nothing and read identically,
and they had drifted apart: every xpkg per-OS splice and every xpm
version/asset table keyed on `mcpp::platform::xpkg_platform`, a COMPILE-TIME
HOST constant, while `[target.'cfg(...)']` was evaluated against the resolved
target. The same decision, derived two different ways. Cross-compiling
therefore spliced the host's section into a dependency being built for the
target: its per-OS sources, flags, deps and prebuilt asset all came from the
wrong leg. Native builds cannot observe this, which is why three-platform CI
never caught it.
Introduces mcpp.platform.axis: HostPlatform and TargetPlatform, with no
conversion between them and no constructor from a bare string. APIs take the
common PlatformKey base, so a function states which axis it accepts and a
call site must NAME the axis it supplies. `synthesize_from_xpkg_lua`'s
platform parameter loses its host default and becomes required — a silent
default is precisely how this bug survived. The triple-vs-xpkg vocabulary
translation ("macos" vs "macosx") moves into TargetPlatform::for_os so no
call site has to remember it.
The type change and the behaviour fix land together because they are the
same edit: once the parameter is required, every call site must decide, and
those decisions ARE the fix. Classified per site:
prepare.cppm dep manifest synthesis (3), pm/resolver version+asset
selection -> TARGET; these are code compiled into the user's build.
toolchain/lifecycle version listing -> HOST; a toolchain payload runs on
this machine. Its existing comment already said so.
cmd_xpkg --all-os -> for_lint_of(); neither axis, and named awkwardly on
purpose so that reads as deliberate at the call site.
scaffold `mcpp add` and the legacy resolver overloads -> HOST, stated
explicitly rather than inherited from a default.
Tests: static_asserts that the axes are mutually inconvertible and neither is
constructible from a string; per-OS splice selects each target's own section
and none of the others; and a native-build guard asserting host == target
produces an identical splice, which is the safety net for every existing
platform's behaviour.
0 commit comments