Closed mattmaddux closed 3 years ago
I love the addition. Let me know when it's ready!
Okay, great. Should be good to go now. I've made a couple changes since first opening this PR:
1) Originally I had the URL in Package.swift pointing to a "-latest" symlink on my server. Thinking new releases could just update the checksum. But I realized that would prevent people from grabbing previous releases since the checksum would no longer match. So I updated that.
2) If it sounds acceptable to you I changed the script so that it changes the Package.swift file itself with the new filename and checksum. Then all that's needed for a new release is to upload the binary, commit and push, and create new release on GitHub.
So now if it's merged, once you're ready for a new release you can change BASE_URL
in build-mailcore2-xcframework-spm.sh
and it will be used for future builds instead of manually doing it in Package.swift.
Looks like the issue with Xcode 12 and signing SPM binaries is fixed in 12.2 Beta 3, so maybe best to hold off on merging this until that's out. Then I'll push an update to fix those changes. This will make integrating MailCore2 with SPM a lot simpler.
Anybody wanting to use it with SPM in the meantime can use my fork.
Sorry for the delay! It's merged now!
hi matt, are you able to upload to the appstore? I am asking because of the issue: https://github.com/MailCore/mailcore2/issues/1899 What do you think about making a tag for this / next version to have an explicit reference in XCode to prevent malicious code injection? Best Jürgen
Hmm, yeah, that's a problem. For us it was a small-deployment internal application. We were just using Ad-hoc, so didn't need the App Store, but we'll be moving to the App Store soon.
Hi Matt, with XCode 12 I tried to run the build scripts for the XCFrameworks. unfortunately they do fail. Could please have a quick check whats going wrong?
This Pull Request adds support for installing MailCore2 with Swift Package Manager.
In Xcode 12 SPM now supports distributing binary frameworks. In order to do that, however, it needs to be in an xcframework format. To create that and allow for SPM distribution, the following changes are included.
New Scripts
Two new scripts are included in the scripts directory.
build-mailcore2-xcframework.sh
This script exports each target as an an xcarchive, then uses those to build MailCore.xcframework and save it under .build/. On it's own this file can be added to a project simply by dragging it to the
Frameworks, Libraries, and Embedded Content
underGeneral
for a target. No bridging header or build settings changes necessary. That could also be included in the Mac/iOS instructions as an installation option.build-mailcore2-xcframework-spm.sh
This script first runs the above script to generate the xcframework, compresses it for SPM distribution, and computes a checksum that needs to be included in the Package.swift file.
Package.swift
The package manifest.
If this PM is merged, this file would need to be updated with a new URL. Currently it points to a server where I'm hosting builds I was using for testing. That will remain up for a while, but it would be better if xcframeworks were hosted alongside the other binaries.
The checksum listed in this file would also need to be updated whenever a new build is uploaded.
build-mac/README.md
This file is updated to include SPM instructions. The public Xcode 12 release currently has an issue with correctly signing binary frameworks distributed through SPM (see this thread). So there are a couple additional steps to fix that. However those should be able to be removed in the future.
Other Notes
This supports Mac, iOS and the iOS Simulator. However, it doesn't yet support Apple Silicon or Catalyst. Once MailCore2 is able to be built for those they could easily be added.
Also a new release would need to be drafted after merge for it to work with Xcode.