Commit 0caee15
feat(spm): fold Hermes public headers into ReactNativeHeaders
Libraries that use the Hermes C++ API (worklets' WorkletHermesRuntime →
`#include <hermes/hermes.h>`) failed to build under SPM: the Hermes public
headers were never vended. They ARE shipped — the hermes-ios Maven tarball
carries them in `destroot/include/hermes` (46 headers incl. hermes.h) alongside
the framework — but `extractXCFramework` keeps only the `.xcframework` and
discards the rest. So the headers were downloaded and thrown away.
Fix: stop discarding them, and fold the `hermes/` namespace into
ReactNativeHeaders (the headers-only artifact already auto-served as a search
path on every RN-linking target — same place jsi/folly/glog live). This makes
`<hermes/...>` resolve everywhere with zero per-library wiring. Only `hermes/`
is vended — `jsi/` is already provided, so it isn't re-copied (no double-vend).
- download-spm-artifacts.js: on hermes extraction, stage `destroot/include/
hermes` → `<slot>/hermes-headers/hermes`. Self-heal for already-extracted
slots (the fast path skips extraction): backfill from the cached tarball,
downloading only as a last resort. validateArtifactsCache now requires the
staged headers, so an older slot re-runs the (network-free) backfill.
- zero-i-compose.js: buildReactNativeHeadersXcframework takes an optional
hermesHeaders source and folds the `hermes/` namespace in (textual, like
folly — no clang module); ensureZeroILayout locates the staged headers in the
slot and includes their presence in the freshness marker so a slot that gains
them recomposes.
- xcframework.js: note where the prebuild publish path should pass the hermes
include dir when that (gated) pipeline is productionized.
Serves both forms through the single buildReactNativeHeadersXcframework path:
the consumer self-compose (active today) and the eventually-published artifact.
Verified end-to-end: `spm update` on a real app stages the headers from the
cached tarball (no network) and recomposes ReactNativeHeaders with the `hermes`
namespace (Headers/hermes/hermes.h present); the reanimated/worklets build now
compiles past `<hermes/hermes.h>`. 332 spm tests still pass. (The build next
hits a separate prefix-header gap — worklets ObjC files using NSThread/UIKit
without importing Foundation — tracked separately.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent bc6a1ae commit 0caee15
3 files changed
Lines changed: 165 additions & 3 deletions
File tree
- packages/react-native/scripts
- ios-prebuild
- spm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
218 | 224 | | |
219 | 225 | | |
220 | 226 | | |
| |||
Lines changed: 43 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
| |||
157 | 164 | | |
158 | 165 | | |
159 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
160 | 181 | | |
161 | 182 | | |
162 | 183 | | |
| |||
208 | 229 | | |
209 | 230 | | |
210 | 231 | | |
211 | | - | |
| 232 | + | |
| 233 | + | |
212 | 234 | | |
213 | 235 | | |
214 | 236 | | |
| |||
240 | 262 | | |
241 | 263 | | |
242 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
243 | 273 | | |
244 | 274 | | |
245 | 275 | | |
246 | 276 | | |
247 | 277 | | |
248 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
249 | 282 | | |
250 | 283 | | |
251 | 284 | | |
| |||
270 | 303 | | |
271 | 304 | | |
272 | 305 | | |
273 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
274 | 314 | | |
275 | 315 | | |
276 | 316 | | |
| |||
Lines changed: 116 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
621 | 621 | | |
622 | 622 | | |
623 | 623 | | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
624 | 704 | | |
625 | 705 | | |
626 | 706 | | |
| |||
661 | 741 | | |
662 | 742 | | |
663 | 743 | | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
664 | 761 | | |
665 | 762 | | |
666 | 763 | | |
| |||
750 | 847 | | |
751 | 848 | | |
752 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
753 | 861 | | |
754 | 862 | | |
755 | 863 | | |
| |||
1023 | 1131 | | |
1024 | 1132 | | |
1025 | 1133 | | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1026 | 1142 | | |
1027 | 1143 | | |
1028 | 1144 | | |
| |||
0 commit comments