[dartdev] Use AOT frontend_server snapshot for --resident option

Change-Id: I467bf18b95c6852129be3363d9c6099d73b763ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322423
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Derek Xu 2023-08-29 19:44:29 +00:00 committed by Commit Queue
parent a083d44ddf
commit 26021dcc25
2 changed files with 34 additions and 10 deletions

View file

@ -135,16 +135,30 @@ Future<void> ensureCompilationServerIsRunning(
}
try {
Directory(p.dirname(serverInfoFile.path)).createSync(recursive: true);
// TODO: replace this with the AOT executable when that is built.
final frontendServerProcess = await Process.start(
sdk.dart,
[
sdk.frontendServerSnapshot,
'--resident-info-file-name=${serverInfoFile.path}'
],
workingDirectory: homeDir?.path,
mode: ProcessStartMode.detachedWithStdio,
);
late final Process frontendServerProcess;
if (File(sdk.frontendServerAotSnapshot).existsSync()) {
frontendServerProcess = await Process.start(
sdk.dartAotRuntime,
[
sdk.frontendServerAotSnapshot,
'--resident-info-file-name=${serverInfoFile.path}'
],
workingDirectory: homeDir?.path,
mode: ProcessStartMode.detachedWithStdio,
);
} else {
// AOT snapshots cannot be generated on IA32, so we need this fallback
// branch until support for IA32 is dropped (https://dartbug.com/49969).
frontendServerProcess = await Process.start(
sdk.dart,
[
sdk.frontendServerSnapshot,
'--resident-info-file-name=${serverInfoFile.path}'
],
workingDirectory: homeDir?.path,
mode: ProcessStartMode.detachedWithStdio,
);
}
final serverOutput =
String.fromCharCodes(await frontendServerProcess.stdout.first).trim();

View file

@ -29,6 +29,8 @@ class Sdk {
// if the SDK isn't completely built.
String get dart => Platform.resolvedExecutable;
String get dartAotRuntime => path.join(sdkPath, 'bin', 'dartaotruntime');
String get analysisServerSnapshot => path.absolute(
sdkPath,
'bin',
@ -56,6 +58,14 @@ class Sdk {
'snapshots',
'frontend_server.dart.snapshot',
);
String get frontendServerAotSnapshot => path.absolute(
sdkPath,
'bin',
'snapshots',
'frontend_server_aot.dart.snapshot',
);
String get devToolsBinaries => path.absolute(
sdkPath,
'bin',