mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[flutter_tool] Remove extra usage of .packages in vm service API (#52845)
This commit is contained in:
parent
bec7f84a57
commit
fe310148a1
@ -288,13 +288,11 @@ class FlutterDevice {
|
||||
bool pause = false,
|
||||
}) {
|
||||
final Uri deviceEntryUri = devFS.baseUri.resolveUri(globals.fs.path.toUri(entryPath));
|
||||
final Uri devicePackagesUri = devFS.baseUri.resolve('.packages');
|
||||
return <Future<Map<String, dynamic>>>[
|
||||
for (final Isolate isolate in vmService.vm.isolates)
|
||||
isolate.reloadSources(
|
||||
pause: pause,
|
||||
rootLibUri: deviceEntryUri,
|
||||
packagesUri: devicePackagesUri,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@ -460,7 +460,7 @@ class HotRunner extends ResidentRunner {
|
||||
) {
|
||||
return Future.wait(<Future<void>>[
|
||||
for (final FlutterView view in device.views)
|
||||
view.runFromSource(entryUri, packagesUri, assetsDirectoryUri),
|
||||
view.runFromSource(entryUri, assetsDirectoryUri),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -1040,14 +1040,12 @@ class VM extends ServiceObjectOwner {
|
||||
Future<ServiceMap> runInView(
|
||||
String viewId,
|
||||
Uri main,
|
||||
Uri packages,
|
||||
Uri assetsDirectory,
|
||||
) {
|
||||
return invokeRpc<ServiceMap>('_flutter.runInView',
|
||||
params: <String, dynamic>{
|
||||
'viewId': viewId,
|
||||
'mainScript': main.toString(),
|
||||
'packagesFile': packages.toString(),
|
||||
'assetDirectory': assetsDirectory.toString(),
|
||||
});
|
||||
}
|
||||
@ -1256,7 +1254,6 @@ class Isolate extends ServiceObjectOwner {
|
||||
Future<Map<String, dynamic>> reloadSources({
|
||||
bool pause = false,
|
||||
Uri rootLibUri,
|
||||
Uri packagesUri,
|
||||
}) async {
|
||||
try {
|
||||
final Map<String, dynamic> arguments = <String, dynamic>{
|
||||
@ -1265,9 +1262,6 @@ class Isolate extends ServiceObjectOwner {
|
||||
if (rootLibUri != null) {
|
||||
arguments['rootLibUri'] = rootLibUri.toString();
|
||||
}
|
||||
if (packagesUri != null) {
|
||||
arguments['packagesUri'] = packagesUri.toString();
|
||||
}
|
||||
final Map<String, dynamic> response = await invokeRpcRaw('_reloadSources', params: arguments);
|
||||
return response;
|
||||
} on rpc.RpcException catch (e) {
|
||||
@ -1492,7 +1486,6 @@ class FlutterView extends ServiceObject {
|
||||
// TODO(johnmccutchan): Report errors when running failed.
|
||||
Future<void> runFromSource(
|
||||
Uri entryUri,
|
||||
Uri packagesUri,
|
||||
Uri assetsDirectoryUri,
|
||||
) async {
|
||||
final String viewId = id;
|
||||
@ -1511,7 +1504,6 @@ class FlutterView extends ServiceObject {
|
||||
});
|
||||
await owner.vm.runInView(viewId,
|
||||
entryUri,
|
||||
packagesUri,
|
||||
assetsDirectoryUri);
|
||||
await completer.future;
|
||||
await owner.vm.refreshViews(waitForViews: true);
|
||||
|
||||
@ -96,7 +96,7 @@ void main() {
|
||||
final MockVM mockVM = MockVM();
|
||||
when(mockVMService.vm).thenReturn(mockVM);
|
||||
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.observatoryUris).thenAnswer((_) => Stream<Uri>.value(testUri));
|
||||
when(mockFlutterDevice.connect(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user