mac-cain13 / R.swift

Strong typed, autocompleted resources like images, fonts and segues in Swift projects
MIT License
9.49k stars 763 forks source link

SPM integration in macCatalyst #881

Open myeyesareblind opened 8 months ago

myeyesareblind commented 8 months ago

I'm integrating Rswift using 'RswiftGeneratePublicResources' plugin. As in Migration guide.

It works perfectly fine for me on iOS. Not so well for my MacCatalyst target, unfortunately. Here is the relevant build failure:

PhaseScriptExecution R.swift\ generate\ resources\ for\ framework\ Math /Users/myeyesareblind/Library/Developer/Xcode/DerivedData/Vectornator-bstdkyysadugaocibnwvjnigazoy/Build/Intermediates.noindex/Standard.build/Debug-maccatalyst/Math.build/Script-255A358E2B6BC8F00077BFD3.sh (in target 'Math' from project 'Standard')
    cd /Users/myeyesareblind/Documents/vec3/Frameworks/Standard
    /bin/sh -c /Users/myeyesareblind/Library/Developer/Xcode/DerivedData/Vectornator-bstdkyysadugaocibnwvjnigazoy/Build/Intermediates.noindex/Standard.build/Debug-maccatalyst/Math.build/Script-255A358E2B6BC8F00077BFD3.sh

sandbox-exec: execvp() of '//Users/myeyesareblind/Library/Developer/Xcode/DerivedData/Vectornator-bstdkyysadugaocibnwvjnigazoy/Build/Products/Debug/rswift' failed: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

The interesting part

ls /Users/myeyesareblind/Library/Developer/Xcode/DerivedData/Vectornator-bstdkyysadugaocibnwvjnigazoy/Build/Products
Debug-maccatalyst

for unknown reason, 'rswift' binary is build into the 'Debug-maccatalyst' & searched inside 'Debug' folder. Which doesn't work. As far as I understand, this is a problem in the Xcode itself. (Why does it even build this tool for macCatalyst??) In case there are known workaround - please let me know.

My teammate also has experimented with plugin tools recently. Apparently, binary target do work properly. So packaging rswift into binary supposedly will work.