@@ -823,19 +823,13 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
823
823
args = append (args , "--asyncify" )
824
824
}
825
825
826
- exeunopt := result .Executable
827
-
828
- if config .Options .Work {
829
- // Keep the work direction around => don't overwrite the .wasm binary with the optimized version
830
- exeunopt += ".pre-wasm-opt"
831
- os .Rename (result .Executable , exeunopt )
832
- }
833
-
826
+ inputFile := result .Binary
827
+ result .Binary = result .Executable + ".wasmopt"
834
828
args = append (args ,
835
829
opt ,
836
830
"-g" ,
837
- exeunopt ,
838
- "--output" , result .Executable ,
831
+ inputFile ,
832
+ "--output" , result .Binary ,
839
833
)
840
834
841
835
wasmopt := goenv .Get ("WASMOPT" )
@@ -865,13 +859,15 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
865
859
866
860
// wasm-tools component embed -w wasi:cli/command
867
861
// $$(tinygo env TINYGOROOT)/lib/wasi-cli/wit/ main.wasm -o embedded.wasm
862
+ componentEmbedInputFile := result .Binary
863
+ result .Binary = result .Executable + ".wasm-component-embed"
868
864
args := []string {
869
865
"component" ,
870
866
"embed" ,
871
867
"-w" , witWorld ,
872
868
witPackage ,
873
- result . Executable ,
874
- "-o" , result .Executable ,
869
+ componentEmbedInputFile ,
870
+ "-o" , result .Binary ,
875
871
}
876
872
877
873
wasmtools := goenv .Get ("WASMTOOLS" )
@@ -888,11 +884,13 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
888
884
}
889
885
890
886
// wasm-tools component new embedded.wasm -o component.wasm
887
+ componentNewInputFile := result .Binary
888
+ result .Binary = result .Executable + ".wasm-component-new"
891
889
args = []string {
892
890
"component" ,
893
891
"new" ,
894
- result . Executable ,
895
- "-o" , result .Executable ,
892
+ componentNewInputFile ,
893
+ "-o" , result .Binary ,
896
894
}
897
895
898
896
if config .Options .PrintCommands != nil {
0 commit comments