@@ -30,24 +30,12 @@ const List<String> _kDart2jsLinuxArgs = <String>[
30
30
];
31
31
32
32
const List <String > _kDart2WasmLinuxArgs = < String > [
33
- 'Artifact.engineDartAotRuntime .TargetPlatform.web_javascript' ,
34
- '--disable-dart-dev ' ,
35
- 'Artifact.dart2wasmSnapshot.TargetPlatform.web_javascript ' ,
33
+ 'Artifact.engineDartBinary .TargetPlatform.web_javascript' ,
34
+ 'compile ' ,
35
+ 'wasm ' ,
36
36
'--packages=.dart_tool/package_config.json' ,
37
- '--dart-sdk=Artifact.engineDartSdkPath.TargetPlatform.web_javascript' ,
38
- '--platform=HostArtifact.webPlatformKernelFolder/dart2wasm_platform.dill' ,
39
- ];
40
-
41
- const List <String > _kWasmOptLinuxArgrs = < String > [
42
- 'Artifact.wasmOptBinary.TargetPlatform.web_javascript' ,
43
- '--all-features' ,
44
- '--closed-world' ,
45
- '--traps-never-happen' ,
46
- '-O3' ,
47
- '--type-ssa' ,
48
- '--gufa' ,
49
- '-O3' ,
50
- '--type-merging' ,
37
+ '--extra-compiler-option=--dart-sdk=Artifact.engineDartSdkPath.TargetPlatform.web_javascript' ,
38
+ '--extra-compiler-option=--platform=HostArtifact.webPlatformKernelFolder/dart2wasm_platform.dill' ,
51
39
];
52
40
53
41
void main () {
@@ -920,7 +908,7 @@ void main() {
920
908
921
909
final File depFile = environment.buildDir.childFile ('dart2wasm.d' );
922
910
923
- final File outputJsFile = environment.buildDir.childFile ('main.dart.unopt. mjs' );
911
+ final File outputJsFile = environment.buildDir.childFile ('main.dart.mjs' );
924
912
processManager.addCommand (FakeCommand (
925
913
command: < String > [
926
914
..._kDart2WasmLinuxArgs,
@@ -929,32 +917,23 @@ void main() {
929
917
'-DBAZ=qux' ,
930
918
'-DFLUTTER_WEB_AUTO_DETECT=false' ,
931
919
'-DFLUTTER_WEB_USE_SKIA=true' ,
932
- '--depfile=${depFile .absolute .path }' ,
920
+ '--extra-compiler-option=--depfile=${depFile .absolute .path }' ,
921
+ '-O2' ,
922
+ '--no-name-section' ,
923
+ '-o' ,
924
+ environment.buildDir.childFile ('main.dart.wasm' ).absolute.path,
933
925
environment.buildDir.childFile ('main.dart' ).absolute.path,
934
- environment.buildDir.childFile ('main.dart.unopt.wasm' ).absolute.path,
935
926
],
936
927
onRun: (_) => outputJsFile..createSync ()..writeAsStringSync ('foo' ))
937
928
);
938
929
939
- processManager.addCommand (FakeCommand (
940
- command: < String > [
941
- ..._kWasmOptLinuxArgrs,
942
- environment.buildDir.childFile ('main.dart.unopt.wasm' ).absolute.path,
943
- '-o' ,
944
- environment.buildDir.childFile ('main.dart.wasm' ).absolute.path,
945
- ])
946
- );
947
-
948
930
await Dart2WasmTarget (
949
931
const WasmCompilerConfig (
950
932
renderer: WebRendererMode .canvaskit
951
933
)
952
934
).build (environment);
953
935
954
- expect (outputJsFile.existsSync (), isFalse);
955
- final File movedJsFile = environment.buildDir.childFile ('main.dart.mjs' );
956
- expect (movedJsFile.existsSync (), isTrue);
957
- expect (movedJsFile.readAsStringSync (), 'foo' );
936
+ expect (outputJsFile.existsSync (), isTrue);
958
937
}, overrides: < Type , Generator > {
959
938
ProcessManager : () => processManager,
960
939
}));
@@ -966,41 +945,31 @@ void main() {
966
945
967
946
final File depFile = environment.buildDir.childFile ('dart2wasm.d' );
968
947
969
- final File outputJsFile = environment.buildDir.childFile ('main.dart.unopt. mjs' );
948
+ final File outputJsFile = environment.buildDir.childFile ('main.dart.mjs' );
970
949
processManager.addCommand (FakeCommand (
971
950
command: < String > [
972
951
..._kDart2WasmLinuxArgs,
973
952
'-Ddart.vm.product=true' ,
974
953
'-DFLUTTER_WEB_AUTO_DETECT=false' ,
975
954
'-DFLUTTER_WEB_USE_SKIA=true' ,
976
- '--omit-type-checks' ,
977
- '--depfile=${depFile .absolute .path }' ,
955
+ '--extra-compiler-option=--depfile=${depFile .absolute .path }' ,
956
+ '-O4' ,
957
+ '--no-name-section' ,
958
+ '-o' ,
959
+ environment.buildDir.childFile ('main.dart.wasm' ).absolute.path,
978
960
environment.buildDir.childFile ('main.dart' ).absolute.path,
979
- environment.buildDir.childFile ('main.dart.unopt.wasm' ).absolute.path,
980
961
],
981
962
onRun: (_) => outputJsFile..createSync ()..writeAsStringSync ('foo' ))
982
963
);
983
964
984
- processManager.addCommand (FakeCommand (
985
- command: < String > [
986
- ..._kWasmOptLinuxArgrs,
987
- environment.buildDir.childFile ('main.dart.unopt.wasm' ).absolute.path,
988
- '-o' ,
989
- environment.buildDir.childFile ('main.dart.wasm' ).absolute.path,
990
- ])
991
- );
992
-
993
965
await Dart2WasmTarget (
994
966
const WasmCompilerConfig (
995
967
omitTypeChecks: true ,
996
968
renderer: WebRendererMode .canvaskit
997
969
)
998
970
).build (environment);
999
971
1000
- expect (outputJsFile.existsSync (), isFalse);
1001
- final File movedJsFile = environment.buildDir.childFile ('main.dart.mjs' );
1002
- expect (movedJsFile.existsSync (), isTrue);
1003
- expect (movedJsFile.readAsStringSync (), 'foo' );
972
+ expect (outputJsFile.existsSync (), isTrue);
1004
973
}, overrides: < Type , Generator > {
1005
974
ProcessManager : () => processManager,
1006
975
}));
@@ -1011,38 +980,29 @@ void main() {
1011
980
1012
981
final File depFile = environment.buildDir.childFile ('dart2wasm.d' );
1013
982
1014
- final File outputJsFile = environment.buildDir.childFile ('main.dart.unopt. mjs' );
983
+ final File outputJsFile = environment.buildDir.childFile ('main.dart.mjs' );
1015
984
processManager.addCommand (FakeCommand (
1016
985
command: < String > [
1017
986
..._kDart2WasmLinuxArgs,
1018
987
'-Ddart.vm.product=true' ,
1019
988
'-DFLUTTER_WEB_AUTO_DETECT=false' ,
1020
989
'-DFLUTTER_WEB_USE_SKIA=true' ,
1021
- '--depfile=${depFile .absolute .path }' ,
990
+ '--extra-compiler-option=--depfile=${depFile .absolute .path }' ,
991
+ '-O2' ,
992
+ '--no-minify' ,
993
+ '-o' ,
994
+ environment.buildDir.childFile ('main.dart.wasm' ).absolute.path,
1022
995
environment.buildDir.childFile ('main.dart' ).absolute.path,
1023
- environment.buildDir.childFile ('main.dart.unopt.wasm' ).absolute.path,
1024
996
], onRun: (_) => outputJsFile..createSync ()..writeAsStringSync ('foo' )));
1025
997
1026
- processManager.addCommand (FakeCommand (
1027
- command: < String > [
1028
- ..._kWasmOptLinuxArgrs,
1029
- '--debuginfo' ,
1030
- environment.buildDir.childFile ('main.dart.unopt.wasm' ).absolute.path,
1031
- '-o' ,
1032
- environment.buildDir.childFile ('main.dart.wasm' ).absolute.path,
1033
- ]));
1034
-
1035
998
await Dart2WasmTarget (
1036
999
const WasmCompilerConfig (
1037
1000
wasmOpt: WasmOptLevel .debug,
1038
1001
renderer: WebRendererMode .canvaskit
1039
1002
)
1040
1003
).build (environment);
1041
1004
1042
- expect (outputJsFile.existsSync (), isFalse);
1043
- final File movedJsFile = environment.buildDir.childFile ('main.dart.mjs' );
1044
- expect (movedJsFile.existsSync (), isTrue);
1045
- expect (movedJsFile.readAsStringSync (), 'foo' );
1005
+ expect (outputJsFile.existsSync (), isTrue);
1046
1006
}, overrides: < Type , Generator > {
1047
1007
ProcessManager : () => processManager,
1048
1008
}));
@@ -1060,9 +1020,11 @@ void main() {
1060
1020
'-Ddart.vm.product=true' ,
1061
1021
'-DFLUTTER_WEB_AUTO_DETECT=false' ,
1062
1022
'-DFLUTTER_WEB_USE_SKIA=true' ,
1063
- '--depfile=${depFile .absolute .path }' ,
1064
- environment.buildDir.childFile ('main.dart' ).absolute.path,
1023
+ '--extra-compiler-option=--depfile=${depFile .absolute .path }' ,
1024
+ '-O0' ,
1025
+ '-o' ,
1065
1026
environment.buildDir.childFile ('main.dart.wasm' ).absolute.path,
1027
+ environment.buildDir.childFile ('main.dart' ).absolute.path,
1066
1028
], onRun: (_) => outputJsFile..createSync ()..writeAsStringSync ('foo' )));
1067
1029
1068
1030
await Dart2WasmTarget (
@@ -1080,31 +1042,26 @@ void main() {
1080
1042
environment.defines[WasmCompilerConfig .kRunWasmOpt] = WasmOptLevel .defaultValue.name;
1081
1043
final File depFile = environment.buildDir.childFile ('dart2wasm.d' );
1082
1044
1083
- final File outputJsFile = environment.buildDir.childFile ('main.dart.unopt. mjs' );
1045
+ final File outputJsFile = environment.buildDir.childFile ('main.dart.mjs' );
1084
1046
processManager.addCommand (FakeCommand (
1085
1047
command: < String > [
1086
1048
..._kDart2WasmLinuxArgs,
1049
+ '--extra-compiler-option=--import-shared-memory' ,
1050
+ '--extra-compiler-option=--shared-memory-max-pages=32768' ,
1087
1051
'-Ddart.vm.product=true' ,
1088
1052
'-DFLUTTER_WEB_AUTO_DETECT=false' ,
1089
1053
'-DFLUTTER_WEB_USE_SKIA=false' ,
1090
1054
'-DFLUTTER_WEB_USE_SKWASM=true' ,
1091
- '--import-shared-memory' ,
1092
- '--shared-memory-max-pages=32768' ,
1093
- '--depfile=${depFile .absolute .path }' ,
1055
+ '--extra-compiler-option=--depfile=${depFile .absolute .path }' ,
1056
+ '-O2' ,
1057
+ '--no-name-section' ,
1058
+ '-o' ,
1059
+ environment.buildDir.childFile ('main.dart.wasm' ).absolute.path,
1094
1060
environment.buildDir.childFile ('main.dart' ).absolute.path,
1095
- environment.buildDir.childFile ('main.dart.unopt.wasm' ).absolute.path,
1096
1061
],
1097
1062
onRun: (_) => outputJsFile..createSync ()..writeAsStringSync ('foo' ))
1098
1063
);
1099
1064
1100
- processManager.addCommand (FakeCommand (
1101
- command: < String > [
1102
- ..._kWasmOptLinuxArgrs,
1103
- environment.buildDir.childFile ('main.dart.unopt.wasm' ).absolute.path,
1104
- '-o' ,
1105
- environment.buildDir.childFile ('main.dart.wasm' ).absolute.path,
1106
- ])
1107
- );
1108
1065
1109
1066
await Dart2WasmTarget (
1110
1067
const WasmCompilerConfig (
0 commit comments