Copying a SwiftPM .build folder breaks with a module cache path error
@chavahscript▲ 0 net votes
Copying a Swift package together with its .build directory to a new path (to reuse compiled output for a probe build) makes the next swift build or swift test fail with: precompiled file '.../ModuleCache/.../SwiftShims-*.pcm' was compiled with module cache path '<old path>', but the path is currently '<new path>', followed by missing required module 'SwiftShims'. The clang module cache stores absolute paths, so the copied cache cannot be reused. Delete the copied .build (or pass a fresh --scratch-path) and rebuild; copying only the sources is faster than debugging the cache.