@@ -235,33 +235,55 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
235
235
settings.executable_name = command_line.argv0 ();
236
236
}
237
237
238
- // Enable Observatory
239
- settings.enable_observatory =
238
+ // Enable the VM Service
239
+ settings.enable_vm_service =
240
+ !command_line.HasOption (FlagForSwitch (Switch::DisableVMService)) &&
241
+ // TODO(bkonyi): remove once flutter_tools no longer uses this option.
242
+ // See https://github.com/dart-lang/sdk/issues/50233
240
243
!command_line.HasOption (FlagForSwitch (Switch::DisableObservatory));
241
244
242
- // Enable mDNS Observatory Publication
243
- settings.enable_observatory_publication = !command_line.HasOption (
244
- FlagForSwitch (Switch::DisableObservatoryPublication));
245
-
246
- // Set Observatory Host
247
- if (command_line.HasOption (FlagForSwitch (Switch::DeviceObservatoryHost))) {
245
+ // Enable mDNS VM Service Publication
246
+ settings.enable_vm_service_publication =
247
+ !command_line.HasOption (
248
+ FlagForSwitch (Switch::DisableVMServicePublication)) &&
249
+ !command_line.HasOption (
250
+ FlagForSwitch (Switch::DisableObservatoryPublication));
251
+
252
+ // Set VM Service Host
253
+ if (command_line.HasOption (FlagForSwitch (Switch::DeviceVMServiceHost))) {
254
+ command_line.GetOptionValue (FlagForSwitch (Switch::DeviceVMServiceHost),
255
+ &settings.vm_service_host );
256
+ } else if (command_line.HasOption (
257
+ FlagForSwitch (Switch::DeviceObservatoryHost))) {
258
+ // TODO(bkonyi): remove once flutter_tools no longer uses this option.
259
+ // See https://github.com/dart-lang/sdk/issues/50233
248
260
command_line.GetOptionValue (FlagForSwitch (Switch::DeviceObservatoryHost),
249
- &settings.observatory_host );
261
+ &settings.vm_service_host );
250
262
}
251
- // Default the observatory port based on --ipv6 if not set.
252
- if (settings.observatory_host .empty ()) {
253
- settings.observatory_host =
263
+ // Default the VM Service port based on --ipv6 if not set.
264
+ if (settings.vm_service_host .empty ()) {
265
+ settings.vm_service_host =
254
266
command_line.HasOption (FlagForSwitch (Switch::IPv6)) ? " ::1"
255
267
: " 127.0.0.1" ;
256
268
}
257
269
258
- // Set Observatory Port
259
- if (command_line.HasOption (FlagForSwitch (Switch::DeviceObservatoryPort))) {
270
+ // Set VM Service Port
271
+ if (command_line.HasOption (FlagForSwitch (Switch::DeviceVMServicePort))) {
272
+ if (!GetSwitchValue (command_line, Switch::DeviceVMServicePort,
273
+ &settings.vm_service_port )) {
274
+ FML_LOG (INFO)
275
+ << " VM Service port specified was malformed. Will default to "
276
+ << settings.vm_service_port ;
277
+ }
278
+ } else if (command_line.HasOption (
279
+ FlagForSwitch (Switch::DeviceObservatoryPort))) {
280
+ // TODO(bkonyi): remove once flutter_tools no longer uses this option.
281
+ // See https://github.com/dart-lang/sdk/issues/50233
260
282
if (!GetSwitchValue (command_line, Switch::DeviceObservatoryPort,
261
- &settings.observatory_port )) {
283
+ &settings.vm_service_port )) {
262
284
FML_LOG (INFO)
263
- << " Observatory port specified was malformed. Will default to "
264
- << settings.observatory_port ;
285
+ << " VM Service port specified was malformed. Will default to "
286
+ << settings.vm_service_port ;
265
287
}
266
288
}
267
289
0 commit comments