Expose CuckooGenerator as executable product - #588
Conversation
|
In order to ensure successful compilation of @MatyasKriz please do let me know if you'd like me to bring any iOS compilation fixes as part of this MR or as a follow up MR. |
|
I didn't know that you intended to compile the generator for iOS, not sure if that can work, but if you can get it working it's up to you whether to include it in this PR or a follow-up one, I think it shouldn't be an issue either way since most users don't use CuckooGenerator this way. What I'm a bit hesitant about is that when CuckooGenerator is compilable for iOS, there won't be anything stopping users from using it in their app target instead of the test one, not sure if that happens due to bad README or speeding through without reading it. |
|
Hi @MatyasKriz Thanks for your response and sharing your views. The compilation for iOS is simply a side effect of running the build tool plugging when targeting that platform. As far as I have observed, there is no way of restricting a package (and its products) to a particular platform. Even if one does not mentioned them in the Package.swift file, it will end up defaulting to a minimum version. It is true that by opening up the executable as public product would allow that use case to occur. However, it seems to me that it wouldn't ever work on a platform other than MacOS/Linux. By complementing this with a potential mention on the README file, I believe we would be providing any consumer with enough information - I appreciate however this is very subjective :) In short, unless we consider modifying the plugin you provide (which I don't think we should consider as it would introduce unnecessary and niche complexity to this repo), I can't see any other way that allows us to enable the composition I'm trying to achieve. |
a843bb6 to
4fd486e
Compare
This allows any consumer of Cuckoo to build custom build plugins that rely on CuckooGenerator
Add iOS availability check to guarantee code compilation
Raises the macOS platform floor to 11.0, which XcodeProj 9.14.0 requires.
4fd486e to
d88523d
Compare
|
@MatyasKriz this is now finally ready to be reviewed as XcodeProj 9.13.0+ now has all necessary changes required to make this happen. |
MatyasKriz
left a comment
There was a problem hiding this comment.
Looks good, merging. We'll revisit this if users find themselves confused when adding the library.
Summary
Exposes
CuckooGeneratoras a public executable product so downstream consumers can buildcustom build plugins on top of it. In order to do so,
XcodeProjmust be bumped to 9.13.0+.Changes
Package.swift.executable(name: "CuckooGenerator", targets: ["CuckooGenerator"])product; bumpsXcodeProj9.9.0→9.14.0; raises.macOSplatform floor10.15→11.0Package.resolvedXcodeProj→9.14.0(eb001108...),originHashregeneratedGenerator/Sources/Internal/Helpers/Async+convenience.swift#available(macOS 14.0, *)→#available(macOS 14.0, iOS 17.0, *)— adds theiOSbranch needed now thatCuckooGeneratorcan be built for iOS as a side effect of the executable productVerification
swift package resolve— resolves cleanly against the newXcodeProjversion.swift build— full build succeeds (CuckooGeneratorandCuckooGenerator-toollink successfully).Things to call out to reviewers
by
XcodeProj9.14.0 itself (its manifest declares 11.0 as its floor), not a choice made here.Worth a one-line mention in the PR body since it's a compatibility change, not just a version bump.
CuckooGenerator: per the earlier PR discussion, exposing this as anexecutable product means it now also compiles for iOS as a side effect of the platform list,
even though it's really meant for host-side (macOS) tooling use. Nothing in
Package.swiftstops an app target from linking it. Confirm the README documents that this is intended for
build-tool/plugin use only, not for shipping inside an app target.
Cuckoo/mocking runtime code — this is purely packaging +dependency surface.