TokamakUI / Tokamak

SwiftUI-compatible framework for building browser apps with WebAssembly and native apps for other platforms
Apache License 2.0
2.62k stars 111 forks source link

Build and test with SwiftWasm 5.6 on CI #475

Closed MaxDesiatov closed 2 years ago

MaxDesiatov commented 2 years ago

Had to drop support for Swift 5.4/5.5 and macOS 5.6 jobs, see https://github.com/TokamakUI/Tokamak/pull/475#issuecomment-1092662828 for more details.

Also applied a few formatting changes with the latest SwiftFormat.

MaxDesiatov commented 2 years ago

I'm seeing a validation issue in TokamakDemo.wasm binaries built with SwiftWasm 5.6:

% ../wasminspect/target/debug/wasminspect ./.build/debug/TokamakDemo.wasm
[2022-04-05T10:19:11Z WARN  wasminspect_debugger::debugger] type mismatch: expected i32 but nothing on stack (at offset 22347435)
type mismatch: expected i32 but nothing on stack (at offset 22347435)

Broken binary produced by SwiftWasm 5.6 is attached below. It's also reproducible with carton 0.13.0 on this branch with carton dev --product TokamakDemo.

TokamakDemo.wasm.zip

cc @kateinoigakukun

kateinoigakukun commented 2 years ago

I guess our WasmTransformer does something wrong...

kateinoigakukun commented 2 years ago

Please try again with https://github.com/swiftwasm/carton/pull/310

MaxDesiatov commented 2 years ago

I had to drop SwiftWasm 5.4/5.5, as those are incompatible with new package manifest format parsed by latest carton. Also makes sense to raise the requirement in our Package.swift to 5.6 to prevent users from stumbling upon that issue.

As a consequence, I had to disable macos-11 jobs, as macos-12 is not generally available yet on GHA, but they're required for Xcode 13.3 and Swift 5.6. I've submitted a request for macos-12 for TokamakUI org, but it hasn't been granted yet.

In a seemingly unrelated way GTK Swift 5.6 jobs are crashing on Linux with this error:

1.  Swift version 5.6 (swift-5.6-RELEASE)
2.  Compiling with the current language version
3.  While evaluating request TypeCheckSourceFileRequest(source_file "/home/runner/work/Tokamak/Tokamak/Sources/TokamakCore/ViewTraits/Transition/Transition.swift")
4.  While type-checking '_AnyTransitionModifier' (at /home/runner/work/Tokamak/Tokamak/Sources/TokamakCore/ViewTraits/Transition/Transition.swift:61:8)
5.  While type-checking 'isActive' (at /home/runner/work/Tokamak/Tokamak/Sources/TokamakCore/ViewTraits/Transition/Transition.swift:64:7)
6.  While evaluating request CheckRedeclarationRequest(TokamakCore.(file)._AnyTransitionModifier.isActive@/home/runner/work/Tokamak/Tokamak/Sources/TokamakCore/ViewTraits/Transition/Transition.swift:64:7)
7.  While building rewrite system for generic signature <τ_0_0 where τ_0_0 : _AnyTransitionModifier>

I'm disabling those jobs as well, until those compiler crashes are fixed.

MaxDesiatov commented 2 years ago

I managed to re-enable GTK Linux builds, turns out the compiler crash is fixed in swiftlang/swift:nightly Docker images.

carson-katri commented 2 years ago

Awesome, that’s the same error I was seeing on the fiber branch with the Linux builds, and was stumped.

ezraberch commented 2 years ago

Dropping support for Swift <5.6 should mean we can get rid of all of the references to earlier versions throughout the codebase.

i.e.

#if compiler(>=5.5) && (canImport(Concurrency) || canImport(_Concurrency))

MaxDesiatov commented 2 years ago

Thanks, that's a great point. I've addressed it in the latest commit.