Unverified Commit d7a8dda2 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Dont update last compiled time when compilation is rejected (#41424)

parent a1852a19
...@@ -465,7 +465,6 @@ class DevFS { ...@@ -465,7 +465,6 @@ class DevFS {
generator.reset(); generator.reset();
} }
printTrace('Compiling dart to kernel with ${invalidatedFiles.length} updated files'); printTrace('Compiling dart to kernel with ${invalidatedFiles.length} updated files');
lastCompiled = DateTime.now();
final CompilerOutput compilerOutput = await generator.recompile( final CompilerOutput compilerOutput = await generator.recompile(
mainPath, mainPath,
invalidatedFiles, invalidatedFiles,
...@@ -475,6 +474,8 @@ class DevFS { ...@@ -475,6 +474,8 @@ class DevFS {
if (compilerOutput == null || compilerOutput.errorCount > 0) { if (compilerOutput == null || compilerOutput.errorCount > 0) {
return UpdateFSReport(success: false); return UpdateFSReport(success: false);
} }
// Only update the last compiled time if we successfully compiled.
lastCompiled = DateTime.now();
// list of sources that needs to be monitored are in [compilerOutput.sources] // list of sources that needs to be monitored are in [compilerOutput.sources]
sources = compilerOutput.sources; sources = compilerOutput.sources;
// //
......
...@@ -178,6 +178,7 @@ void main() { ...@@ -178,6 +178,7 @@ void main() {
testUsingContext('reports unsuccessful compile when errors are returned', () async { testUsingContext('reports unsuccessful compile when errors are returned', () async {
devFS = DevFS(vmService, 'test', tempDir); devFS = DevFS(vmService, 'test', tempDir);
await devFS.create(); await devFS.create();
final DateTime previousCompile = devFS.lastCompiled;
final RealMockResidentCompiler residentCompiler = RealMockResidentCompiler(); final RealMockResidentCompiler residentCompiler = RealMockResidentCompiler();
when(residentCompiler.recompile( when(residentCompiler.recompile(
...@@ -197,6 +198,7 @@ void main() { ...@@ -197,6 +198,7 @@ void main() {
); );
expect(report.success, false); expect(report.success, false);
expect(devFS.lastCompiled, previousCompile);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
}); });
......
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