Hello 馃憢
I'm attempting to add SwiftGen using Swift Package Manager and following the integration instructions here: https://github.com/SwiftGen/SwiftGen/blob/master/Documentation/Articles/Xcode-Integration.md
I notice that there isn't documentation on how to access the build script from a SPM installation and I was wondering if there is a preferred path format for locating the installation and calling the script.
I've attempted to use "$SOURCE_ROOT/SwiftGen/bin/swiftgen" and am getting warnings about an invalid file location.
Thanks for your help!
@IanHoar
From my previous experience with SPM, the previous syntax changed from:
swift run swiftgen
To the new one (and starting Xcode 11.4), you need to specify macOS: (it may not be exactly this, so I'll ask you to test):
/usr/bin/xcrun --sdk macosx swift run swiftgen
I thought SPM didn't support binary dependencies yet. (it's coming in 5.3)
How are you adding it to your project now? Is there something we should add to the documentation?
Maybe a question to @IanHoar , as I'm using Cocoapods for Swiftgen here.
I was just explaining how I call SPM compiled binaries on another projects since Xcode 11.4
For anyone interested, I'm currently using SwiftGen with SPM following this article
Couple of things I would like to add:
swift package update is no longer necessaryswift run --disable-automatic-resolution -c release swiftgen config run --config "$SRCROOT/Configs/.swiftgen.yml"
BuildTools/.build/checkouts/SwiftGen/templates@DenTelezhkin what issues does automatic package resolution cause? I was trying the --disable-automatic-resolution option in my GitHub Action that installs swift based tools (either downloads a cached version or builds it from source) and it made the build fail for SwiftLint at the latest version tag (0.40.3) on Linux (it didn't make any difference on macOS).
@Cyberbeni I don't remember exactly, but i think dependencies were not actually resolving without this flag on Xcode 11(super weird, but it is what it is).
BTW since then there were couple of adjustments in my flow, specifically:
I now use SwiftGen generation for input output files, that shipped in 6.4.0, and also 6.4.0 release instead of develop branch.
I've been working on switching our project structure to fully use SPM (see #793), it'll solve some of the workarounds that @DenTelezhkin mentioned. For example, step 5 won't be needed anymore, as SPM now supports resources (and we use it to our advantage).
The problem is that there's no easy solution to "add a build phase from SPM in your project", as SPM does not have this feature yet. SPM doesn't have the concept of build "tools" yet, and until it does we'll be stuck with these manual steps.
Most helpful comment
For anyone interested, I'm currently using SwiftGen with SPM following this article
Couple of things I would like to add:
swift package updateis no longer necessaryBuildTools/.build/checkouts/SwiftGen/templates