SwiftPM and Library Unit Testing

One issue with the committed generated schemes for the unit tests is that they propagate as clutter to library clients. See Firebase Flooding Project with Build Schemes · Issue #8167 · firebase/firebase-ios-sdk · GitHub.

Is there anyway to keep package schemes from showing up in client apps? Or any progress on the original issue of automated scheme generation support for library products?

2 Likes

Like we have swift build --target TargetName, do we have command to test specific target like swift test --target TargetName?

Yes we do:

swift test --filter TargetName

Run swift test --help for more information.

I am updating an internal SwiftPM package we've had for a few years. The package in the past was testable on macOS and the iOS simulator.

I am now adding an executable product and executableTarget that is macOS only. Is there a way to mark those product/target to only build on macOS?

More Details With Code Really the problem is that adding an `executableTarget` with `resources` leads to Xcode attempting to run `codesign`. Which then fails the build.
...
CodeSign /Users/lovelettr/Desktop/example-2/derivedData/Build/Products/Debug-iphonesimulator/example-1_example-2.bundle (in target 'example-1_example-2' from project 'example-1')
    cd /Users/lovelettr/Desktop/example-2

    Signing Identity:     "-"

    /usr/bin/codesign --force --sign - --timestamp\=none --generate-entitlement-der /Users/lovelettr/Desktop/example-2/derivedData/Build/Products/Debug-iphonesimulator/example-1_example-2.bundle
/Users/lovelettr/Desktop/example-2/derivedData/Build/Products/Debug-iphonesimulator/example-1_example-2.bundle: bundle format unrecognized, invalid, or unsuitable
Command CodeSign failed with a nonzero exit code

If you want to replicate the error locally go to: RLovelett/swiftpm-and-library-unit-testing: This is an example SwiftPM Package used to illustrate an error discussed on the Swift Forums (github.com) and run build.sh.