Use uris for hot reload invalidation. (#15698)

* Use uris for hot reload invalidation.

* Clean up unneccessary conversions

* add final.

* Revert sample change
This commit is contained in:
Alexander Aprelev 2018-03-19 11:17:16 -07:00 committed by GitHub
parent 91dcfc5dd2
commit 6acf76f7be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -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;

View File

@ -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;
}
}