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:
parent
91dcfc5dd2
commit
6acf76f7be
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user