Commit c6c48ea
fix(spm): scaffold app-package paths relative to the libs/<Name> symlink
A scaffolded community-library Package.swift referenced the app's codegen and
xcframeworks packages with paths computed relative to the dep's real
node_modules dir (relFromDep). But the autolinker references each library
through a symlink at build/generated/autolinking/libs/<SwiftName>, and on a
fresh SwiftPM resolve the manifest's relative `.package(path:)` entries are
interpreted against that SYMLINK location (SwiftPM does not canonicalize the
symlink first). So `../../ios/build/generated/ios` resolved to the doubled,
nonexistent `…/autolinking/ios/build/generated/ios` → "Could not resolve package
dependencies". This bit any fresh resolve (only a stale Package.resolved hid it).
Compute the paths relative to the symlink dir instead: codegen → `../../../ios`,
xcframeworks → `../../../../xcframeworks`. SCAFFOLDER_VERSION bumped 7→8 so
existing manifests auto-regenerate on the next scaffold/sync.
Verified E2E on /tmp/SpmE2E and ~/spikes/Spm1 (remote mode): re-scaffold via the
v8 tooling, fresh resolve (clean DerivedData + Package.resolved) BUILD SUCCEEDED.
Known follow-up: the sibling-dep path (emitScaffoldedPackageSwift
`../${siblingName}`) is still dep.root-relative and uses the npm name rather than
`libs/<swiftSibling>` — same class, only hit when a scaffolded lib depends on
another RN lib (reanimated→worklets).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent fafd7b5 commit c6c48ea
2 files changed
Lines changed: 51 additions & 7 deletions
File tree
- packages/react-native/scripts/spm
- __tests__
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
462 | 486 | | |
463 | 487 | | |
464 | 488 | | |
| |||
Lines changed: 27 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| |||
635 | 638 | | |
636 | 639 | | |
637 | 640 | | |
638 | | - | |
639 | | - | |
640 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
641 | 661 | | |
642 | | - | |
| 662 | + | |
643 | 663 | | |
644 | 664 | | |
645 | 665 | | |
646 | 666 | | |
647 | 667 | | |
648 | | - | |
649 | | - | |
| 668 | + | |
| 669 | + | |
650 | 670 | | |
651 | 671 | | |
652 | 672 | | |
| |||
0 commit comments