Commit ab1da5d
feat(xlings): provision
* feat(xlings): provision `[xlings] deps` on first build, at global scope
`[xlings] deps` was DECLARED and never installed. `ensure_project_index_dir`
wrote it into `.mcpp/.xlings.json` verbatim and stopped there, so a manifest
saying `deps = ["xim:mesa"]` produced a file naming mesa, no payload anywhere,
and `fatal error: gbm.h: No such file or directory`. The declaration looked
accepted and did nothing, which is the worst shape a config key can have —
`[toolchain]` has had "declare it and mcpp provisions it on first use" all
along ("First run — no toolchain configured … installing … as default"), and a
build environment should not have two grades of declaration.
GLOBAL SCOPE, AND THE SCOPE IS THE WHOLE POINT. The obvious implementation —
`install_packages` against `make_project_xlings_env` — installs at PROJECT
scope, and measurably does not work. On a fresh MCPP_HOME the headers land in
`<proj>/.mcpp/.xlings/subos/_/usr/include` while `--sysroot` names
`<MCPP_HOME>/registry/subos/default`: two SubOS views, payload in the one the
compiler does not read, `#include <gbm.h>` still failing with the dependency
installed and declared. `make_xlings_env` is the global env, so the payload
lands in the registry whose SubOS *is* the sysroot — the same place
`[toolchain]` installs into. That single choice is what removes the need for
any sysroot-layering machinery: a project dep and a toolchain dep now agree on
where they live, so one `--sysroot` sees both.
`install_packages` rather than `resolve_xpkg_path`: the latter requires
`<name>@<version>` and rejects a bare `mesa` (verified: "invalid xpkg target
'xim:mesa': expected `<name>@<version>`"), while a manifest is entitled to name
a package without pinning it. install_packages resolves the version itself and
reports an ambiguous name with its candidates, which is an error the author can
act on.
ORDER IS LOAD-BEARING: provisioning runs BEFORE the runtime binding resolves,
because a named `[xlings] subos` that does not exist yet is a hard error
("selected SubOS '…' does not exist; create/bootstrap that environment") and
provisioning is what creates it. Placed next to the custom-index sync, both
first-use steps sit in one place.
Idempotent by CONTENT, not existence: a stamp records the dep list, so editing
the list re-provisions and an unchanged list costs no xlings round-trip.
Verified — a second `mcpp run` emits no Provisioning line.
VERIFIED end to end on a FRESH MCPP_HOME, with a project that has no
mcpp-index dependency at all:
[xlings]
deps = ["xim:mesa"]
[build]
ldflags = ["-lgbm"]
Provisioning [xlings] deps (xim:mesa)
Compiling nopkg v0.1.0 (.)
Running `target/.../bin/nopkg`
XR24 | GBM_BACKENDS_PATH=<registry>/subos/default/usr/lib/gbm
`#include <gbm.h>` compiles, `-lgbm` links, and the SubOS env declaration
reaches the process — the last of those needs openxlings/xim-pkgindex#713,
which adds GBM_BACKENDS_PATH to the graphics discovery table.
Design: mcpp-index .agents/docs/2026-08-30-gbm-cross-repo-closed-loop-plan.md
* fix(xlings): build the install_packages args with the JSON library
`[xlings] deps` is manifest input and the arguments were assembled by
formatting the strings into a JSON literal, so a dependency name containing a
quote or a backslash would emit malformed JSON. The failure would then surface
as an xlings parse error naming neither the manifest nor the key that caused
it.
nlohmann::json is already imported in this translation unit (mcpp.libs.json),
so this is `args["targets"] = declaredDeps; args["yes"] = true; args.dump()`
and the escaping stops being something a reader has to verify by eye.
No behaviour change for well-formed names, which is every name in practice --
this is about the failure mode of the one that is not.
---------
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>[xlings] deps on first build, at global scope (#531)1 parent 7f14f2c commit ab1da5d
1 file changed
Lines changed: 117 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2994 | 2994 | | |
2995 | 2995 | | |
2996 | 2996 | | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
| 3071 | + | |
| 3072 | + | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
| 3092 | + | |
| 3093 | + | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
2997 | 3114 | | |
2998 | 3115 | | |
2999 | 3116 | | |
| |||
0 commit comments