Commit 79ee3bc
committed
fix(spm): hermes default, partial-cache detection, codegen template freshness, multi-line logging
A cluster of issues that all surfaced together while iterating against
react-native@nightly. None of them showed up cleanly — they cascaded into
"Missing package product 'hermes-engine'" at Xcode build time after the
spm pipeline reported success.
1. Hermes was tied to the RN nightly version. The default
`process.env.HERMES_VERSION ?? rawVersion ?? rnVersion` made hermes
download attempt `hermes-ios/0.87.0-nightly-20260519-.../`, which has
never existed — hermes binaries publish under their own version space
via the `hermes-compiler` npm package. Default flipped to `latest-v1`
to match RN's CocoaPods prebuild
(scripts/ios-prebuild/hermes.js:62). HERMES_VERSION env var still
overrides (literal version / `latest-v1` / `nightly` all work).
New test file covering both the new default and the existing escape
hatches. TDD: 2 RED tests confirmed the bug, then green after the
default flipped.
2. `artifacts.json` was being written on partial download. If hermes 404'd
(the case above) but React + ReactNativeDependencies succeeded, the
downloader logged the failure to stderr and exited 0 — the orchestrator
then saw `artifacts.json` exists and skipped re-download on the next
run, locking in the partial state. Now: downloader die()s on any
failure and only writes artifacts.json on full success. Added
`validateArtifactsCache(dir)` that verifies every REQUIRED_ARTIFACT has
a present xcframework on disk; ensureArtifacts uses it instead of a
bare existsSync.
3. Belt-and-suspenders in generate-spm-package.js — refuses to proceed if
`--artifacts-dir` points at an incomplete artifacts.json (covers
anyone bypassing the orchestrator).
4. Codegen Package.swift template was installed BEFORE the xcframework
symlinks existed. `renderCodegenTemplate`'s `realpathSync` therefore
threw and fell back to a runtime URL expression — content-stable
across slot changes, so SPM's manifest hash never bumped on nightly
transitions and Xcode kept using a cached evaluation with the
previous-slot path. Re-installs the template in both
setup-apple-spm.js main() (after generateXcframeworksPackage) and
sync-spm-autolinking.js (after generatePackage) so the absolute slot
path gets baked in.
5. `--forceXcodeproj` was registered in the underlying script but missing
from the community CLI plugin (react-native.config.js), so
`npx react-native spm --forceXcodeproj` was rejected by commander
before reaching the script.
6. Logger output: multi-line messages had the `[name]` prefix only on the
first line. Now each line gets the prefix — terminal log scrapers and
visual scanning both work.
7. Download progress display: long lines wrapped past the terminal width;
`\x1b[2K` clears only the current row, so wrap residue stayed on
screen after the next update. Now truncates to width-1 with `…`,
counting visible chars (skips ANSI escapes), and prefixes each line
with the `[download-spm-artifacts]` tag for consistency with the rest
of the log.1 parent 233fb49 commit 79ee3bc
7 files changed
Lines changed: 361 additions & 66 deletions
File tree
- packages/react-native
- scripts
- spm
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
| |||
222 | 228 | | |
223 | 229 | | |
224 | 230 | | |
| 231 | + | |
225 | 232 | | |
226 | 233 | | |
227 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
1114 | 1115 | | |
1115 | 1116 | | |
1116 | 1117 | | |
1117 | | - | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
1122 | | - | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
| 1118 | + | |
1142 | 1119 | | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
1143 | 1125 | | |
1144 | 1126 | | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
1145 | 1148 | | |
1146 | 1149 | | |
1147 | 1150 | | |
| |||
1507 | 1510 | | |
1508 | 1511 | | |
1509 | 1512 | | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1510 | 1522 | | |
1511 | 1523 | | |
1512 | 1524 | | |
| |||
Lines changed: 146 additions & 0 deletions
| 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 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
0 commit comments