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 { ...@@ -53,6 +53,13 @@ abstract class DevFSContent {
class DevFSFileContent extends DevFSContent { class DevFSFileContent extends DevFSContent {
DevFSFileContent(this.file); 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; final FileSystemEntity file;
FileSystemEntity _linkTarget; FileSystemEntity _linkTarget;
FileStat _fileStat; FileStat _fileStat;
...@@ -435,6 +442,15 @@ class DevFS { ...@@ -435,6 +442,15 @@ class DevFS {
String archivePath; String archivePath;
if (deviceUri.path.startsWith(assetBuildDirPrefix)) if (deviceUri.path.startsWith(assetBuildDirPrefix))
archivePath = deviceUri.path.substring(assetBuildDirPrefix.length); 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)) { if (content.isModified || (bundleDirty && archivePath != null)) {
dirtyEntries[deviceUri] = content; dirtyEntries[deviceUri] = content;
numBytes += content.size; numBytes += content.size;
......
...@@ -335,14 +335,8 @@ class HotRunner extends ResidentRunner { ...@@ -335,14 +335,8 @@ class HotRunner extends ResidentRunner {
} }
final Stopwatch restartTimer = new Stopwatch()..start(); final Stopwatch restartTimer = new Stopwatch()..start();
if (previewDart2) { // TODO(aam): Add generator reset logic once we switch to using incremental
for (FlutterDevice device in flutterDevices) { // compiler for full application recompilation on restart.
// Reset generator so that full kernel file is produced for VM to
// restart from.
if (device.generator != null)
device.generator.reset();
}
}
final bool updatedDevFS = await _updateDevFS(fullRestart: true); final bool updatedDevFS = await _updateDevFS(fullRestart: true);
if (!updatedDevFS) if (!updatedDevFS)
return new OperationResult(1, 'DevFS synchronization failed'); return new OperationResult(1, 'DevFS synchronization failed');
...@@ -574,6 +568,7 @@ class HotRunner extends ResidentRunner { ...@@ -574,6 +568,7 @@ class HotRunner extends ResidentRunner {
printTrace('Skipping reassemble because all isolates are paused.'); printTrace('Skipping reassemble because all isolates are paused.');
return new OperationResult(OperationResult.ok.code, reloadMessage); return new OperationResult(OperationResult.ok.code, reloadMessage);
} }
printTrace('Evicting dirty assets');
await _evictDirtyAssets(); await _evictDirtyAssets();
printTrace('Reassembling application'); printTrace('Reassembling application');
bool reassembleAndScheduleErrors = false; 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