-
Notifications
You must be signed in to change notification settings - Fork 378
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
Add support for Swift Package Manager v. 5.3 #333
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fde0a80
Add SwiftPM package manifest.
mattpolzin 01ec5b3
try public headers path
mattpolzin dbb1550
also try explicitly looking for C headers in correct directory.
mattpolzin bf13be5
switch from 1 public header path to instead symbolic linking all head…
mattpolzin 283f030
delete all headers from include symlinks except for the umbrella header.
mattpolzin c41f884
and back again to include dir but without umbrella header in it
mattpolzin 549442f
ditch objc umbrella header and instead put all public headers into in…
mattpolzin 6a5a56d
symlink resources, copy to package bundle, support package bundle fro…
mattpolzin 7261f2a
Add excludes to remediate warnings in package manifest
mattpolzin feef6b1
Add note to changelog.
mattpolzin 8c679a3
merge w/ upstream
mattpolzin 6c1726b
Remove test target from Package.swift because it was not set up prope…
mattpolzin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoViewer.bundle/NYTPhotoViewerCloseButtonX.png | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoViewer.bundle/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoViewer.bundle/[email protected] |
1 change: 1 addition & 0 deletions
1
NYTPhotoViewer/Resources/NYTPhotoViewerCloseButtonXLandscape.png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoViewer.bundle/NYTPhotoViewerCloseButtonXLandscape.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoViewer.bundle/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoViewer.bundle/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Resource Loading/NSBundle+NYTPhotoViewer.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Protocols/NYTPhoto.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoCaptionView.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Protocols/NYTPhotoCaptionViewLayoutWidthHinting.h |
1 change: 1 addition & 0 deletions
1
NYTPhotoViewer/include/NYTPhotoDismissalInteractionController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoDismissalInteractionController.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoTransitionAnimator.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoTransitionController.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoViewController.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoViewerArrayDataSource.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Protocols/NYTPhotoViewerContainer.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Protocols/NYTPhotoViewerDataSource.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotoViewerSinglePhotoDataSource.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotosOverlayView.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTPhotosViewController.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../NYTScalingImageView.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// swift-tools-version:5.3 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "NYTPhotoViewer", | ||
platforms: [ | ||
.iOS(.v9) | ||
], | ||
products: [ | ||
.library( | ||
name: "NYTPhotoViewer", | ||
targets: ["NYTPhotoViewer"]), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/pinterest/PINRemoteImage.git", from: "3.0.1") | ||
], | ||
targets: [ | ||
.target( | ||
name: "NYTPhotoViewer", | ||
dependencies: ["PINRemoteImage"], | ||
path: "NYTPhotoViewer", | ||
exclude: [ | ||
"NYTPhotoViewer.bundle", | ||
"Info.plist" | ||
], | ||
resources: [ | ||
.copy("Resources/NYTPhotoViewerCloseButtonX.png"), | ||
.copy("Resources/[email protected]"), | ||
.copy("Resources/[email protected]"), | ||
.copy("Resources/NYTPhotoViewerCloseButtonXLandscape.png"), | ||
.copy("Resources/[email protected]"), | ||
.copy("Resources/[email protected]"), | ||
], | ||
cSettings: [ | ||
.headerSearchPath("./"), | ||
.headerSearchPath("./Protocols"), | ||
.headerSearchPath("./Resource Loading") | ||
]) | ||
] | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 see these PNGs are duplicated, in the new .bundle and in the new location (the
Resources
folder). is that necessary?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.
Unfortunately, yes. One would think the resources could just be copied from the
.bundle
(since it is just a folder) but without theResources
folder SwiftPM will not bother to create a bundle (or at least it skips creating theSWIFTPM_MODULE_BUNDLE
macro that is used here to access the SwiftPM bundle).I did give this a shot because it made plenty of sense to me: I removed the
Resources
folder and its symlinked files and changed the respectivecopy
lines of the package manifest but then I got a build error in Xcode thatSWIFTPM_MODULE_BUNDLE
was not defined. Reverting my change allowed me to build successfully again.There are a few places where the symlinks in this PR could be removed up by making changes to the project structure as a whole to align more closely with what SwiftPM expects out-of-box (the Resources folder being one of those) but my approach here was to leave as much alone as possible; adding symlinks meant I did not need to change the project at large.
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.
Actually, I want to call out explicitly something I've said but not made really front and center so far; although GitHub makes it look like I copied a bunch of files, they are all actually symlinks. I'm still not over-the-moon about them, but at least this has not created a situation where these files need to be modified/deleted/etc. in multiple places.
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've been looking into this, hoping to find a way to avoid adding the complication of maintaining symlinks to the resources in the .bundle. Your commit history tells me you traveled a similar road vis-a-vis the headers. I was hoping something like this would work:
but found this bit of code causes NYTPhotoViewer.bundle to be added to the sources, not the png.
I'm still wrapping my head around the internals of SPM, but I'm thinking the final answer will be to reorganize the resources and includes of NYTPhotoViewer so that SPM can be supported without symlinks.
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.
That makes sense. If it were mine to maintain, I would prefer the project reorganization over the symlinks as well.
Let me know if there’s anything else I can do to help out. I’m no expert, but I do have a bit of history with SPM at this point.
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 asked about this on the Swift forums, see https://forums.swift.org/t/package-resources-from-a-directory-named-with-an-extension/43423