@@ -17,8 +17,6 @@ struct PackageToJS {
1717 struct BuildOptions {
1818 /// Product to build (default: executable target if there's only one)
1919 var product : String ?
20- /// Whether to split debug information into a separate file (default: false)
21- var splitDebug : Bool
2220 /// Whether to apply wasm-opt optimizations in release mode (default: true)
2321 var noOptimize : Bool
2422 /// The options for packaging
@@ -390,7 +388,7 @@ struct PackagingPlanner {
390388 buildOptions: PackageToJS . BuildOptions
391389 ) throws -> MiniMake . TaskKey {
392390 let ( allTasks, _, _, _) = try planBuildInternal (
393- make: & make, splitDebug : buildOptions . splitDebug , noOptimize: buildOptions. noOptimize
391+ make: & make, noOptimize: buildOptions. noOptimize
394392 )
395393 return make. addTask (
396394 inputTasks: allTasks, output: BuildPath ( phony: " all " ) , attributes: [ . phony, . silent]
@@ -399,7 +397,7 @@ struct PackagingPlanner {
399397
400398 private func planBuildInternal(
401399 make: inout MiniMake ,
402- splitDebug : Bool , noOptimize: Bool
400+ noOptimize: Bool
403401 ) throws -> (
404402 allTasks: [ MiniMake . TaskKey ] ,
405403 outputDirTask: MiniMake . TaskKey ,
@@ -435,25 +433,23 @@ struct PackagingPlanner {
435433
436434 if shouldOptimize {
437435 // Optimize the wasm in release mode
438- // If splitDebug is true, we need to place the DWARF-stripped wasm file (but "name" section remains)
439- // in the output directory.
440- let stripWasmPath = ( splitDebug ? outputDir : intermediatesDir) . appending ( path: wasmFilename + " .debug " )
436+ let wasmWithoutDwarfPath = intermediatesDir. appending ( path: wasmFilename + " .no-dwarf " )
441437
442438 // First, strip DWARF sections as their existence enables DWARF preserving mode in wasm-opt
443- let stripWasm = make. addTask (
439+ let wasmWithoutDwarf = make. addTask (
444440 inputFiles: [ selfPath, wasmProductArtifact] , inputTasks: [ outputDirTask, intermediatesDirTask] ,
445- output: stripWasmPath
441+ output: wasmWithoutDwarfPath
446442 ) {
447443 print ( " Stripping DWARF debug info... " )
448444 try system. wasmOpt ( [ " --strip-dwarf " , " --debuginfo " ] , input: $1. resolve ( path: wasmProductArtifact) . path, output: $1. resolve ( path: $0. output) . path)
449445 }
450446 // Then, run wasm-opt with all optimizations
451447 wasm = make. addTask (
452- inputFiles: [ selfPath, stripWasmPath ] , inputTasks: [ outputDirTask, stripWasm ] ,
448+ inputFiles: [ selfPath, wasmWithoutDwarfPath ] , inputTasks: [ outputDirTask, wasmWithoutDwarf ] ,
453449 output: finalWasmPath
454450 ) {
455451 print ( " Optimizing the wasm file... " )
456- try system. wasmOpt ( [ " -Os " ] , input: $1. resolve ( path: stripWasmPath ) . path, output: $1. resolve ( path: $0. output) . path)
452+ try system. wasmOpt ( [ " -Os " , " --debuginfo " ] , input: $1. resolve ( path: wasmWithoutDwarfPath ) . path, output: $1. resolve ( path: $0. output) . path)
457453 }
458454 } else {
459455 // Copy the wasm product artifact
@@ -522,7 +518,7 @@ struct PackagingPlanner {
522518 make: inout MiniMake
523519 ) throws -> ( rootTask: MiniMake . TaskKey , binDir: BuildPath ) {
524520 var ( allTasks, outputDirTask, intermediatesDirTask, packageJsonTask) = try planBuildInternal (
525- make: & make, splitDebug : false , noOptimize: false
521+ make: & make, noOptimize: false
526522 )
527523
528524 // Install npm dependencies used in the test harness
0 commit comments