-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP - feat: Add support for SPM plugins #1430
base: master
Are you sure you want to change the base?
Conversation
There's a bit of Xcode mangling the project file (stripping licence comments, removing quotes around The idea of a SwiftPM subproject is a good one and will make the process of adding/removing plugins significantly easier than trying to deal with the Xcode project directly. That said, would it make sense for CordovaLib to be referenced directly from the Xcode project rather than through the SwiftPM library? One worry is that we won't be able to ship with CordovaLib pointing at |
templates/project/__PROJECT_NAME__.xcworkspace/xcshareddata/swiftpm/Package.resolved
Outdated
Show resolved
Hide resolved
Keeping CordovaLib was a good call as it allows plugins to not have a dependency to cordova-ios, I tried several things like using an environment variable for setting the cordova-ios versions to use based on the installed version, and worked when running the app from the CLI, but was not working if running from Xcode since the variable is unset when the node process stops. Also tried using cordova-ios from node_modules directly and works fine for the While I would have loved using the local version so we have the privacy manifest linked and on plugins we could run |
hmmm, I'd been hoping that we would be able to reference CordovaLib using SwiftPM, but directly in the app's Xcode project rather than through the CordovaPluginsSPM project's Package.swift... but if I'm reading your comment correctly that still causes issues for plugins? 😞 |
I didn't try that, but still, it would be a complex thing to do since if you add it to the template, when the template is turned into an app the path to cordova-ios's Package.swift will be different, so should be adjusted in the xcodeproj file. Could be possible by having a |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1430 +/- ##
==========================================
- Coverage 78.35% 77.91% -0.45%
==========================================
Files 16 16
Lines 1825 1838 +13
==========================================
+ Hits 1430 1432 +2
- Misses 395 406 +11 ☔ View full report in Codecov by Sentry. |
Remove CordovaLib from the template and instead add a local "empty" swift package, in which
cordova-plugin-add
will add the plugins as dependencies if they are swift package manager compatible.Plugin example to test with: apache/cordova-plugin-device#196
Using this approach plugins that want to add Swift Package Manager dependencies will have to be converted to be Swift Package Manager compatible and add dependences as they would to a regular Swift Package instead of relying in a new tag in
plugin.xml