Commit 810fff4
feat(spm): scaffold ObjC prefix header + read defines from s.xcconfig
Two fixes that, together with the prior scaffolder work, make
react-native-reanimated + react-native-worklets build end-to-end under SPM.
1. ObjC prefix header (replaces CocoaPods' generated prefix.pch). worklets'
ObjC++ sources (IOSUIScheduler.mm, AssertJavaScriptQueue.h) use NSThread /
dispatch_* / UIKit with NO explicit import — they rely on the prefix header
CocoaPods auto-generates for every pod (imports Foundation + UIKit). SPM has
no prefix-header mechanism, so the build failed with "use of undeclared
identifier 'NSThread'". Fix: when a scaffolded target has ObjC(++) sources
(.m/.mm), emit a `react-native-spm-prefix.h` at the dep root and `-include`
it on the target (cSettings + cxxSettings). The `__OBJC__` guard makes it a
no-op for plain C/C++; UIKit is `__has_include`-guarded. `-include` resolves
the bare name via the dep-root header search path (".", ensured in translate).
2. Read defines from `s.xcconfig`, not just `pod_target_xcconfig`. worklets
declares `-DWORKLETS_VERSION` in pod_target_xcconfig; reanimated declares
`-DREANIMATED_VERSION` in `s.xcconfig`. The defines reader only scanned
pod_target_xcconfig, so REANIMATED_VERSION was dropped → "use of undeclared
identifier 'REANIMATED_VERSION_STRING'". Now scans pod_target_xcconfig,
xcconfig, and user_target_xcconfig (deduped).
- SCAFFOLDER_VERSION 12 → 14 (output changed → regenerate existing scaffolds).
- spm-types.js: `needsObjCPrefix` on SpmScaffoldSpec.
- Tests: prefix emission + ObjC-source detection; defines lifted from s.xcconfig.
Verified end-to-end: `xcodebuild` of the ReactNativeReanimated scheme (which
builds worklets too) **BUILD SUCCEEDED** on a real RN 0.87 app — the complete
reanimated/worklets graph compiles and links via SPM. 336 spm tests pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 0caee15 commit 810fff4
5 files changed
Lines changed: 192 additions & 47 deletions
File tree
- packages/react-native/scripts/spm
- __tests__
Lines changed: 26 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 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
240 | 266 | | |
241 | 267 | | |
242 | 268 | | |
| |||
Lines changed: 51 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 | + | |
175 | 206 | | |
176 | 207 | | |
177 | 208 | | |
| |||
350 | 381 | | |
351 | 382 | | |
352 | 383 | | |
| 384 | + | |
353 | 385 | | |
354 | 386 | | |
355 | 387 | | |
| |||
455 | 487 | | |
456 | 488 | | |
457 | 489 | | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
458 | 508 | | |
459 | 509 | | |
460 | 510 | | |
| |||
855 | 905 | | |
856 | 906 | | |
857 | 907 | | |
| 908 | + | |
858 | 909 | | |
859 | 910 | | |
860 | 911 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
474 | 483 | | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
485 | 491 | | |
486 | 492 | | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
513 | 531 | | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | 532 | | |
520 | 533 | | |
521 | 534 | | |
| |||
Lines changed: 57 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
99 | 122 | | |
100 | 123 | | |
101 | 124 | | |
| |||
276 | 299 | | |
277 | 300 | | |
278 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
279 | 311 | | |
280 | 312 | | |
281 | 313 | | |
| |||
325 | 357 | | |
326 | 358 | | |
327 | 359 | | |
| 360 | + | |
328 | 361 | | |
329 | 362 | | |
330 | 363 | | |
| |||
411 | 444 | | |
412 | 445 | | |
413 | 446 | | |
414 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
415 | 454 | | |
416 | | - | |
417 | | - | |
418 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
419 | 461 | | |
420 | 462 | | |
421 | 463 | | |
| |||
768 | 810 | | |
769 | 811 | | |
770 | 812 | | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
771 | 822 | | |
772 | 823 | | |
773 | 824 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
411 | 415 | | |
412 | 416 | | |
413 | 417 | | |
| |||
0 commit comments