This is something that has been bugging me for a while, and I wonder if there are any solutions or things that can help. I've been developing a Swift 6.0 app with Visual Studio Code and the latest Swift extension (v1.10.2). So far the improvements to swift-testing are nice, but I noticed that if I build and run the app normally from the command line, like this:
swift build
swift run
The app will take around 5-6 minutes to build and run, which I'm used to. HOWEVER, if I then use the Testing tab to run some of the tests, the entire app gets rebuilt, so I need to wait another 5-6 minutes before the tests run. I can run the tests and do incremental builds from there, but as soon as I run swift build or swift run again, then the app wants to rebuild itself completely again.
This appears to be due to the fact that these flags are used by the extension when running the tests:
So my question is, is there ANY way to get this to avoid from having to rebuild everything each time I switch between building/running and testing with the extension?
I am using the swift-6.0-DEVELOPMENT-SNAPSHOT-2024-06-19-a toolchain right now.
Seems like for now it helps to pass the -Xswiftc -DSWIFT_PM_SUPPORTS_SWIFT_TESTING flag to swift build to avoid doing a full rebuild when generating tests. It works until this issue gets fixed in the toolchain.