I'm building an executable that depends on a library in another repo, 3rd party libraries (ArgumentParser, SwiftProtobuf, SwiftNumerics) and FoundationXML.
When I build, it is reported that the default cache locations cannot be created. The dependencies will then resolve and start fetching. Sometimes the fetches succeed, sometimes an error reporting that the requested version does not exist, even though it does (e.g. SwiftProtobuf 1.15.0).
On subsequent runs, the fetch process will succeed, and then the build will commence, but only complete part of the build. It will report "Build Completed!", but only a single dependency or two will have been built, and none of the main project.
A search of the swift-package-manager repo gives the warning text coming from the SwiftTool.getCachePath(filesystem:)
call:
I tried deleting those directories and checking permissions, but could not seem to avoid the warning. Is anyone else having this issue?
Full command output (with executable names changed to MyExecutable, dependent library changed to MyLibrary, and company changed to mycompany):
C:\Users\Matt\Desktop\MyExecutable>swift build -c release
warning: Failed creating default cache locations, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
warning: Failed creating default cache locations, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
Fetching https://github.com/mycompany/MyLibrary.git
Fetching https://github.com/apple/swift-protobuf.git
Fetching https://github.com/apple/swift-argument-parser.git
Fetching https://github.com/apple/swift-numerics.git
error: Dependencies could not be resolved because 'MyLibrary' 0.9.2 contains incompatible tools version (5.3.0) and root depends on 'MyLibrary' 0.9.2.
C:\Users\Matt\Desktop\MyExecutable>swift build -c release
warning: Failed creating default cache locations, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
warning: Failed creating default cache locations, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
Updating https://github.com/mycompany/MyLibrary.git
Updating https://github.com/apple/swift-argument-parser.git
Updating https://github.com/apple/swift-numerics.git
Updating https://github.com/apple/swift-protobuf.git
error: Dependencies could not be resolved because no versions of 'swift-protobuf' match the requirement 1.6.0..<2.0.0 and root depends on 'swift-protobuf' 1.6.0..<2.0.0.
C:\Users\Matt\Desktop\MyExecutable>swift build -c release
warning: Failed creating default cache locations, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
warning: Failed creating default cache locations, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
Updating https://github.com/apple/swift-protobuf.git
Updating https://github.com/apple/swift-argument-parser.git
Updating https://github.com/apple/swift-numerics.git
Updating https://github.com/mycompany/MyLibrary.git
Cloning https://github.com/apple/swift-numerics.git
Resolving https://github.com/apple/swift-numerics.git at 0.0.8
Cloning https://github.com/apple/swift-protobuf.git
Resolving https://github.com/apple/swift-protobuf.git at 1.15.0
Cloning https://github.com/mycompany/MyLibrary.git
Resolving https://github.com/mycompany/MyLibrary.git at 0.9.2
Cloning https://github.com/apple/swift-argument-parser.git
Resolving https://github.com/apple/swift-argument-parser.git at 0.3.2
[1/6] Compiling _NumericsShims _NumericsShims.c
C:\Users\Matt\Desktop\MyExecutable>swift build -c release
warning: Failed creating default cache locations, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
warning: Failed creating default cache locations, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
[1/1] Planning build
[1/1] Planning build
* Build Completed!
C:\Users\Matt\Desktop\MyExecutable>ls .build/x86_64-unknown-windows-msvc/release
MyLibraryC.product SwiftProtobuf.build MyLibrary-client.product description.json
MyExecutablePackageTests.product _NumericsShims.build MyLibrary-protobuf-test-client.product protoc-gen-swift.product
ModuleCache MyLibrary-cli.product MyLibrary-server.product
C:\Users\Matt\Desktop\MyExecutable>