Use source list from the compiler to track invalidated files for hot reload. (#29693)
* Use source list from the compiler to track invalidated files.
* Revert accidental change
* Fix first-time-seen-the-file logic
* Fix/simplify invalidate logic now that we can rely on compiler to let us know what is the cut-off point for invalidation.
* Update devfs mock to accommodate for new fields
* Fix deleted files case
* Analyzer found missing final
diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart
index ea63e73..b4c8293 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -387,6 +387,8 @@
String _packagesFilePath;
final Map<Uri, DevFSContent> _entries = <Uri, DevFSContent>{};
final Set<String> assetPathsToEvict = <String>{};
+ List<Uri> sources = <Uri>[];
+ DateTime lastCompiled;
Uri _baseUri;
Uri get baseUri => _baseUri;
@@ -439,7 +441,7 @@
bool fullRestart = false,
String projectRootPath,
@required String pathToReload,
- @required List<String> invalidatedFiles,
+ @required List<Uri> invalidatedFiles,
}) async {
assert(trackWidgetCreation != null);
assert(generator != null);
@@ -478,6 +480,7 @@
generator.reset();
}
printTrace('Compiling dart to kernel with ${invalidatedFiles.length} updated files');
+ lastCompiled = DateTime.now();
final CompilerOutput compilerOutput = await generator.recompile(
mainPath,
invalidatedFiles,
@@ -485,6 +488,7 @@
packagesFilePath : _packagesFilePath,
);
// list of sources that needs to be monitored are in [compilerOutput.sources]
+ sources = compilerOutput.sources;
//
// Don't send full kernel file that would overwrite what VM already
// started loading from.