Closed tishin closed 5 months ago
Looks like Foundation
file management is broken in Swift 5.10 on Windows. I made a trivial Swift script replicating extension api opening by Generator:
import Foundation
let url = URL(fileURLWithPath: "/Projects/SwiftGodot/Sources/ExtensionApi/extension_api.json")
print(try! Data(contentsOf: url))
It works fine on 5.9.2 release:
PS C:\Projects\UrlIssue> swift --version
Swift version 5.9.2 (swift-5.9.2-RELEASE)
Target: x86_64-unknown-windows-msvc
PS C:\Projects\UrlIssue> swift run
Building for debugging...
Build complete! (0.07s)
9467198 bytes
But fails on 5.10 release:
PS C:\Projects\UrlIssue> swift --version
Swift version 5.10 (swift-5.10-RELEASE)
Target: x86_64-unknown-windows-msvc
PS C:\Projects\UrlIssue> swift run
Building for debugging...
Build complete! (0.13s)
Generator/main.swift:4: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"
Current stack trace:
0 (null) 0x00007fffe8764ae0 swift_stdlib_reportFatalErrorInFile + 132
Reported the issue at https://github.com/apple/swift-corelibs-foundation/issues/4921
After fixing extension api reading Windows build still fails throwing a whole bunch of errors like
C:\Projects\SwiftGodot\Sources\SwiftGodot\Core\VariantCollection.swift:50:24: error: cannot find 'GArray' in scope
if let array = GArray (variant) {
^~~~~~
C:\Projects\SwiftGodot\Sources\SwiftGodot\Core\VariantRepresentable.swift:91:11: error: cannot find type 'Vector2' in scope
extension Vector2: SelfVariantRepresentable {
^~~~~~~
C:\Projects\SwiftGodot\Sources\SwiftGodot\Core\VariantRepresentable.swift:95:11: error: cannot find type 'Vector2i' in scope
extension Vector2i: SelfVariantRepresentable {
^~~~~~~~
C:\Projects\SwiftGodot\Sources\SwiftGodot\Core\VariantRepresentable.swift:99:11: error: cannot find type 'Rect2' in scope
extension Rect2: SelfVariantRepresentable {
^~~~~
and so on, basically it does not include generated sources into the build for some reason.
I'd guess that prebuildCommand
workaround does not work anymore. Need to test it on a simpler package.
Building SwiftGodot on Windows using Swift 5.10 fails during generator plugin execution: