Commit cdb2a2b
fix(spm): SwiftPM Release support — NDEBUG propagation, hermesc, local-artifacts
Makes SwiftPM Release builds link + bundle (Debug already worked). Root-caused
via ios-build-matrix.sh; unblocks RN-Tester + community-Fabric SPM Release.
- (A) NDEBUG propagation. The Release React.framework strips
DebugStringConvertible's vtable (and shifts the ShadowNode layout that
inherits it) under NDEBUG, but the autolinked Fabric synth targets compiled
with zero RN defines → undefined-symbol / layout-mismatch at link. Emit
`.define("DEBUG", .when(.debug))` + `.define("NDEBUG", .when(.release))` on
every autolinked C++ target: scaffolded community libs
(scaffold-package-swift.js, SCAFFOLDER_VERSION 18→19 so existing scaffolds
regenerate), synth wrappers, and inline spm.module targets
(generate-spm-autolinking.js). NDEBUG-only is deliberate: Debug is green with
no defines, so the always-on RN defines are provably unneeded — NDEBUG is the
sole Debug↔Release divergence. Mirrors packages/react-native/Package.swift.
- (B) hermesc resolution. Under SPM there is no hermes-engine pod, so
react-native-xcode.sh's `$PODS_ROOT/hermes-engine/.../hermesc` fallback
resolves to a non-existent path and Release Hermes bundling fails for every
SPM app. Inject HERMES_CLI_PATH (=$(REACT_NATIVE_PATH)/../hermes-compiler/
hermesc/osx-bin/hermesc) via mergeReactBuildSettings; react-native-xcode.sh
honors a pre-set value before its pod fallback, and an existing user value is
left untouched. Reversed byte-for-byte on deinit (covered by the round-trip test).
- (Major #3) `--artifacts <local.xcframework>`: artifacts.json now also records
ReactNativeHeaders + ReactNativeDependenciesHeaders (they ship beside their
binaries in the tarballs). They are required by validateArtifactsCache /
generate-spm-package; omitting them made the local slot report incomplete and
forced a full Maven download, defeating "use it directly".
Tests: NDEBUG defines asserted in the scaffolded + synth manifests;
HERMES_CLI_PATH asserted in both build configs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 1d7e661 commit cdb2a2b
7 files changed
Lines changed: 90 additions & 13 deletions
File tree
- packages/react-native/scripts
- spm
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
538 | | - | |
539 | | - | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
540 | 552 | | |
541 | 553 | | |
542 | 554 | | |
| |||
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
275 | 283 | | |
276 | 284 | | |
277 | 285 | | |
| |||
1048 | 1056 | | |
1049 | 1057 | | |
1050 | 1058 | | |
1051 | | - | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1052 | 1063 | | |
1053 | 1064 | | |
1054 | 1065 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
150 | 156 | | |
151 | 157 | | |
152 | 158 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
528 | 534 | | |
529 | 535 | | |
530 | 536 | | |
| |||
Lines changed: 21 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
339 | 348 | | |
340 | 349 | | |
341 | 350 | | |
| |||
932 | 941 | | |
933 | 942 | | |
934 | 943 | | |
| 944 | + | |
935 | 945 | | |
936 | 946 | | |
937 | 947 | | |
| |||
1129 | 1139 | | |
1130 | 1140 | | |
1131 | 1141 | | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
1135 | 1145 | | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
| 1146 | + | |
| 1147 | + | |
1142 | 1148 | | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
1143 | 1155 | | |
1144 | 1156 | | |
1145 | 1157 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
913 | 913 | | |
914 | 914 | | |
915 | 915 | | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
916 | 928 | | |
917 | 929 | | |
918 | 930 | | |
| |||
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
113 | 125 | | |
114 | 126 | | |
115 | 127 | | |
| |||
606 | 618 | | |
607 | 619 | | |
608 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
609 | 627 | | |
610 | 628 | | |
611 | 629 | | |
| |||
0 commit comments