Enable Hot Restart on Windows (#8548)
This commit is contained in:
committed by
GitHub
parent
1bb164ab0d
commit
e4f586d239
@@ -313,25 +313,23 @@ class HotRunner extends ResidentRunner {
|
||||
_devFS = null;
|
||||
}
|
||||
|
||||
Future<Null> _launchInView(String entryPath,
|
||||
String packagesPath,
|
||||
String assetsDirectoryPath) async {
|
||||
Future<Null> _launchInView(Uri entryUri,
|
||||
Uri packagesUri,
|
||||
Uri assetsDirectoryUri) async {
|
||||
FlutterView view = vmService.vm.mainView;
|
||||
return view.runFromSource(entryPath, packagesPath, assetsDirectoryPath);
|
||||
return view.runFromSource(entryUri, packagesUri, assetsDirectoryUri);
|
||||
}
|
||||
|
||||
Future<Null> _launchFromDevFS(ApplicationPackage package,
|
||||
String mainScript) async {
|
||||
String entryPath = fs.path.relative(mainScript, from: projectRootPath);
|
||||
String deviceEntryPath =
|
||||
_devFS.baseUri.resolve(entryPath).toFilePath();
|
||||
String devicePackagesPath =
|
||||
_devFS.baseUri.resolve('.packages').toFilePath();
|
||||
String deviceAssetsDirectoryPath =
|
||||
_devFS.baseUri.resolve(getAssetBuildDirectory()).toFilePath();
|
||||
await _launchInView(deviceEntryPath,
|
||||
devicePackagesPath,
|
||||
deviceAssetsDirectoryPath);
|
||||
String entryUri = fs.path.relative(mainScript, from: projectRootPath);
|
||||
Uri deviceEntryUri = _devFS.baseUri.resolveUri(fs.path.toUri(entryUri));
|
||||
Uri devicePackagesUri = _devFS.baseUri.resolve('.packages');
|
||||
Uri deviceAssetsDirectoryUri =
|
||||
_devFS.baseUri.resolveUri(fs.path.toUri(getAssetBuildDirectory()));
|
||||
await _launchInView(deviceEntryUri,
|
||||
devicePackagesUri,
|
||||
deviceAssetsDirectoryUri);
|
||||
}
|
||||
|
||||
Future<OperationResult> _restartFromSources() async {
|
||||
|
||||
@@ -710,15 +710,16 @@ class VM extends ServiceObjectOwner {
|
||||
}
|
||||
|
||||
Future<ServiceMap> runInView(String viewId,
|
||||
String main,
|
||||
String packages,
|
||||
String assetsDirectory) {
|
||||
Uri main,
|
||||
Uri packages,
|
||||
Uri assetsDirectory) {
|
||||
// TODO(goderbauer): Transfer Uri (instead of file path) when remote end supports it.
|
||||
return invokeRpc('_flutter.runInView',
|
||||
params: <String, dynamic> {
|
||||
'viewId': viewId,
|
||||
'mainScript': main,
|
||||
'packagesFile': packages,
|
||||
'assetDirectory': assetsDirectory
|
||||
'mainScript': main.toFilePath(windows: false),
|
||||
'packagesFile': packages.toFilePath(windows: false),
|
||||
'assetDirectory': assetsDirectory.toFilePath(windows: false)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1024,9 +1025,9 @@ class FlutterView extends ServiceObject {
|
||||
}
|
||||
|
||||
// TODO(johnmccutchan): Report errors when running failed.
|
||||
Future<Null> runFromSource(String entryPath,
|
||||
String packagesPath,
|
||||
String assetsDirectoryPath) async {
|
||||
Future<Null> runFromSource(Uri entryUri,
|
||||
Uri packagesUri,
|
||||
Uri assetsDirectoryUri) async {
|
||||
final String viewId = id;
|
||||
// When this completer completes the isolate is running.
|
||||
final Completer<Null> completer = new Completer<Null>();
|
||||
@@ -1040,9 +1041,9 @@ class FlutterView extends ServiceObject {
|
||||
}
|
||||
});
|
||||
await owner.vm.runInView(viewId,
|
||||
entryPath,
|
||||
packagesPath,
|
||||
assetsDirectoryPath);
|
||||
entryUri,
|
||||
packagesUri,
|
||||
assetsDirectoryUri);
|
||||
await completer.future;
|
||||
await owner.vm.refreshViews();
|
||||
await subscription.cancel();
|
||||
|
||||
Reference in New Issue
Block a user