Commit d2c6e2e
feat(spm): header-map + recursive HSP emulation, robust pod-ipc parse, fail-closed on mixed-language
Four scaffolder fixes, each unblocking a real community library:
1. Header-map emulation (read-podspec + scaffold) — CocoaPods USE_HEADERMAP
lets `#import "Flat.h"` resolve a header anywhere in the target. SPM has no
header map, so flat-include libs (react-native-svg) failed with "X.h not
found". We now add every header-containing subdir to HEADER_SEARCH_PATHS.
2. Recursive + multi-path HEADER_SEARCH_PATHS parsing — a single
pod_target_xcconfig HSP value can hold several space-separated, individually
quoted paths, some ending in `/**` (recursive). We shell-tokenize the value,
strip quotes per token, and expand a `/**` marker into the base dir plus all
its subdirs (skia needs cpp, cpp/skia, … on the search path).
3. Robust pod-ipc JSON extraction — some podspecs print diagnostics to stdout
before the JSON (skia: `-- SK_GRAPHITE: OFF …`), so JSON.parse(stdout) threw
and we silently fell back to the regex parser (partial: true → HSP dropped).
We now slice from the first `{` to the last `}` before parsing.
4. Fail-closed on mixed-language deps — SPM can't compile Swift + ObjC/C++ in
one target, and bidirectional-interop RN libs (react-native-screens) can't be
split into two targets without a circular dependency. Instead of emitting a
manifest that dies with a cryptic SPM resolve error, the scaffolder now skips
(status: skipped-mixed-language, removing any stale manifest) and the
autolinker reports a distinct, actionable error with an opt-out
(react-native.config.js platforms: { ios: null }) and a binary alternative.
Verified end-to-end against a real RN 0.87 app: react-native-skia and
react-native-svg now build via the scaffolder; react-native-screens reports the
clean fail-closed error. SCAFFOLDER_VERSION bumped to 16 to force regen.
399 spm tests green (8 new).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent e477fe8 commit d2c6e2e
7 files changed
Lines changed: 355 additions & 29 deletions
File tree
- packages/react-native/scripts/spm
- __tests__
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
872 | 873 | | |
873 | 874 | | |
874 | 875 | | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
875 | 930 | | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
240 | 260 | | |
241 | 261 | | |
242 | 262 | | |
| |||
Lines changed: 70 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
175 | 222 | | |
176 | 223 | | |
177 | 224 | | |
| |||
644 | 691 | | |
645 | 692 | | |
646 | 693 | | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
647 | 717 | | |
648 | 718 | | |
649 | 719 | | |
| |||
Lines changed: 67 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
310 | 360 | | |
311 | 361 | | |
312 | 362 | | |
| |||
316 | 366 | | |
317 | 367 | | |
318 | 368 | | |
319 | | - | |
| 369 | + | |
320 | 370 | | |
321 | | - | |
| 371 | + | |
322 | 372 | | |
323 | 373 | | |
324 | 374 | | |
| |||
336 | 386 | | |
337 | 387 | | |
338 | 388 | | |
339 | | - | |
| 389 | + | |
340 | 390 | | |
341 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
342 | 401 | | |
343 | 402 | | |
344 | 403 | | |
| |||
1188 | 1247 | | |
1189 | 1248 | | |
1190 | 1249 | | |
1191 | | - | |
| 1250 | + | |
1192 | 1251 | | |
1193 | 1252 | | |
1194 | 1253 | | |
| |||
1223 | 1282 | | |
1224 | 1283 | | |
1225 | 1284 | | |
| 1285 | + | |
| 1286 | + | |
1226 | 1287 | | |
1227 | 1288 | | |
1228 | 1289 | | |
1229 | 1290 | | |
| 1291 | + | |
1230 | 1292 | | |
1231 | 1293 | | |
1232 | 1294 | | |
| |||
1551 | 1613 | | |
1552 | 1614 | | |
1553 | 1615 | | |
| 1616 | + | |
1554 | 1617 | | |
1555 | 1618 | | |
1556 | 1619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
127 | 137 | | |
128 | | - | |
| 138 | + | |
129 | 139 | | |
130 | 140 | | |
131 | 141 | | |
| |||
420 | 430 | | |
421 | 431 | | |
422 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
423 | 443 | | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
442 | 460 | | |
443 | 461 | | |
444 | 462 | | |
| |||
0 commit comments