@@ -140,15 +140,20 @@ public struct WebAssemblyRecipe: SwiftSDKRecipe {
140140 func copyTargetSwift( from distributionPath: FilePath , generator: SwiftSDKGenerator ) async throws {
141141 let pathsConfiguration = generator. pathsConfiguration
142142 logGenerationStep ( " Copying Swift core libraries for the target triple into Swift SDK bundle... " )
143- for (pathWithinPackage, pathWithinSwiftSDK) in [
144- ( " clang " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib " ) ) ,
145- ( " swift/clang " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift " ) ) ,
146- ( " swift/wasi " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift " ) ) ,
147- ( " swift_static/clang " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift_static " ) ) ,
148- ( " swift_static/wasi " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift_static " ) ) ,
149- ( " swift_static/shims " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift_static " ) ) ,
150- ( " swift_static/CoreFoundation " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift_static " ) ) ,
143+ for (pathWithinPackage, pathWithinSwiftSDK, isOptional) in [
144+ ( " clang " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib " ) , false ) ,
145+ ( " swift/clang " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift " ) , false ) ,
146+ ( " swift/wasi " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift " ) , false ) ,
147+ ( " swift_static/clang " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift_static " ) , false ) ,
148+ ( " swift_static/wasi " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift_static " ) , false ) ,
149+ ( " swift_static/shims " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift_static " ) , false ) ,
150+ // Mark CoreFoundation as optional until we set up build system to build it for WebAssembly
151+ ( " swift_static/CoreFoundation " , pathsConfiguration. toolchainDirPath. appending ( " usr/lib/swift_static " ) , true ) ,
151152 ] {
153+ if isOptional, !( await generator. doesFileExist ( at: distributionPath. appending ( pathWithinPackage) ) ) {
154+ logGenerationStep ( " Skipping optional path \( pathWithinPackage) " )
155+ continue
156+ }
152157 try await generator. rsync ( from: distributionPath. appending ( pathWithinPackage) , to: pathWithinSwiftSDK)
153158 }
154159 }
0 commit comments