Skip to content

Commit cc38f7a

Browse files
feat: Enable NIOFoundationCompat to compile using Swift for WebAssembly. Fix NIOCore WASI compilation issue. (#3422)
Fix Swift for WebAssembly compilation in NIOFoundationCompat. ### Motivation: NIO is a common dependency, and it is important to enable compiling NIO using Swift for WebAssembly. This PR fixes compilation for NIOFoundationCompat. ### Modifications: - Fix NIOFoundationCompat compilation ### Result: With these changes, the following build commands succeed: ✅ ``` swift build --swift-sdk wasm32-unknown-wasip1-threads --target NIOCore swift build --swift-sdk wasm32-unknown-wasip1-threads --target NIOFoundationCompat ``` ### Context: This PR is [part of a larger effort by PassiveLogic](PassiveLogic/swift-web-examples#1) to improve Swift for WebAssembly support
1 parent d963335 commit cc38f7a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/NIOFoundationCompat/WaitSpinningRunLoop.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if !os(WASI)
16+
1517
import Atomics
1618
import Foundation
1719
import NIOConcurrencyHelpers
@@ -70,3 +72,5 @@ extension EventLoopFuture {
7072
}
7173
}
7274
}
75+
76+
#endif // !os(WASI)

0 commit comments

Comments
 (0)