Commit f0d2f19
committed
feat(build): root build.mcpp runs after dep resolution and receives MCPP_DEP_*_DIR
Design §3.1 item 4 (+ #230-#243 ledger follow-up): the ROOT project's
build.mcpp used to run BEFORE dependency resolution (prepare.cppm ~1180), so
unlike a dependency's it never saw MCPP_DEP_<NAME>_DIR — consumer-side
synthesis (ffmpeg-m reading compat.ffmpeg's payload tree) was impossible.
The call now sits right after the dep build.mcpp loop / usage fixpoint /
capability binding, BEFORE the [targets.*] gate and the modgraph scan, and
populates env.depDirs from the SAME authoritative dependencyEdges graph as
the dep path (consumer index 0 = root; canonical + namespace-stripped
spellings; same collision guard in contract_env).
Ordering invariants, each verified at the new call point:
(1) generated=/source= registration precedes the modgraph scan — the scan
walks packages[0].manifest, so the new-source TAILS are mirrored into
packages[0].manifest.{buildConfig.sources,modules.sources} (see wrinkle
below); the scan call sits ~200 lines further down.
(2) directive flags precede canonicalization/fingerprint — fpi.compileFlags
= canonical_compile_flags(*m) + canonical_package_build_metadata(packages)
is computed AFTER the scan, i.e. after this call; flag tails are mirrored
into packages[0].privateBuild (per-TU assembly) AND
packages[0].manifest.buildConfig (fingerprint metadata parity).
(3) materialize_generated_files (root) still runs earlier — untouched at its
pre-move position, so [generated_files] may still produce build.mcpp.
(4) L1 cfg-conditional merge ordering unchanged — it still runs before
makePackageRoot; ONLY the build.mcpp call moved later (e2e 108 green).
(5) root features env — recomputed with the byte-identical expression
(feature_closure(*m, parse_feature_request(overrides.features))) so the
contract hash / build.mcpp cache is stable across the move.
The wrinkle the old ordering hid: apply() used to mutate *m before
`packages[0] = makePackageRoot(*root, *m)` snapshotted buildConfig into
privateBuild/manifest — the copies the scan and per-TU flag assembly read.
Post-move the snapshot (and root feature activation on it) already happened,
so the directive tails are mirrored explicitly, dep-loop style: sources →
manifest.buildConfig.sources + manifest.modules.sources; c/cxx flags →
privateBuild + manifest.buildConfig; ldflags → linkUsage +
manifest.buildConfig (final link reads *m, already applied); include-dir →
privateBuild.includeDirs ONLY (private discipline — under the old order they
also leaked into root publicUsage via the snapshot, harmless with no
consumers but now deliberately private); include-dir-after →
manifest.buildConfig.includeDirsAfter. Known benign delta: directive flags
now append AFTER feature/usage-propagated flags in privateBuild instead of
before them (order within one flags vector).
e2e 145_root_build_mcpp_dep_dirs.sh (modeled on 125): root with a path dep;
the ROOT's build.mcpp hard-fails unless dep_dir("datad") is set, generates a
source returning it; asserts the dir exists and is datad's root.
Docs: MCPP_DEP_<NAME>_DIR documented in the env table (en/zh) — previously
undocumented — with the root now receiving it.
Verified: unit 35/35; e2e 145/110/111/112/125/143/144 green + regression
batch 106/107/108/109/114/100/04/09/15/126/128 green.1 parent c8bc6af commit f0d2f19
4 files changed
Lines changed: 191 additions & 31 deletions
File tree
- docs
- zh
- src/build
- tests/e2e
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1129 | 1129 | | |
1130 | 1130 | | |
1131 | 1131 | | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
1142 | 1145 | | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
1146 | 1150 | | |
1147 | 1151 | | |
1148 | 1152 | | |
| |||
1204 | 1208 | | |
1205 | 1209 | | |
1206 | 1210 | | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
1222 | 1211 | | |
1223 | 1212 | | |
1224 | 1213 | | |
| |||
3051 | 3040 | | |
3052 | 3041 | | |
3053 | 3042 | | |
3054 | | - | |
3055 | | - | |
3056 | | - | |
| 3043 | + | |
| 3044 | + | |
3057 | 3045 | | |
3058 | 3046 | | |
3059 | 3047 | | |
| |||
3176 | 3164 | | |
3177 | 3165 | | |
3178 | 3166 | | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
3179 | 3257 | | |
3180 | 3258 | | |
3181 | 3259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
0 commit comments