Adds vmservices for getting iOS build options (#121736)
Adds vmservices for getting iOS build options
This commit is contained in:
@@ -560,18 +560,13 @@ class ResidentWebRunner extends ResidentRunner {
|
||||
// thrown if we're not already subscribed.
|
||||
}
|
||||
await setUpVmService(
|
||||
(String isolateId, {
|
||||
bool? force,
|
||||
bool? pause,
|
||||
}) async {
|
||||
reloadSources: (String isolateId, {bool? force, bool? pause}) async {
|
||||
await restart(pause: pause);
|
||||
},
|
||||
null,
|
||||
null,
|
||||
device!.device,
|
||||
null,
|
||||
printStructuredErrorLog,
|
||||
_vmService.service,
|
||||
device: device!.device,
|
||||
flutterProject: flutterProject,
|
||||
printStructuredErrorLogMethod: printStructuredErrorLog,
|
||||
vmService: _vmService.service,
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -329,6 +329,7 @@ class FlutterDevice {
|
||||
restart: restart,
|
||||
compileExpression: compileExpression,
|
||||
getSkSLMethod: getSkSLMethod,
|
||||
flutterProject: FlutterProject.current(),
|
||||
printStructuredErrorLogMethod: printStructuredErrorLogMethod,
|
||||
device: device,
|
||||
logger: globals.logger,
|
||||
|
||||
@@ -14,8 +14,13 @@ import 'base/logger.dart';
|
||||
import 'base/utils.dart';
|
||||
import 'convert.dart';
|
||||
import 'device.dart';
|
||||
import 'ios/xcodeproj.dart';
|
||||
import 'project.dart';
|
||||
import 'version.dart';
|
||||
|
||||
const String kResultType = 'type';
|
||||
const String kResultTypeSuccess = 'Success';
|
||||
|
||||
const String kGetSkSLsMethod = '_flutter.getSkSLs';
|
||||
const String kSetAssetBundlePathMethod = '_flutter.setAssetBundlePath';
|
||||
const String kFlushUIThreadTasksMethod = '_flutter.flushUIThreadTasks';
|
||||
@@ -165,6 +170,7 @@ typedef VMServiceConnector = Future<FlutterVmService> Function(Uri httpUri, {
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions compression,
|
||||
Device? device,
|
||||
@@ -175,15 +181,16 @@ typedef VMServiceConnector = Future<FlutterVmService> Function(Uri httpUri, {
|
||||
/// callbacks.
|
||||
///
|
||||
/// All parameters besides [vmService] may be null.
|
||||
Future<vm_service.VmService> setUpVmService(
|
||||
Future<vm_service.VmService> setUpVmService({
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
Device? device,
|
||||
GetSkSLMethod? skSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
vm_service.VmService vmService
|
||||
) async {
|
||||
required vm_service.VmService vmService,
|
||||
}) async {
|
||||
// Each service registration requires a request to the attached VM service. Since the
|
||||
// order of these requests does not matter, store each future in a list and await
|
||||
// all at the end of this method.
|
||||
@@ -198,7 +205,7 @@ Future<vm_service.VmService> setUpVmService(
|
||||
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{
|
||||
'type': 'Success',
|
||||
kResultType: kResultTypeSuccess,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -211,7 +218,7 @@ Future<vm_service.VmService> setUpVmService(
|
||||
await restart(pause: pause);
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{
|
||||
'type': 'Success',
|
||||
kResultType: kResultTypeSuccess,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -225,7 +232,7 @@ Future<vm_service.VmService> setUpVmService(
|
||||
versionJson['engineRevisionShort'] = version.engineRevisionShort;
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{
|
||||
'type': 'Success',
|
||||
kResultType: kResultTypeSuccess,
|
||||
...versionJson,
|
||||
},
|
||||
};
|
||||
@@ -246,7 +253,7 @@ Future<vm_service.VmService> setUpVmService(
|
||||
expression, definitions, typeDefinitions, libraryUri, klass,
|
||||
isStatic);
|
||||
return <String, Object>{
|
||||
'type': 'Success',
|
||||
kResultType: kResultTypeSuccess,
|
||||
'result': <String, String>{'kernelBytes': kernelBytesBase64},
|
||||
};
|
||||
});
|
||||
@@ -257,7 +264,7 @@ Future<vm_service.VmService> setUpVmService(
|
||||
final MemoryInfo result = await device.queryMemoryInfo();
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{
|
||||
'type': 'Success',
|
||||
kResultType: kResultTypeSuccess,
|
||||
...result.toJson(),
|
||||
},
|
||||
};
|
||||
@@ -270,19 +277,44 @@ Future<vm_service.VmService> setUpVmService(
|
||||
if (filename == null) {
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{
|
||||
'type': 'Success',
|
||||
kResultType: kResultTypeSuccess,
|
||||
},
|
||||
};
|
||||
}
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{
|
||||
'type': 'Success',
|
||||
kResultType: kResultTypeSuccess,
|
||||
'filename': filename,
|
||||
},
|
||||
};
|
||||
});
|
||||
registrationRequests.add(vmService.registerService('flutterGetSkSL', 'Flutter Tools'));
|
||||
}
|
||||
|
||||
if (flutterProject != null) {
|
||||
vmService.registerServiceCallback('flutterGetIOSBuildOptions', (Map<String, Object?> params) async {
|
||||
final XcodeProjectInfo? info = await flutterProject.ios.projectInfo();
|
||||
if (info == null) {
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{
|
||||
kResultType: kResultTypeSuccess,
|
||||
},
|
||||
};
|
||||
}
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{
|
||||
kResultType: kResultTypeSuccess,
|
||||
'targets': info.targets,
|
||||
'schemes': info.schemes,
|
||||
'buildConfigurations': info.buildConfigurations,
|
||||
},
|
||||
};
|
||||
});
|
||||
registrationRequests.add(
|
||||
vmService.registerService('flutterGetIOSBuildOptions', 'Flutter Tools'),
|
||||
);
|
||||
}
|
||||
|
||||
if (printStructuredErrorLogMethod != null) {
|
||||
vmService.onExtensionEvent.listen(printStructuredErrorLogMethod);
|
||||
registrationRequests.add(vmService
|
||||
@@ -319,15 +351,16 @@ Future<vm_service.VmService> setUpVmService(
|
||||
/// See: https://github.com/dart-lang/sdk/commit/df8bf384eb815cf38450cb50a0f4b62230fba217
|
||||
Future<FlutterVmService> connectToVmService(
|
||||
Uri httpUri, {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
|
||||
Device? device,
|
||||
required Logger logger,
|
||||
}) async {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
|
||||
Device? device,
|
||||
required Logger logger,
|
||||
}) async {
|
||||
final VMServiceConnector connector = context.get<VMServiceConnector>() ?? _connect;
|
||||
return connector(httpUri,
|
||||
reloadSources: reloadSources,
|
||||
@@ -336,6 +369,7 @@ Future<FlutterVmService> connectToVmService(
|
||||
compression: compression,
|
||||
device: device,
|
||||
getSkSLMethod: getSkSLMethod,
|
||||
flutterProject: flutterProject,
|
||||
printStructuredErrorLogMethod: printStructuredErrorLogMethod,
|
||||
logger: logger,
|
||||
);
|
||||
@@ -362,6 +396,7 @@ Future<FlutterVmService> _connect(
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
|
||||
Device? device,
|
||||
@@ -373,13 +408,14 @@ Future<FlutterVmService> _connect(
|
||||
);
|
||||
|
||||
final vm_service.VmService service = await setUpVmService(
|
||||
reloadSources,
|
||||
restart,
|
||||
compileExpression,
|
||||
device,
|
||||
getSkSLMethod,
|
||||
printStructuredErrorLogMethod,
|
||||
delegateService,
|
||||
reloadSources: reloadSources,
|
||||
restart: restart,
|
||||
compileExpression: compileExpression,
|
||||
device: device,
|
||||
skSLMethod: getSkSLMethod,
|
||||
flutterProject: flutterProject,
|
||||
printStructuredErrorLogMethod: printStructuredErrorLogMethod,
|
||||
vmService: delegateService,
|
||||
);
|
||||
|
||||
// This call is to ensure we are able to establish a connection instead of
|
||||
|
||||
Reference in New Issue
Block a user