Skip to content
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

[Bug]: SPM - capacitor-swift-pm.git Version declared to branch main #7735

Closed
1 of 3 tasks
7-plus-t opened this issue Oct 24, 2024 · 7 comments
Closed
1 of 3 tasks

[Bug]: SPM - capacitor-swift-pm.git Version declared to branch main #7735

7-plus-t opened this issue Oct 24, 2024 · 7 comments
Labels
type: bug A confirmed bug report

Comments

@7-plus-t
Copy link

7-plus-t commented Oct 24, 2024

Capacitor Version

Latest Dependencies:

@capacitor/cli: 6.1.2
@capacitor/core: 6.1.2
@capacitor/android: 6.1.2
@capacitor/ios: 6.1.2

Installed Dependencies:

@capacitor/cli: 6.1.2
@capacitor/core: 6.1.2
@capacitor/ios: 6.1.2
@capacitor/android: 6.1.2

Other API Details

> npm --version
10.9.0

> node --version
v22.10.0

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

Using the SPM beta for iOS:
In the Package.swift of CapApp-SPM, generated by npx cap sync, the dependency on Capacitor and Cordova is declared as follows:
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main"),

This causes SPM to use the latest commit of https://github.com/ionic-team/capacitor-swift-pm.git and therefore always the newest Capacitor version is used. This cannot be overridden by the parent app, as the branch: "main" overrules other constraintes like exact or from when there is a conflict.

A similar problem exists in all the Capacitor plugins that have been converted to the SPM structure, where in Package.swift the dependency to Capacitor is declared with branch: "main".

Expected Behavior

The Package.swift of CapApp-SPM and the plugins should be changed, so it states:
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "6.0.0"), (or 7.0.0 for the upcoming Capacitor release).
This allows the parent app to declare the version of Capacitor to be used, without SPM resolution conflicts.

Project Reproduction

Use any plugin example app

Additional Information

No response

@flgubler-ergon
Copy link

We have faced the same problem in our project: the build suddenly started using the capacitor 7 alpha version which obviously is unacceptable for a productive app.

A reproduction can be found here: https://github.com/ionic-team/capacitor-ios-spm-template/blob/main/template/App/CapApp-SPM/Package.swift - it is apparently a different dependency, but uses branch: "main" as well.

@jcesarmobile jcesarmobile added the type: bug A confirmed bug report label Oct 24, 2024
Copy link

ionitron-bot bot commented Oct 24, 2024

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

@7-plus-t

This comment was marked as abuse.

@7-plus-t
Copy link
Author

see ionic-team/capacitor-plugins#2221 for fix in plugins

@flgubler-ergon
Copy link

Cool, thanks

@jcesarmobile
Copy link
Member

fixed in #7737

Copy link

ionitron-bot bot commented Dec 18, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A confirmed bug report
Projects
None yet
Development

No branches or pull requests

3 participants