Repository navigation
fix(cli): resolve Capacitor path from symlink folder for SPM plugins with symlink option - #8773
Merged
Merged
Conversation
…with symlink option (#8769) With experimental.ios.spm.packageOptions[plugin].symlink, the app package depends on symlinks/<Name>, and SwiftPM resolves a plugin's relative paths from the symlink location without following it. Sync computed the rewritten Capacitor dependency path from the plugin's real folder, so it pointed at a non-existent location and package resolution failed with a conflicting identity error. Use the symlink folder as the base for those plugins.
alexgerardojacinto
requested review from
ItsChaceD,
OS-pedrogustavobilro,
andredestro,
eric-horodyski,
jcesarmobile,
markemer and
theproducer
December 4, 2026 16:13
Member
|
Is there a fix for this that wouldn't require a flag? What would be the implication if we just |
Contributor
Author
@eric-horodyski This PR fixes a bug in a flag that already exists, so I think it still makes sense to solve it. But we can definitely look into a better solution in the near future. |
andredestro
approved these changes
Dec 4, 2026
markemer
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix iOS package resolution for plugins that set
experimental.ios.spm.packageOptions[<plugin>].symlinktotrue.Fixes #8769
Cause
During sync, the CLI rewrites the Capacitor dependency in each plugin's
Package.swiftto a path dependency. It computed that path relative to the plugin's real folder, for examplepath: "../ios"for@capacitor/app.With
symlink: true, the app package depends onsymlinks/<Name>instead of the real folder. SwiftPM resolves a plugin's relative paths from the symlink location and doesn't follow the link. The path../iostherefore points toCapApp-SPM/symlinks/ios, which doesn't exist. Resolution then fails with:Changes
cli/src/ios/update.ts, compute the rewritten Capacitor path fromCapApp-SPM/symlinks/<plugin.name>for plugins that setsymlink: true. Plugins without the option behave as before.cli/test/update.ios.spm-plugins.spec.tsthat checks the written path for a plugin withsymlink: true.Testing
Tested with Xcode 26.1.1 and the CLI built from this branch.
symlink: truefor@capacitor/app.../ios),xcodebuild -resolvePackageDependenciesfails with the error above.../../../../../node_modules/@capacitor/ios, package resolution succeeds, and a simulator build succeeds.cap syncleaves the manifest unchanged, and resolution still succeeds.@capacitor/appwith@capacitor-firebase/app(8.7.0,symlink: trueon both): resolution and a simulator build succeed. Without the option, resolution fails withConflicting identity for app.@capacitor-firebase/app-check(8.7.0,symlink: true), which depends on Firebase and itsapp-checkpackage: resolution and a simulator build succeed.npx jest test/update.ios.spm-plugins.spec.tspasses.Known limitation
The CLI rewrites
Package.swiftin the real plugin folder, usually innode_modules. That behavior isn't new. Withsymlink, the written path depends on the location of the app's iOS folder, so two apps that share one plugin folder can't both use it. This change doesn't address that case.