Repository navigation
Commit ee2d411
authored
Fix SwiftPM: native library added after setup is not compiled until a clean build (#60462)
When you add a native library to a SwiftPM app, xcodebuild resolves the
package graph first. Then the "Sync SPM Autolinking" scheme pre-action adds
the library to the Autolinked Package.swift. Xcode keeps the old package
graph for the new manifest, so incremental builds never compile the library
and the app fails at runtime (for example "RNSVGCircle is not registered").
Only a clean build fixed it.
The pre-action now syncs only when the Autolinked manifest is missing. Once
it exists, the "Sync SPM Autolinking" build phase syncs it. When that sync
changes the manifest, the build fails once with "native modules changed.
Build again." The next build compiles the library.
Test: yarn jest packages/react-native/scripts/spm --no-cache -i
(1264 passed, 0 failed).1 parent 1df562c commit ee2d411
3 files changed
Lines changed: 69 additions & 24 deletions
File tree
- packages/react-native/scripts/spm
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
| |||
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
| 396 | + | |
395 | 397 | | |
396 | 398 | | |
397 | 399 | | |
| |||
438 | 440 | | |
439 | 441 | | |
440 | 442 | | |
441 | | - | |
| 443 | + | |
442 | 444 | | |
443 | | - | |
| 445 | + | |
444 | 446 | | |
445 | 447 | | |
446 | 448 | | |
| |||
450 | 452 | | |
451 | 453 | | |
452 | 454 | | |
| 455 | + | |
453 | 456 | | |
454 | 457 | | |
455 | | - | |
| 458 | + | |
456 | 459 | | |
457 | 460 | | |
458 | 461 | | |
| |||
544 | 547 | | |
545 | 548 | | |
546 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
547 | 583 | | |
548 | 584 | | |
549 | | - | |
| 585 | + | |
550 | 586 | | |
551 | | - | |
552 | 587 | | |
553 | 588 | | |
554 | 589 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
| |||
198 | 197 | | |
199 | 198 | | |
200 | 199 | | |
| 200 | + | |
| 201 | + | |
201 | 202 | | |
202 | | - | |
203 | | - | |
204 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
205 | 206 | | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | 207 | | |
215 | 208 | | |
216 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
940 | 940 | | |
941 | 941 | | |
942 | 942 | | |
943 | | - | |
| 943 | + | |
944 | 944 | | |
945 | 945 | | |
946 | 946 | | |
947 | | - | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
948 | 953 | | |
949 | 954 | | |
950 | 955 | | |
951 | 956 | | |
952 | 957 | | |
953 | | - | |
| 958 | + | |
954 | 959 | | |
955 | 960 | | |
956 | 961 | | |
957 | 962 | | |
958 | 963 | | |
959 | 964 | | |
960 | 965 | | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
961 | 972 | | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
962 | 979 | | |
963 | 980 | | |
964 | 981 | | |
| |||
1768 | 1785 | | |
1769 | 1786 | | |
1770 | 1787 | | |
1771 | | - | |
1772 | | - | |
| 1788 | + | |
| 1789 | + | |
1773 | 1790 | | |
1774 | 1791 | | |
1775 | 1792 | | |
| |||
2217 | 2234 | | |
2218 | 2235 | | |
2219 | 2236 | | |
2220 | | - | |
2221 | | - | |
| 2237 | + | |
| 2238 | + | |
2222 | 2239 | | |
2223 | 2240 | | |
2224 | 2241 | | |
| |||
0 commit comments