feat(cli): support SPM package traits in generated Package.swift#8351
feat(cli): support SPM package traits in generated Package.swift#8351robingenz wants to merge 5 commits intoionic-team:mainfrom
Conversation
|
Hey @robingenz thanks for the PR, tested here and it's working pretty well. I did a few minor changes, most notably to allow to set the I'll ask for an additional review of the team as well. For reference - Tested with https://github.com/OS-pedrogustavobilro/test-capacitor-pr8351-spm-traits |
|
@OS-pedrogustavobilro Thank you so much! We are really looking forward to the release as we have 2-3 plugins that are just waiting for it. Let me know if I can help in any way. |
|
Since the feature requires swift-tools-version: 6.1, even if that version will only be used if traits are present, I would prefer not merging this until Capacitor uses Swift 6. My understanding is that having swift-tools-version: 6.1 in the Package.swift has implications for the dependencies being fetched and could cause issues if some of the dependencies have xcframeworks built with previous versions |
|
@jcesarmobile Good point—I totally understand the concern. Is there a timeline for Swift 6 support in Capacitor? The reason this feature is somewhat time-sensitive is that while it was supported in CocoaPods, SPM is now the default package manager. This has created restrictions for our plugin users who have transitioned to SPM. To mitigate the risk, I have two suggestions:
Let me know what you think! |
|
Hey @robingenz, getting back to you on your points. They're both reasonable, but we feel they might not be enough so we went a step further. We're planning on going with essentially an "extension" of the second option you provided: adding an experimental setting for Users will need to set that config explicitly to be able to use the package traits feature from this PR, which we will be also place under the Unfortunately we can't yet provide a timeline for when Capacitor will support Swift 6, but I think I can say it won't be Capacitor 8, only in a future major. As such, we think placing these settings in an We hope this doesn't entirely dissuade users of your plugin to not use the feature, as I think as long they properly test their apps after making this change and find everything is still working, they should be alright. The other PR is still going to be reviewed, but if/when it's merged, we will also be doing a few updates in this PR, particularly to mark the config option as experimental. Feel free to share your feedback on this option, thank you! |
|
Hey @OS-pedrogustavobilro, thank you! That looks like a good approach. I do think there will be some developers who will be put off by a setting labeled |
|
Temporarily placing this PR in draft until #8372 is merged. |
Summary
ios.spm.packageTraitsconfig option to pass package traits to SPM plugin dependenciesswift-tools-version: 6.1when traits are configured, otherwise keep5.9traits: [...]to.package()dependency lines for plugins with configured traitsClose #8335