-
Notifications
You must be signed in to change notification settings - Fork 48
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
Update project and installation methods (CocoaPods and Swift Package Manager) for Xcode 15 #56
Conversation
@@ -1,5 +1,14 @@ | |||
# Changelog | |||
|
|||
## [1.2.3](https://github.com/Pinterest/PINOperation/tree/1.2.3) (TBD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can update the version number and release date before merging, per guidance from the maintainers.
Makefile
Outdated
# TODO: replace it with "swift test --enable-test-discovery --sanitize=thread" when swiftPM resource-related bug would be fixed. | ||
# https://bugs.swift.org/browse/SR-13560 | ||
swift build | ||
swift test --enable-test-discovery --sanitize=thread |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linked SPM bug has been resolved for some time.
s.osx.deployment_target = '10.8' | ||
s.tvos.deployment_target = '9.0' | ||
s.watchos.deployment_target = '2.0' | ||
s.cocoapods_version = '>= 1.13.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a common pattern used across other popular open source libraries, ensuring the VisionOS platform is recognized and Resource Bundles are properly generated.
pch_PIN = <<-EOS | ||
#ifndef TARGET_OS_WATCH | ||
#define TARGET_OS_WATCH 0 | ||
#endif | ||
EOS | ||
s.prefix_header_contents = pch_PIN | ||
s.source_files = 'Source/**/*.{h,m,mm}' | ||
s.source_files = 'Source/*.{h,m}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches the format used in PINCache. I figured it was best to keep things simple and consistent with PINCache.
pch_PIN = <<-EOS | ||
#ifndef TARGET_OS_WATCH | ||
#define TARGET_OS_WATCH 0 | ||
#endif | ||
EOS | ||
s.prefix_header_contents = pch_PIN | ||
s.source_files = 'Source/**/*.{h,m,mm}' | ||
s.source_files = 'Source/*.{h,m}' | ||
s.resource_bundles = { 'PINOperation' => ['Source/PrivacyInfo.xcprivacy'] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an important line. Adding a Privacy Manifest to resources
would end up clobbering an app's Privacy Manifest. Popular open source libraries (Firebase, Alamofire, etc.) have been using this approach for several months with no issues.
name: "PINOperation", | ||
path: "Source", | ||
exclude: ["Info.plist"], | ||
resources: [.process("PrivacyInfo.xcprivacy")], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Privacy Manifest file needs to be added and referenced within the Xcode project, which is why we are processing the resource instead of copying.
Source/PINOperation.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using angled brackets is the preferred way of importing framework headers. Now that the Swift Package Manager Package file references a public header folder of symlinks, we can use angled brackets as expected.
Source/PrivacyInfo.xcprivacy
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is essentially an empty Privacy Manifest, which is what Apple prefers in the case where a third-party SDK doesn't collect data nor use any sensitive APIs.
Ready for review. NOTE: I have a similar PR open for PINCache, which I've linked in the PR description. cc: @garrettmoon @garricn |
@jparise @woshimaliang @rcancro @garrettmoon @garricn I'd like to suggest we first work on landing these changes in an official release, and then move over to this PINCache PR. Otherwise, we're going to be blocked in the PINCache PR by the CocoaPods CI test failing during lint (specifically, lint would fail due to the existing minimum deployment target set in PINOperation 1.2.2, as well as lack of VisionOS support). |
… Manager) to support building and running with Xcode 15.2
Merged! I'll keep an eye on PINCache to kick off builds as required. Thanks for the contributions!!! (any chance you use PINRemoteImage and want to make a change there as well??? :) ) |
@rcancro You rock! Thanks for merging :) I don't use PINRemoteImage, but if we can get these changes into an official release soon, I'll create a PR for PINRemoteImage that includes the necessary changes 👍 The first thing I'll need from you and the team is to publish a new version of PINOperation to CocoaPods trunk. After that, I can bring in the new version to my PINCache and PINRemoteImage PRs and ensure all CI tests pass and VisionOS is properly supported. 💪 |
Background
As of April 29th, 2024, all apps submitted to the App Store must be built using Xcode 15 (ref: Apple News).
Additionally, all third-party SDKs are required/encouraged to include a Privacy Manifest file (ref: Apple Support).
Purpose
The purpose of these changes is to upgrade the project and bump the minimum deployment targets for Xcode 15:
These changes span across the following:
Additionally, the Swift Package Manager Package file points to a new "include" public header folder of symlinks. This allows the project to use angled bracket imports for public headers without having to suppress any warnings from clang.
This PR fulfills the following open issues and pull requests:
NOTE: A separate PR has been created on PINCache with similar changes.
Attachments
PINOperation after being installed via CocoaPods:
PINOperation targets after being installed via CocoaPods (blue icon represents a resource bundle target that includes the Privacy Manifest file):
PINOperation unit tests passing: