Reland: don't update last compile time when compilation is rejected. (#41580)
* dont update last compiled time when compilation is rejected
* lets try flushing, thats a neat trick
* windows man
* Update hot_reload_test.dart
* Update hot_reload_test.dart
* Update devfs.dart
* Update hot_reload_test.dart
* Update hot_reload_test.dart
* add test that verifies when compile is good that time is updated
* Update devfs_test.dart
diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart
index 8795c4d..366c698 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -445,6 +445,7 @@
}) async {
assert(trackWidgetCreation != null);
assert(generator != null);
+ final DateTime candidateCompileTime = DateTime.now();
// Update modified files
final String assetBuildDirPrefix = _asUriPath(getAssetBuildDirectory());
@@ -476,7 +477,6 @@
generator.reset();
}
printTrace('Compiling dart to kernel with ${invalidatedFiles.length} updated files');
- lastCompiled = DateTime.now();
final CompilerOutput compilerOutput = await generator.recompile(
mainPath,
invalidatedFiles,
@@ -486,6 +486,8 @@
if (compilerOutput == null || compilerOutput.errorCount > 0) {
return UpdateFSReport(success: false);
}
+ // Only update the last compiled time if we successfully compiled.
+ lastCompiled = candidateCompileTime;
// list of sources that needs to be monitored are in [compilerOutput.sources]
sources = compilerOutput.sources;
//