From 73f5ab9c61dc61f42a5635d83c5f231c2e717efa Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 18 Sep 2025 08:24:36 +0000 Subject: [PATCH 1/5] Fix Swift 6.2 compile issue around ExecutorFactory API The `ExecutorFactory` API was reverted in Swift 6.2, so we have to change the guard to Swift 6.3. --- .../JavaScriptEventLoop+ExecutorFactory.swift | 4 ++-- Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift index e92b12a6..574e8d03 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift @@ -7,7 +7,7 @@ import _Concurrency import _CJavaScriptKit -#if compiler(>=6.2) +#if compiler(>=6.3) // MARK: - MainExecutor Implementation // MainExecutor is used by the main actor to execute tasks on the main thread @@ -104,4 +104,4 @@ extension JavaScriptEventLoop: ExecutorFactory { } } -#endif // compiler(>=6.2) +#endif // compiler(>=6.3) diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift index 94678958..960a59be 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift @@ -119,9 +119,9 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable { private static func installGlobalExecutorIsolated() { guard !didInstallGlobalExecutor else { return } didInstallGlobalExecutor = true - #if compiler(>=6.2) + #if compiler(>=6.3) if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999, *) { - // For Swift 6.2 and above, we can use the new `ExecutorFactory` API + // For Swift 6.3 and above, we can use the new `ExecutorFactory` API _Concurrency._createExecutors(factory: JavaScriptEventLoop.self) } #else From 39f663c5060f63b8f21afab28a2f6b15837efbd2 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 18 Sep 2025 08:26:14 +0000 Subject: [PATCH 2/5] Update main snapshot toolchain on CI to 2025-09-14 --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b3f8900..a07d7391 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,12 +21,12 @@ jobs: target: "wasm32-unknown-wasi" - os: ubuntu-22.04 toolchain: - download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a-ubuntu22.04.tar.gz + download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a-ubuntu22.04.tar.gz wasi-backend: Node target: "wasm32-unknown-wasip1" - os: ubuntu-22.04 toolchain: - download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a-ubuntu22.04.tar.gz + download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a-ubuntu22.04.tar.gz wasi-backend: Node target: "wasm32-unknown-wasip1-threads" @@ -95,7 +95,7 @@ jobs: - uses: actions/checkout@v5 - uses: ./.github/actions/install-swift with: - download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a-ubuntu22.04.tar.gz + download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a-ubuntu22.04.tar.gz - run: make bootstrap - run: ./Utilities/bridge-js-generate.sh - name: Check if BridgeJS generated files are up-to-date @@ -112,7 +112,7 @@ jobs: - uses: actions/checkout@v5 - uses: ./.github/actions/install-swift with: - download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a-ubuntu22.04.tar.gz + download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a-ubuntu22.04.tar.gz - uses: swiftwasm/setup-swiftwasm@v2 id: setup-wasm32-unknown-wasip1 with: { target: wasm32-unknown-wasip1 } From a47795cc926e9f6f592dfab7a0e0ebedba1be541 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 18 Sep 2025 14:04:24 +0000 Subject: [PATCH 3/5] Skip swift-testing tests for Swift 6.3 --- Plugins/PackageToJS/Tests/ExampleTests.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Plugins/PackageToJS/Tests/ExampleTests.swift b/Plugins/PackageToJS/Tests/ExampleTests.swift index 8f08bdad..25d58273 100644 --- a/Plugins/PackageToJS/Tests/ExampleTests.swift +++ b/Plugins/PackageToJS/Tests/ExampleTests.swift @@ -246,6 +246,9 @@ extension Trait where Self == ConditionTrait { } } + // FIXME: This test fails on Swift 6.3 and later due to memory corruption + // Enable it back when https://github.com/swiftlang/swift-driver/pull/1987 is included in the snapshot + #if !compiler(>=6.3) @Test(.requireSwiftSDK) func testing() throws { let swiftSDKID = try #require(Self.getSwiftSDKID()) @@ -313,6 +316,7 @@ extension Trait where Self == ConditionTrait { } } #endif + #endif // compiler(>=6.3) @Test(.requireSwiftSDK(triple: "wasm32-unknown-wasip1-threads")) func multithreading() throws { @@ -338,6 +342,8 @@ extension Trait where Self == ConditionTrait { } } + // FIXME: This test fails on the current main snapshot + #if !compiler(>=6.3) @Test(.requireEmbeddedSwiftInToolchain(triple: "wasm32-unknown-none-wasm")) func embeddedWasmUnknownNone() throws { try withPackage(at: "Examples/Embedded") { packageDir, _, runSwift in @@ -349,6 +355,7 @@ extension Trait where Self == ConditionTrait { ) } } + #endif // compiler(>=6.3) @Test(.requireEmbeddedSwiftInSwiftSDK()) func embeddedWasmUnknownWasi() throws { From 35a9e0669f6915164ba3d3f04e59202eec9f1ba2 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 19 Sep 2025 04:13:16 +0000 Subject: [PATCH 4/5] Skip Embedded example build --- Utilities/build-examples.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Utilities/build-examples.sh b/Utilities/build-examples.sh index 2b51307d..4d99c862 100755 --- a/Utilities/build-examples.sh +++ b/Utilities/build-examples.sh @@ -2,11 +2,25 @@ set -euo pipefail +EXCLUDED_EXAMPLES=("Embedded") + for example in Examples/*; do + skip_example=false + for excluded in "${EXCLUDED_EXAMPLES[@]}"; do + if [[ "$example" == *"$excluded"* ]]; then + skip_example=true + break + fi + done + if [ "$skip_example" = true ]; then + echo "Skipping $example" + continue + fi + if [ -d "$example" ] && [ -f "$example/build.sh" ]; then echo "Building $example" set -x (cd "$example" && ./build.sh release) { set +x; } 2>/dev/null fi -done \ No newline at end of file +done From 5cb9bde5c54b1896ed94f6ff285046833c36c12e Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 19 Sep 2025 04:20:23 +0000 Subject: [PATCH 5/5] Skip embeddedWasmUnknownWasi on 6.3 --- Plugins/PackageToJS/Tests/ExampleTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/PackageToJS/Tests/ExampleTests.swift b/Plugins/PackageToJS/Tests/ExampleTests.swift index 25d58273..e1a103f4 100644 --- a/Plugins/PackageToJS/Tests/ExampleTests.swift +++ b/Plugins/PackageToJS/Tests/ExampleTests.swift @@ -355,7 +355,6 @@ extension Trait where Self == ConditionTrait { ) } } - #endif // compiler(>=6.3) @Test(.requireEmbeddedSwiftInSwiftSDK()) func embeddedWasmUnknownWasi() throws { @@ -369,6 +368,7 @@ extension Trait where Self == ConditionTrait { ) } } + #endif // compiler(>=6.3) @Test(.requireSwiftSDK) func continuationLeakInTest_XCTest() throws {