Skip to content

Commit 53d1a47

Browse files
PackageToJS: Use the actual wasm filename in the final product
1 parent ec9470c commit 53d1a47

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

Plugins/PackageToJS/Sources/PackageToJS.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ struct PackagingPlanner {
357357
/// The directory for intermediate files
358358
let intermediatesDir: BuildPath
359359
/// The filename of the .wasm file
360-
let wasmFilename = "main.wasm"
360+
let wasmFilename: String
361361
/// The path to the .wasm product artifact
362362
let wasmProductArtifact: BuildPath
363363
/// The build configuration
@@ -374,6 +374,7 @@ struct PackagingPlanner {
374374
selfPackageDir: BuildPath,
375375
outputDir: BuildPath,
376376
wasmProductArtifact: BuildPath,
377+
wasmFilename: String,
377378
configuration: String,
378379
triple: String,
379380
selfPath: BuildPath = BuildPath(absolute: #filePath),
@@ -384,6 +385,7 @@ struct PackagingPlanner {
384385
self.selfPackageDir = selfPackageDir
385386
self.outputDir = outputDir
386387
self.intermediatesDir = intermediatesDir
388+
self.wasmFilename = wasmFilename
387389
self.selfPath = selfPath
388390
self.wasmProductArtifact = wasmProductArtifact
389391
self.configuration = configuration

Plugins/PackageToJS/Sources/PackageToJSPlugin.swift

+1
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ extension PackagingPlanner {
498498
selfPackageDir: BuildPath(absolute: selfPackage.directoryURL.path),
499499
outputDir: BuildPath(absolute: outputDir.path),
500500
wasmProductArtifact: BuildPath(absolute: wasmProductArtifact.path),
501+
wasmFilename: wasmProductArtifact.lastPathComponent,
501502
configuration: configuration,
502503
triple: triple,
503504
system: system

Plugins/PackageToJS/Tests/PackagingPlannerTests.swift

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import Testing
5353
selfPackageDir: BuildPath(prefix: "SELF_PACKAGE"),
5454
outputDir: BuildPath(prefix: "OUTPUT"),
5555
wasmProductArtifact: BuildPath(prefix: "WASM_PRODUCT_ARTIFACT"),
56+
wasmFilename: "main.wasm",
5657
configuration: configuration,
5758
triple: "wasm32-unknown-wasi",
5859
selfPath: BuildPath(prefix: "PLANNER_SOURCE_PATH"),
@@ -81,6 +82,7 @@ import Testing
8182
selfPackageDir: BuildPath(prefix: "SELF_PACKAGE"),
8283
outputDir: BuildPath(prefix: "OUTPUT"),
8384
wasmProductArtifact: BuildPath(prefix: "WASM_PRODUCT_ARTIFACT"),
85+
wasmFilename: "main.wasm",
8486
configuration: "debug",
8587
triple: "wasm32-unknown-wasi",
8688
selfPath: BuildPath(prefix: "PLANNER_SOURCE_PATH"),

0 commit comments

Comments
 (0)