Swift Package Manager Support
Hi team, I would like to ask how to use with SPM.
I have checkout the modularization using SPM on PointFree. https://www.pointfree.co/episodes/ep171-modularization-part-1
I want to implement R.swift for each module. But I faced some problems.
- How to generate hosting bundle with Bundle.module
- How to run Rswift to generate files and put in each module.
I also tried that and ended up in a dependency cycle. I got two targets, the app target and a local SPM package ("Assets") offering a library target. After adding R.swift into the library target and the build script to the app target we run into a dependency cycle:
Cycle in dependencies between targets 'MyApp' and 'Assets'; building could produce unreliable results.
Cycle path: MyApp → Assets → MyApp
Cycle details:
→ Target 'MyApp' has target dependency on Target 'Assets'
→ Target 'Assets' has target dependency on Target 'Assets'
○ Target 'Assets' has compile command for Swift source files
○ That command depends on command in Target 'MyApp': script phase "R.Swift"
→ Target 'MyApp' has target dependency on Target 'Assets'
@keithcml I don't think that's fixable unless SPM supports build phase scripts. :(
@aregler then it is good as Swift5.6 will support that 😏
@keithcml are you referring to this proposal?
@fruitcoder exactly.. The code was merged so I think is is coming.
Xcode 13.3 Beta came out yesterday and it seems "Swift Packages now support build tool plugins" 🎉 In case anyone wants to try it out, this post might point you in the right direction.
Hey @keithcml, did you manage to create a plugin with the new Xcode beta? I have trouble to do so :(
Hi, I've tried to create SPM custom command for R.swift, but it's not working completely according to R.swift - is using xcodeproj for detecting resources in project. It's time to add possibility in R.swift to take package.swift resources.
My example of build tool plugin:
https://github.com/martinpristas/SPM-Plugins-Example
We couldn't make it work as well, so we switched to SwiftGen for now