atomicbird
(Tom Harrington)
1
I'm working on something that will eventually be a package plugin. For testing, I need to be able to copy a source file as a resource, so that the unit test can evaluate a source code file as it would when run as a plugin. For what it's worth, the source file here is a Core Data model.
I have not found a good way to convince SPM to copy the file but not compile it.
I tried adding it as a .copy entry under .resources but I ended up with a compiled model in the resources directory. Adding it as an exclude for the target prevented compilation but also meant it didn't get copied. I made sure to list actual sources under sources but the data model gets compiled whenever it's not excluded.
For the moment I'm working around it by adding a bogus extra file extension to the data model, so that it's not recognized as being compilable. That's awkward because (a) I can't edit the model in Xcode without changing the filename back, and (b) My code also looks at filenames, so a bogus extension conflicts with how my own error checking should work.
Is there a proper way to fix this?
NeoNacho
(Boris Buegling)
2
Unfortunately a known issue, Xcode treats .copy like .process, only CLI SwiftPM makes an actual distinction.
atomicbird
(Tom Harrington)
4
Xcode uses a different version of SPM? I thought they were the same thing.