SPM does not synchronize build operations with resolve package operations, resulting in git dependencies checkouts running concurrently and corrupting repo state. The repro here involves the Swift VS Code extension automatically running resolve packages in the background while the user might be starting a build. This could be fixed at either the SPM level (more robust?) or the Swift VS Code extension (hence I also filed https://github.com/swift-server/vscode-swift/issues/547 )
Resolve package and build should not end up corrupting the repos of their git checkouts.
Actual behavior
With high likelihood, you will hit errors like:
fatal: not a git repository (or any of the parent directories): .git
error: input file 'C:\Code\swift-composable-architecture.build\checkouts\swift-argument-parser\Plugins\GenerateManual\GenerateManualPluginError.swift' was modified during the build
error: 'swift-benchmark': Failed to clone repository https://github.com/google/swift-benchmark:
Cloning into 'C:\Code\swift-composable-architecture.build\checkouts\swift-benchmark'...
error: could not write config file C:/Code/swift-composable-architecture/.build/checkouts/swift-benchmark/.git/config: No such file or directory
fatal: could not set 'core.logallrefupdates' to 'true'
The checkout might now be in a bad state where there will be compilation errors in dependencies because of missing files or similar issues. The workaround is to delete .build and rebuild.
Swift & OS version (output of swift --version ; uname -a)
compnerd.org Swift version 5.9-dev (LLVM 1626c3d9b5175d1, Swift 0c0ec72255527fa)
Target: x86_64-unknown-windows-msvc
sswg.swift-lang Version: 1.2.1
Windows 11
Description
SPM does not synchronize build operations with resolve package operations, resulting in git dependencies checkouts running concurrently and corrupting repo state. The repro here involves the Swift VS Code extension automatically running resolve packages in the background while the user might be starting a build. This could be fixed at either the SPM level (more robust?) or the Swift VS Code extension (hence I also filed https://github.com/swift-server/vscode-swift/issues/547 )
Migrated from https://github.com/apple/sourcekit-lsp/issues/740
Expected behavior
Resolve package and build should not end up corrupting the repos of their git checkouts.
Actual behavior
With high likelihood, you will hit errors like:
error: input file 'C:\Code\swift-composable-architecture.build\checkouts\swift-argument-parser\Plugins\GenerateManual\GenerateManualPluginError.swift' was modified during the build
error: 'swift-benchmark': Failed to clone repository https://github.com/google/swift-benchmark: Cloning into 'C:\Code\swift-composable-architecture.build\checkouts\swift-benchmark'... error: could not write config file C:/Code/swift-composable-architecture/.build/checkouts/swift-benchmark/.git/config: No such file or directory fatal: could not set 'core.logallrefupdates' to 'true'
The checkout might now be in a bad state where there will be compilation errors in dependencies because of missing files or similar issues. The workaround is to delete .build and rebuild.
Steps to reproduce
Swift Package Manager version/commit hash
No response
Swift & OS version (output of
swift --version ; uname -a
)compnerd.org Swift version 5.9-dev (LLVM 1626c3d9b5175d1, Swift 0c0ec72255527fa) Target: x86_64-unknown-windows-msvc sswg.swift-lang Version: 1.2.1 Windows 11