Unverified Commit 6acf76f7 authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Use uris for hot reload invalidation. (#15698)

* Use uris for hot reload invalidation.

* Clean up unneccessary conversions

* add final.

* Revert sample change
parent 91dcfc5d
......@@ -176,8 +176,8 @@ class ResidentCompiler {
final String inputKey = new Uuid().generateV4();
_server.stdin.writeln('recompile ${mainPath != null ? _mapFilename(mainPath) + " ": ""}$inputKey');
for (String filePath in invalidatedFiles) {
_server.stdin.writeln(_mapFilename(filePath));
for (String fileUri in invalidatedFiles) {
_server.stdin.writeln(_mapFileUri(fileUri));
}
_server.stdin.writeln(inputKey);
......@@ -276,6 +276,20 @@ class ResidentCompiler {
return filename;
}
String _mapFileUri(String fileUri) {
if (_fileSystemRoots != null) {
final String filename = Uri.parse(fileUri).toFilePath();
for (String root in _fileSystemRoots) {
if (filename.startsWith(root)) {
return new Uri(
scheme: _fileSystemScheme, path: filename.substring(root.length))
.toString();
}
}
}
return fileUri;
}
Future<dynamic> shutdown() {
_server.kill();
return _server.exitCode;
......
......@@ -487,7 +487,7 @@ class DevFS {
final DevFSContent content = dirtyEntries[uri];
if (content is DevFSFileContent) {
filesUris.add(uri);
invalidatedFiles.add(content.file.path);
invalidatedFiles.add(content.file.uri.toString());
numBytes -= content.size;
}
}
......
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