Commit 6c6d08b9 authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Keep incremental compiler state through full restart. (#12535)

* Keep incremental compiler state through full restart.

* Add todo

* Add todo
parent 3616ebbd
......@@ -53,6 +53,13 @@ abstract class DevFSContent {
class DevFSFileContent extends DevFSContent {
DevFSFileContent(this.file);
static DevFSFileContent clone(DevFSFileContent fsFileContent) {
final DevFSFileContent newFsFileContent = new DevFSFileContent(fsFileContent.file);
newFsFileContent._linkTarget = fsFileContent._linkTarget;
newFsFileContent._fileStat = fsFileContent._fileStat;
return newFsFileContent;
}
final FileSystemEntity file;
FileSystemEntity _linkTarget;
FileStat _fileStat;
......@@ -435,6 +442,15 @@ class DevFS {
String archivePath;
if (deviceUri.path.startsWith(assetBuildDirPrefix))
archivePath = deviceUri.path.substring(assetBuildDirPrefix.length);
// When doing full restart in preview-dart-2 mode, copy content so
// that isModified does not reset last check timestamp because we
// want to report all modified files to incremental compiler next time
// user does hot reload.
// TODO(aam): Remove this logic once we switch to using incremental
// compiler for full application compilation when doing full restart.
if (fullRestart && generator != null && content is DevFSFileContent) {
content = DevFSFileContent.clone(content);
}
if (content.isModified || (bundleDirty && archivePath != null)) {
dirtyEntries[deviceUri] = content;
numBytes += content.size;
......
......@@ -335,14 +335,8 @@ class HotRunner extends ResidentRunner {
}
final Stopwatch restartTimer = new Stopwatch()..start();
if (previewDart2) {
for (FlutterDevice device in flutterDevices) {
// Reset generator so that full kernel file is produced for VM to
// restart from.
if (device.generator != null)
device.generator.reset();
}
}
// TODO(aam): Add generator reset logic once we switch to using incremental
// compiler for full application recompilation on restart.
final bool updatedDevFS = await _updateDevFS(fullRestart: true);
if (!updatedDevFS)
return new OperationResult(1, 'DevFS synchronization failed');
......@@ -574,6 +568,7 @@ class HotRunner extends ResidentRunner {
printTrace('Skipping reassemble because all isolates are paused.');
return new OperationResult(OperationResult.ok.code, reloadMessage);
}
printTrace('Evicting dirty assets');
await _evictDirtyAssets();
printTrace('Reassembling application');
bool reassembleAndScheduleErrors = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment