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

🐛 Fixes for SPM #512

Merged
merged 5 commits into from
Jan 13, 2025
Merged

🐛 Fixes for SPM #512

merged 5 commits into from
Jan 13, 2025

Conversation

abegehr
Copy link
Contributor

@abegehr abegehr commented Jan 6, 2025

Had a few more issues with Package.swift and some swift code in Xcode:

  1. ZipArchive only supports iOS ≥15.5
  2. Library Name needs to match package name: "CapgoCapacitorUpdater" (and target attr references target bellow).
  3. Needs to support more versions than just capacitor-swift-pm "6.0.0", instead: "^6.0.0".
  4. Import "ZipArchive" seems to import SSZipArchive, removed second camImport declaration.
  5. UIKit import missing, required for UIDevice.
  6. Some Syntax issues with Version not being available as string, probably due to newer platform version.

I've tested it and it works in my project.

Some screenshots of the errors, pre-fix:

Screenshot 2025-01-06 at 19 20 18 Screenshot 2025-01-06 at 19 22 48 Screenshot 2025-01-06 at 19 24 05 Screenshot 2025-01-06 at 19 29 44

Had a few more issues with Package.swift and some swift code in Xcode:

1. ZipArchive only supports iOS ≥15.5
2. Library Name needs to match package name: "CapgoCapacitorUpdater" (and target attr references target bellow).
3. Needs to support more versions than just capacitor-swift-pm "6.0.0", instead: "^6.0.0".
4. Import "ZipArchive" seems to import SSZipArchive, removed second camImport declaration.
5. UIKit import missing, required for UIDevice.
6. Some Syntax issues with Version not being available as string, probably due to newer platform version.

I've tested it and it works in my project.
@abegehr
Copy link
Contributor Author

abegehr commented Jan 6, 2025

Coming from #510

@riderx
Copy link
Collaborator

riderx commented Jan 6, 2025

We will not upgrade the version minimum ios 13+, we have to follow capacitor one, so better to lock the version of ZipArchive to a version who doesn’t require the bump

@riderx
Copy link
Collaborator

riderx commented Jan 6, 2025

I just realized all version below 2.5 are not available in spm, so we can’t do anything for now for this

@riderx
Copy link
Collaborator

riderx commented Jan 6, 2025

I did raise issue, our ask is quite nonsense and i would understand the creator of the lib refuse.
Let see

@marius-se
Copy link

What if we replace ZipArchive with a different Swift package that can zip/unzip?

@riderx
Copy link
Collaborator

riderx commented Jan 7, 2025

ZipArchive has been used since day one in this plugin, we cannot change that so easily.
Many step are depending on it, including checksum etc.
in v7 we could do that in favor of Brotli, who is already used for partial

@marius-se
Copy link

marius-se commented Jan 7, 2025

ZipArchive has been used since day one in this plugin, we cannot change that so easily. Many step are depending on it, including checksum etc. in v7 we could do that in favor of Brotli, who is already used for partial

I just tried removing it (replaced it with Zip) and I only had to replace a single call to ZipArchive in order to compile the package. I could open a PR for that, based on @abegehr 's branch if you want @riderx
No need to bump any minimum iOS version then and no breaking changes. Let me know. We're one of your paying customers and would love to get this upstream :)

@riderx
Copy link
Collaborator

riderx commented Jan 8, 2025

@marius-se I wish that to be so easy. Changing a lib used by millions of devices daily has a huge impact.
You can make a PR if you find one lib who fit, sadly for this one I think it's a dead end:
not maintained for 11 months:
marmelroy/Zip#256
Do not incorporate privacy manifest (who is mandatory to any new release):
marmelroy/Zip#259

I will do some more research as well

@riderx
Copy link
Collaborator

riderx commented Jan 8, 2025

I think i found the solution to force the version in SPM

@riderx
Copy link
Collaborator

riderx commented Jan 8, 2025

pushed

@riderx
Copy link
Collaborator

riderx commented Jan 8, 2025

Please try 6.12.1

@riderx
Copy link
Collaborator

riderx commented Jan 8, 2025

Sorry, I found another issue, try 6.12.3
Version package was linked to an incorrect package in SPM

@abegehr
Copy link
Contributor Author

abegehr commented Jan 8, 2025

awesome, works! thanks @riderx

EDIT: nevermind, still getting an issue:
Screenshot 2025-01-08 at 22 16 30
@riderx, it seems you didn't commit the name reference fix, any specific reason why not? cap sync iOS expects the package name and library name to be the same when generating the dependency requirement: .product(name: "CapgoCapacitorUpdater", package: "CapgoCapacitorUpdater")

@abegehr abegehr closed this Jan 8, 2025
@abegehr abegehr reopened this Jan 8, 2025
@abegehr
Copy link
Contributor Author

abegehr commented Jan 8, 2025

I've updated this PR to include fixes from 6.12.3:

  1. ZipArchive only supports iOS ≥15.5 – fixed by @riderx by pinning version ✅
  2. Library Name needs to match package name: "CapgoCapacitorUpdater" – fix is in this PR ☑️
  3. Needs to support more versions than just capacitor-swift-pm "6.0.0", instead: "^6.0.0" – fix is in this PR ☑️
  4. Import "ZipArchive" imports SSZipArchive, removed second camImport declaration – fix is in this PR ☑️
  5. UIKit import missing, required for UIDevice – fix is in this PR ☑️
  6. Some Syntax issues with Version not being available as string, probably due to newer platform version - Version dependency link updated ✅

@riderx, please let me know if you agree with those fixes.

@riderx
Copy link
Collaborator

riderx commented Jan 9, 2025

For the package version of capacitor swift pm we should follow the template:
https://github.com/ionic-team/create-capacitor-plugin/blob/433a3013d824308e9649f2dfc44e5ba349e3553b/assets/plugin-template/Package.swift.mustache
Instead something custom not recommended, outside of this i can accept

@riderx
Copy link
Collaborator

riderx commented Jan 9, 2025

Can you fix it and i accept your pr?

@abegehr
Copy link
Contributor Author

abegehr commented Jan 10, 2025

yes, doing now, thanks @riderx

@riderx riderx merged commit d15a433 into Cap-go:main Jan 13, 2025
5 checks passed
@abegehr
Copy link
Contributor Author

abegehr commented Jan 13, 2025

🙌

@abegehr abegehr deleted the abegehr/fix-package-swift branch January 13, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants