docs: how to publish a library to mcpp-index, and the generated= path asymmetry - #354
Merged
Conversation
… asymmetry
Two gaps found by walking the chain end to end for libxpkg 0.0.48.
Publishing a library was undocumented entirely — `mcpp publish` and
`mcpp emit xpkg` appear in the CLI and nowhere in docs/. 09 covers releasing
mcpp itself and 02 covers `mcpp pack`; neither says how a library becomes
something `[dependencies]` can name. The new 10 writes down the chain and,
more usefully, the four places it fails quietly:
* gitcode answers HEAD with 401, so an asset verified with HEAD reads as
broken and one verified by existence alone can still be the wrong bytes —
GET it and cmp it against the GitHub tarball;
* an index entry in one platform block resolves on one platform and fails
on the others as "no such version", which reads like a consumer typo;
* the index is an artifact, so merging to main publishes nothing until
publish-artifact.yml runs, and clients hold a TTL on top of that;
* a seeded local copy of the unreleased version is indistinguishable from a
published one — it is exactly what is still there when the publish failed.
The `generated=` row said "relative to the project root". True for the root
package; a dependency's build.mcpp resolves the same path against
MCPP_OUT_DIR. A library plays both roles, so no relative path is correct in
both: writing to MCPP_OUT_DIR and emitting the bare name fails at the root
with "declared generated source ... does not exist after the run". Documents
the absolute-path form, and that a generated .cppm module interface works —
the examples only showed .cpp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two gaps found by walking the chain end to end while publishing libxpkg 0.0.48 (consumed by openxlings/xlings 2026.8.5.1).
1. Publishing a library was undocumented
mcpp publishandmcpp emit xpkgappear in--helpand nowhere indocs/. 09 covers releasing mcpp itself, 02 coversmcpp packbundling an application — neither says how a library becomes something[dependencies]can name.New 10 - Publishing a Library to mcpp-index writes down the chain (tag → gitcode mirror → index entry → artifact → consumer bump) and, more usefully, the four places it fails quietly:
cmpagainst the GitHub tarball.publish-artifact.ymlruns, and clients hold a TTL on top of that. Hand-editing a cachedpkgs/**does nothing.It also documents the seeding recipe for testing against an unreleased version (the build sandbox is network-isolated, so
file://and127.0.0.1index URLs cannot be fetched), and warns against the registry-pruning one-liner that deletesdata/xpkgs—xpkgssits at depth 2 and is not nameddata, so a careless second pass takes the whole ~800 MB payload store with it.2.
generated=resolves against two different rootsThe directive table said "relative to the project root". That is true for the root package; the dependency section separately says a dependency's
build.mcppresolves the same path againstMCPP_OUT_DIR. Both statements are correct and the combination is a trap: a library plays both roles, so no relative path is right in both.Writing into
MCPP_OUT_DIRand emitting the bare filename works as a dependency and fails at the root with:Documents the form that is correct in both roles (write to
MCPP_OUT_DIR, emitout.string().c_str()—mcpp::out_dir()is always absolute), and adds one line the examples were missing: a generated.cppmmodule interface works, since.cppmgoes through the same scan as any other source.Both files updated in
docs/anddocs/zh/, and both READMEs indexed.