Xcode 12.5b2 - unit testing target compile error with SPM dependency

This is still failing in 12.5b3 - is this an Xcode or an SPM bug?

Update: I may have found a workaround. If I remove the dependency on "MyLibrary" from "MyLibraryTestHelpers" (so it has no dependencies), then I can build my app for testing and run my unit tests just fine.

Of course, this means I can no longer compile "MyLibraryTestHelpers" in isolation using the Xcode scheme for that library - it complains about "No such module" because its trying to import MyLibrary and I'm no longer including it in its dependencies.

I feel like it should be declaring the modules it depends on but doing that prevents me from building my app test target. Removing them flips it around. I can probably live with this but there must be either a bug or I'm missing something obvious.

I've tried setting MyLibrary as dynamic to see if that solves the problem but then I just run into a code signing issue like this: Xcode 12.5 and automatic dynamic linking of products

2 Likes