@@ -17,8 +17,6 @@ struct PackageToJS {
17
17
struct BuildOptions {
18
18
/// Product to build (default: executable target if there's only one)
19
19
var product : String ?
20
- /// Whether to split debug information into a separate file (default: false)
21
- var splitDebug : Bool
22
20
/// Whether to apply wasm-opt optimizations in release mode (default: true)
23
21
var noOptimize : Bool
24
22
/// The options for packaging
@@ -390,7 +388,7 @@ struct PackagingPlanner {
390
388
buildOptions: PackageToJS . BuildOptions
391
389
) throws -> MiniMake . TaskKey {
392
390
let ( allTasks, _, _, _) = try planBuildInternal (
393
- make: & make, splitDebug : buildOptions . splitDebug , noOptimize: buildOptions. noOptimize
391
+ make: & make, noOptimize: buildOptions. noOptimize
394
392
)
395
393
return make. addTask (
396
394
inputTasks: allTasks, output: BuildPath ( phony: " all " ) , attributes: [ . phony, . silent]
@@ -399,7 +397,7 @@ struct PackagingPlanner {
399
397
400
398
private func planBuildInternal(
401
399
make: inout MiniMake ,
402
- splitDebug : Bool , noOptimize: Bool
400
+ noOptimize: Bool
403
401
) throws -> (
404
402
allTasks: [ MiniMake . TaskKey ] ,
405
403
outputDirTask: MiniMake . TaskKey ,
@@ -435,25 +433,23 @@ struct PackagingPlanner {
435
433
436
434
if shouldOptimize {
437
435
// 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 " )
441
437
442
438
// First, strip DWARF sections as their existence enables DWARF preserving mode in wasm-opt
443
- let stripWasm = make. addTask (
439
+ let wasmWithoutDwarf = make. addTask (
444
440
inputFiles: [ selfPath, wasmProductArtifact] , inputTasks: [ outputDirTask, intermediatesDirTask] ,
445
- output: stripWasmPath
441
+ output: wasmWithoutDwarfPath
446
442
) {
447
443
print ( " Stripping DWARF debug info... " )
448
444
try system. wasmOpt ( [ " --strip-dwarf " , " --debuginfo " ] , input: $1. resolve ( path: wasmProductArtifact) . path, output: $1. resolve ( path: $0. output) . path)
449
445
}
450
446
// Then, run wasm-opt with all optimizations
451
447
wasm = make. addTask (
452
- inputFiles: [ selfPath, stripWasmPath ] , inputTasks: [ outputDirTask, stripWasm ] ,
448
+ inputFiles: [ selfPath, wasmWithoutDwarfPath ] , inputTasks: [ outputDirTask, wasmWithoutDwarf ] ,
453
449
output: finalWasmPath
454
450
) {
455
451
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)
457
453
}
458
454
} else {
459
455
// Copy the wasm product artifact
@@ -522,7 +518,7 @@ struct PackagingPlanner {
522
518
make: inout MiniMake
523
519
) throws -> ( rootTask: MiniMake . TaskKey , binDir: BuildPath ) {
524
520
var ( allTasks, outputDirTask, intermediatesDirTask, packageJsonTask) = try planBuildInternal (
525
- make: & make, splitDebug : false , noOptimize: false
521
+ make: & make, noOptimize: false
526
522
)
527
523
528
524
// Install npm dependencies used in the test harness
0 commit comments