@@ -235,33 +235,55 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
235235 settings.executable_name = command_line.argv0 ();
236236 }
237237
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
240243 !command_line.HasOption (FlagForSwitch (Switch::DisableObservatory));
241244
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
248260 command_line.GetOptionValue (FlagForSwitch (Switch::DeviceObservatoryHost),
249- &settings.observatory_host );
261+ &settings.vm_service_host );
250262 }
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 =
254266 command_line.HasOption (FlagForSwitch (Switch::IPv6)) ? " ::1"
255267 : " 127.0.0.1" ;
256268 }
257269
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
260282 if (!GetSwitchValue (command_line, Switch::DeviceObservatoryPort,
261- &settings.observatory_port )) {
283+ &settings.vm_service_port )) {
262284 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 ;
265287 }
266288 }
267289
0 commit comments