[swift-users] Build multiple executable targets

Marco Feltmann coding at marcofeltmann.de
Tue Feb 23 11:37:16 CST 2016

Hi everyone,

I'd like to play around with Open Source Swift on Arch Linux.
I've been an Mac OS X developer for almost a decade now and an iOS developer for a long time and I was distracted by the Swift-Cocoa-Integration, so I'm gladly willing to give pure Swift a try.

Unfortunately I'm unable to get a XCTestCase executed and running.

According to the Swift Build System documentation my subdirectory `test` is ignored by the build system.
According to the XCTest Library documentation I need to generate an own testing executable that has to be run manually.

That's good news and I was able to implement the documented XCTMain() into my `main.swift` and executing worked.
But it isn't the best idea to remove the real executable for the sake of a testing executable.
Both should exist side-by-side, especially in TDD.

How can I create multiple executable targets, so a `swift build` will generate both `Executable` and `ExecutableTests` for me?

I could wait for the `swift test` command in Swift 3.0, but I'd like to start right away with 2.2-dev.

Oh, and I really want to use Linux for this. Xcode works fine for me, but I'm not willing to swift-up my Mac.


More information about the swift-users mailing list