-
Notifications
You must be signed in to change notification settings - Fork 607
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
Swift Package Manager #442
Conversation
any news on this? would like to use OCMock with Swift Package Manager as soon as possible 😀 |
While the PR is pending, Firebase is using it like https://github.com/firebase/firebase-ios-sdk/blob/master/Package.swift#L123 |
Good point, will give it a try! |
To be honest, after the other two PR's about Swift Package Manager got really confusing, and I didn't have time to learn about Swift Package Manager, I mentally parked this one. Having looked at it now, I must say that I'm not on board with the approach taken. If SPM really needs all public headers on their own in a folder, then this sounds like part of the build process. It feels completely wrong (to me) to create a folder full of symlinks and check that in. Also, are you sure about the fact that Swift Package Manager needs the headers on their own in a folder. I don't recall the other two PRs mentioning this. |
Swift Package Manager can only specify public headers by folder and the previous PRs ended up treating non-public headers as public which caused a few failures in my testing. From an SPM perspective, it would be more ideal for all build systems to specify the public headers from a single folder, but this change is less intrusive to the existing builds. |
Thanks for the quick reply. As mentioned, I would like to explore whether this folder for public headers cannot be generated automatically at build time, using a script or something. It feels wrong to me to create this artefact, which is only needed for SPM, and check it in. Also, I now see that your are specifying |
I don't think that SPM has any kind of script capability and it is very opinionated about a 1-1 relationship between the git contents and what gets built - so I don't have any ideas about alternatives other than a larger file structure refactor like we did in Firebase to support building with both SPM and CocoaPods. I didn't touch the |
SPM must have different rules about |
Paul, you won't be able to remove the .unsafeFlags(["-fno-objc-arc"]). It
is critical to OCMock.
…On Wed, Aug 19, 2020 at 11:39 AM Paul Beusterien ***@***.***> wrote:
I don't think that SPM has any kind of script capability and it is very
opinionated about a 1-1 relationship between the git contents and what gets
built - so I don't have any ideas about alternatives other than a larger
file structure refactor like we did in Firebase
<https://github.com/firebase/firebase-ios-sdk/blob/master/HeadersImports.md>
to support building with both Firebase and CocoaPods.
I didn't touch the .unsafeFlags(["-fno-objc-arc"]) flag from the previous
PRs but it seems to work fine for test targets. I'll investigate removing
it ...
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#442 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACOFSN5GVK6WHZUGYMTU2LSBQL5NANCNFSM4OVBSIDQ>
.
|
So, I started down the rabbit hole... It really seems like SwiftPM does not allow to run scripts. At the same time I am unwilling to accept a directory full of symlinks just for this. And maybe it's just me but I can't seem to find any reasonable documentation by either Apple or on swift.org that explains how to create a Swift package for an Objective-C framework. Could anyone please provide a link to such documentation? I'm not going to piece this together from Stack Overflow answers and the source code of SwiftPM. |
From https://forums.swift.org/t/picking-and-choosing-public-headers/39558, a custom module map for Swift Package Manager would be an alternative. Would that work? |
@paulb777, thank you for looking into this option. Reading through the documentation it seems this could work:
Now, I know nothing about modulemaps... By the way, in the meantime I made the non-controversial changes on the "master" branch. The imports now use straight quotes and the localised plist string files are gone. Thanks for pointing these out; good changes anyway. And I would have cherry-picked the commits to give credit that way, but the commits were intertwined with changes to the package manager file. |
If any one is interested module maps are extensively documented here. |
Did any one investigated the possibility to distribute It is possible to create a Github Actions pipeline that packages |
Another interesting thing: Uploading Artifacts on Travis CI. |
With binary distribution it would be possible to use |
See #460 for a custom module map implementation |
just starting to catch up on the changes here w.r.t. SPM. would like to see some solution that will allow us to start using OCMock as an SPM package … i don't know which of the alternatives here is preferred at this point. looking for a tl;dr on where the discussion on this is at and if there's a plan going forward. |
i think i prefer the other patch with the Package.swift changes to this one … but would like to see a canonical Package.swift file adopted on master here … |
Closing this as it looks likely that the solution in #460 is the way to go. |
Successor to #402
Source/OCMock/en.lproj/InfoPlist.strings
which causes trouble for SPM and doesn't seem to be otherwise usedPublic
folder for SPM public headers, since SPM cannot choose headers out of a larger directory.The Public folder symbolic links to the public headers. Making a copy would be an alternative implementation that would allow other package manager implementations to be unchanged, but this seems to work and is easier to maintain.
Ideally all implementation would migrate to using a separate Public header folder implementation at some point.
Testing:
Fix #375