File tree Expand file tree Collapse file tree 2 files changed +28
-7
lines changed
Sources/SwiftSDKGenerator/SwiftSDKRecipes
Tests/SwiftSDKGeneratorTests/SwiftSDKRecipes Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -125,13 +125,7 @@ package struct WebAssemblyRecipe: SwiftSDKRecipe {
125125 ? relativeToolchainDir. appending ( " usr/lib/swift " ) . string
126126 : tripleProperties. swiftStaticResourcesPath
127127
128- var finalTriple = targetTriple
129- if isForEmbeddedSwift {
130- metadata. targetTriples. removeValue ( forKey: targetTriple. triple)
131- finalTriple = Triple ( " wasm32-unknown-wasip1 " )
132- }
133-
134- metadata. targetTriples [ finalTriple. triple] = tripleProperties
128+ metadata. targetTriples [ targetTriple. triple] = tripleProperties
135129 }
136130
137131 package func makeSwiftSDK(
Original file line number Diff line number Diff line change @@ -99,4 +99,31 @@ final class WebAssemblyRecipeTests: XCTestCase {
9999 ]
100100 )
101101 }
102+
103+ func testMetadataWithEmbedded( ) {
104+ testMetadataWithEmbedded ( targetTriple: Triple ( " wasm32-unknown-wasip1 " ) )
105+ testMetadataWithEmbedded ( targetTriple: Triple ( " wasm32-unknown-wasip1-threads " ) )
106+ }
107+
108+ func testMetadataWithEmbedded( targetTriple: Triple ) {
109+ let recipe = self . createRecipe ( )
110+ var metadata = SwiftSDKMetadataV4 (
111+ targetTriples: [
112+ targetTriple. triple: . init( sdkRootPath: " ./WASI.sdk " )
113+ ]
114+ )
115+ let paths = PathsConfiguration (
116+ sourceRoot: " ./ " ,
117+ artifactID: " any-sdk-id " ,
118+ targetTriple: targetTriple
119+ )
120+ recipe. applyPlatformOptions (
121+ metadata: & metadata,
122+ paths: paths,
123+ targetTriple: targetTriple,
124+ isForEmbeddedSwift: true
125+ )
126+ // Should include the target we started with.
127+ XCTAssertNotNil ( metadata. targetTriples [ targetTriple. triple] )
128+ }
102129}
You can’t perform that action at this time.
0 commit comments