Skip to content

Commit 68466e1

Browse files
Merge pull request #447 from swiftwasm/yt/fix-6.2-compile
Fix Swift 6.2 compile issue around ExecutorFactory API
2 parents 0b78561 + 5cb9bde commit 68466e1

File tree

5 files changed

+30
-9
lines changed

5 files changed

+30
-9
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
target: "wasm32-unknown-wasi"
2222
- os: ubuntu-22.04
2323
toolchain:
24-
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
24+
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
2525
wasi-backend: Node
2626
target: "wasm32-unknown-wasip1"
2727
- os: ubuntu-22.04
2828
toolchain:
29-
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
29+
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
3030
wasi-backend: Node
3131
target: "wasm32-unknown-wasip1-threads"
3232

@@ -95,7 +95,7 @@ jobs:
9595
- uses: actions/checkout@v5
9696
- uses: ./.github/actions/install-swift
9797
with:
98-
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
98+
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
9999
- run: make bootstrap
100100
- run: ./Utilities/bridge-js-generate.sh
101101
- name: Check if BridgeJS generated files are up-to-date
@@ -112,7 +112,7 @@ jobs:
112112
- uses: actions/checkout@v5
113113
- uses: ./.github/actions/install-swift
114114
with:
115-
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
115+
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
116116
- uses: swiftwasm/setup-swiftwasm@v2
117117
id: setup-wasm32-unknown-wasip1
118118
with: { target: wasm32-unknown-wasip1 }

Plugins/PackageToJS/Tests/ExampleTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ extension Trait where Self == ConditionTrait {
246246
}
247247
}
248248

249+
// FIXME: This test fails on Swift 6.3 and later due to memory corruption
250+
// Enable it back when https://github.com/swiftlang/swift-driver/pull/1987 is included in the snapshot
251+
#if !compiler(>=6.3)
249252
@Test(.requireSwiftSDK)
250253
func testing() throws {
251254
let swiftSDKID = try #require(Self.getSwiftSDKID())
@@ -313,6 +316,7 @@ extension Trait where Self == ConditionTrait {
313316
}
314317
}
315318
#endif
319+
#endif // compiler(>=6.3)
316320

317321
@Test(.requireSwiftSDK(triple: "wasm32-unknown-wasip1-threads"))
318322
func multithreading() throws {
@@ -338,6 +342,8 @@ extension Trait where Self == ConditionTrait {
338342
}
339343
}
340344

345+
// FIXME: This test fails on the current main snapshot
346+
#if !compiler(>=6.3)
341347
@Test(.requireEmbeddedSwiftInToolchain(triple: "wasm32-unknown-none-wasm"))
342348
func embeddedWasmUnknownNone() throws {
343349
try withPackage(at: "Examples/Embedded") { packageDir, _, runSwift in
@@ -362,6 +368,7 @@ extension Trait where Self == ConditionTrait {
362368
)
363369
}
364370
}
371+
#endif // compiler(>=6.3)
365372

366373
@Test(.requireSwiftSDK)
367374
func continuationLeakInTest_XCTest() throws {

Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import _Concurrency
88
import _CJavaScriptKit
99

10-
#if compiler(>=6.2)
10+
#if compiler(>=6.3)
1111

1212
// MARK: - MainExecutor Implementation
1313
// MainExecutor is used by the main actor to execute tasks on the main thread
@@ -104,4 +104,4 @@ extension JavaScriptEventLoop: ExecutorFactory {
104104
}
105105
}
106106

107-
#endif // compiler(>=6.2)
107+
#endif // compiler(>=6.3)

Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
119119
private static func installGlobalExecutorIsolated() {
120120
guard !didInstallGlobalExecutor else { return }
121121
didInstallGlobalExecutor = true
122-
#if compiler(>=6.2)
122+
#if compiler(>=6.3)
123123
if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999, *) {
124-
// For Swift 6.2 and above, we can use the new `ExecutorFactory` API
124+
// For Swift 6.3 and above, we can use the new `ExecutorFactory` API
125125
_Concurrency._createExecutors(factory: JavaScriptEventLoop.self)
126126
}
127127
#else

Utilities/build-examples.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,25 @@
22

33
set -euo pipefail
44

5+
EXCLUDED_EXAMPLES=("Embedded")
6+
57
for example in Examples/*; do
8+
skip_example=false
9+
for excluded in "${EXCLUDED_EXAMPLES[@]}"; do
10+
if [[ "$example" == *"$excluded"* ]]; then
11+
skip_example=true
12+
break
13+
fi
14+
done
15+
if [ "$skip_example" = true ]; then
16+
echo "Skipping $example"
17+
continue
18+
fi
19+
620
if [ -d "$example" ] && [ -f "$example/build.sh" ]; then
721
echo "Building $example"
822
set -x
923
(cd "$example" && ./build.sh release)
1024
{ set +x; } 2>/dev/null
1125
fi
12-
done
26+
done

0 commit comments

Comments
 (0)