Builtin "swift build" command invalidates cache for global command
See original GitHub issueWhenever I save a file in an SPM project, swift build will automatically be run. After that has happened, running swift test from my terminal rebuilds all dependencies and the source.
This is not the case if I just run swift build and then swift test straight from my terminal.
I can also see the issue in reverse, that is, after I have run swift build or swift test from the terminal, the build time is much longer in VS Code.
This leads to the very annoying workflow that I save a test file, then wait for everything to be rebuilt from scratch in VS Code, then finally run swift test which again rebuilds everything from scratch, and then runs the tests.
Happy to provide any more information that might be relevant ☺️
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
swift package purge-cache - Marco Eidinger
Learn about the global repository cache in Swift Package Manager, why it exists and when to clear it with the purge-cache subcommand.
Read more >Caching SwiftPM for iOS app build on CI env - Swift Forums
Disable caching for SPM build Regarding the discussion in #160 I think the module cache was barfing because… Disabling it for now.
Read more >Where is Swift Package Manager cache located (Xcode 12.5)?
Is the location outside of DerivedData folder so cache still persists somewhere in ~/Library/Caches and can be reused even for clean build?
Read more >Xcode Build Settings
A convenient reference of available build settings for Xcode projects.
Read more >Invalidate caches | IntelliJ IDEA Documentation - JetBrains
When you invalidate the cache, IntelliJ IDEA removes the cache files for all projects ever run in the current version of the IDE....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The workaround landed in 2.4.0.
@LinusU I could not find a solution on this by now. As a workaround we could add a new setting to allow passing a custom build path if this issue becomes too big.
This would additionally help others who want to automatically build their tests like https://github.com/jinmingjian/sde/pull/32, too.