@@ -60,9 +60,7 @@ class FrontendServerClient {
60
60
List <String > additionalSources = const [],
61
61
String ? nativeAssets,
62
62
}) async {
63
- var feServer = await Process .start (Platform .resolvedExecutable, [
64
- if (debug) '--observe' ,
65
- frontendServerPath ?? _feServerPath,
63
+ final commonArguments = < String > [
66
64
'--sdk-root' ,
67
65
sdkRoot ?? sdkDir,
68
66
'--platform=$platformKernel ' ,
@@ -90,7 +88,34 @@ class FrontendServerClient {
90
88
'--native-assets' ,
91
89
nativeAssets,
92
90
],
93
- ]);
91
+ ];
92
+ late final Process feServer;
93
+ if (frontendServerPath != null ) {
94
+ feServer = await Process .start (
95
+ Platform .resolvedExecutable,
96
+ < String > [
97
+ if (debug) '--observe' ,
98
+ frontendServerPath,
99
+ ] +
100
+ commonArguments,
101
+ );
102
+ } else if (File (_feServerAotSnapshotPath).existsSync ()) {
103
+ feServer = await Process .start (
104
+ _dartAotRuntimePath,
105
+ < String > [_feServerAotSnapshotPath] + commonArguments,
106
+ );
107
+ } else {
108
+ // AOT snapshots cannot be generated on IA32, so we need this fallback
109
+ // branch until support for IA32 is dropped (https://dartbug.com/49969).
110
+ feServer = await Process .start (
111
+ Platform .resolvedExecutable,
112
+ < String > [
113
+ if (debug) '--observe' ,
114
+ _feServerAppJitSnapshotPath,
115
+ ] +
116
+ commonArguments,
117
+ );
118
+ }
94
119
var feServerStdoutLines = StreamQueue (feServer.stdout
95
120
.transform (utf8.decoder)
96
121
.transform (const LineSplitter ()));
@@ -407,5 +432,10 @@ enum _RejectState {
407
432
done,
408
433
}
409
434
410
- final _feServerPath =
435
+ final _dartAotRuntimePath = p.join (sdkDir, 'bin' , 'dartaotruntime' );
436
+
437
+ final _feServerAppJitSnapshotPath =
411
438
p.join (sdkDir, 'bin' , 'snapshots' , 'frontend_server.dart.snapshot' );
439
+
440
+ final _feServerAotSnapshotPath =
441
+ p.join (sdkDir, 'bin' , 'snapshots' , 'frontend_server_aot.dart.snapshot' );
0 commit comments