Unverified Commit fe310148 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tool] Remove extra usage of .packages in vm service API (#52845)

parent bec7f84a
...@@ -288,13 +288,11 @@ class FlutterDevice { ...@@ -288,13 +288,11 @@ class FlutterDevice {
bool pause = false, bool pause = false,
}) { }) {
final Uri deviceEntryUri = devFS.baseUri.resolveUri(globals.fs.path.toUri(entryPath)); final Uri deviceEntryUri = devFS.baseUri.resolveUri(globals.fs.path.toUri(entryPath));
final Uri devicePackagesUri = devFS.baseUri.resolve('.packages');
return <Future<Map<String, dynamic>>>[ return <Future<Map<String, dynamic>>>[
for (final Isolate isolate in vmService.vm.isolates) for (final Isolate isolate in vmService.vm.isolates)
isolate.reloadSources( isolate.reloadSources(
pause: pause, pause: pause,
rootLibUri: deviceEntryUri, rootLibUri: deviceEntryUri,
packagesUri: devicePackagesUri,
), ),
]; ];
} }
......
...@@ -460,7 +460,7 @@ class HotRunner extends ResidentRunner { ...@@ -460,7 +460,7 @@ class HotRunner extends ResidentRunner {
) { ) {
return Future.wait(<Future<void>>[ return Future.wait(<Future<void>>[
for (final FlutterView view in device.views) for (final FlutterView view in device.views)
view.runFromSource(entryUri, packagesUri, assetsDirectoryUri), view.runFromSource(entryUri, assetsDirectoryUri),
]); ]);
} }
......
...@@ -1040,14 +1040,12 @@ class VM extends ServiceObjectOwner { ...@@ -1040,14 +1040,12 @@ class VM extends ServiceObjectOwner {
Future<ServiceMap> runInView( Future<ServiceMap> runInView(
String viewId, String viewId,
Uri main, Uri main,
Uri packages,
Uri assetsDirectory, Uri assetsDirectory,
) { ) {
return invokeRpc<ServiceMap>('_flutter.runInView', return invokeRpc<ServiceMap>('_flutter.runInView',
params: <String, dynamic>{ params: <String, dynamic>{
'viewId': viewId, 'viewId': viewId,
'mainScript': main.toString(), 'mainScript': main.toString(),
'packagesFile': packages.toString(),
'assetDirectory': assetsDirectory.toString(), 'assetDirectory': assetsDirectory.toString(),
}); });
} }
...@@ -1256,7 +1254,6 @@ class Isolate extends ServiceObjectOwner { ...@@ -1256,7 +1254,6 @@ class Isolate extends ServiceObjectOwner {
Future<Map<String, dynamic>> reloadSources({ Future<Map<String, dynamic>> reloadSources({
bool pause = false, bool pause = false,
Uri rootLibUri, Uri rootLibUri,
Uri packagesUri,
}) async { }) async {
try { try {
final Map<String, dynamic> arguments = <String, dynamic>{ final Map<String, dynamic> arguments = <String, dynamic>{
...@@ -1265,9 +1262,6 @@ class Isolate extends ServiceObjectOwner { ...@@ -1265,9 +1262,6 @@ class Isolate extends ServiceObjectOwner {
if (rootLibUri != null) { if (rootLibUri != null) {
arguments['rootLibUri'] = rootLibUri.toString(); arguments['rootLibUri'] = rootLibUri.toString();
} }
if (packagesUri != null) {
arguments['packagesUri'] = packagesUri.toString();
}
final Map<String, dynamic> response = await invokeRpcRaw('_reloadSources', params: arguments); final Map<String, dynamic> response = await invokeRpcRaw('_reloadSources', params: arguments);
return response; return response;
} on rpc.RpcException catch (e) { } on rpc.RpcException catch (e) {
...@@ -1492,7 +1486,6 @@ class FlutterView extends ServiceObject { ...@@ -1492,7 +1486,6 @@ class FlutterView extends ServiceObject {
// TODO(johnmccutchan): Report errors when running failed. // TODO(johnmccutchan): Report errors when running failed.
Future<void> runFromSource( Future<void> runFromSource(
Uri entryUri, Uri entryUri,
Uri packagesUri,
Uri assetsDirectoryUri, Uri assetsDirectoryUri,
) async { ) async {
final String viewId = id; final String viewId = id;
...@@ -1511,7 +1504,6 @@ class FlutterView extends ServiceObject { ...@@ -1511,7 +1504,6 @@ class FlutterView extends ServiceObject {
}); });
await owner.vm.runInView(viewId, await owner.vm.runInView(viewId,
entryUri, entryUri,
packagesUri,
assetsDirectoryUri); assetsDirectoryUri);
await completer.future; await completer.future;
await owner.vm.refreshViews(waitForViews: true); await owner.vm.refreshViews(waitForViews: true);
......
...@@ -96,7 +96,7 @@ void main() { ...@@ -96,7 +96,7 @@ void main() {
final MockVM mockVM = MockVM(); final MockVM mockVM = MockVM();
when(mockVMService.vm).thenReturn(mockVM); when(mockVMService.vm).thenReturn(mockVM);
when(mockVM.isolates).thenReturn(<Isolate>[mockIsolate]); when(mockVM.isolates).thenReturn(<Isolate>[mockIsolate]);
when(mockFlutterView.runFromSource(any, any, any)).thenAnswer((Invocation invocation) async {}); when(mockFlutterView.runFromSource(any, any)).thenAnswer((Invocation invocation) async {});
when(mockFlutterDevice.stopEchoingDeviceLog()).thenAnswer((Invocation invocation) async { }); when(mockFlutterDevice.stopEchoingDeviceLog()).thenAnswer((Invocation invocation) async { });
when(mockFlutterDevice.observatoryUris).thenAnswer((_) => Stream<Uri>.value(testUri)); when(mockFlutterDevice.observatoryUris).thenAnswer((_) => Stream<Uri>.value(testUri));
when(mockFlutterDevice.connect( when(mockFlutterDevice.connect(
......
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