From b2b4fb5cbf72a0ace54a441cd77b2ef4b4966655 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 23 May 2025 20:00:30 -0400 Subject: [PATCH] Start removing Observatory support and references (#169216) This change removes references to Observatory, including: - Deprecated flags - Deprecated embedder APIs - Outdated documentation - Documentation instances where "VM service" should have been used - Incorrectly named tests / directories As a part of this change, `--serve-observatory` is no longer a valid flag. Observatory is still available for now via the `_serveObservatory` RPC, but will be removed in a follow up PR once we've prepared for breakages in G3. Work towards https://github.com/dart-lang/sdk/issues/50233 FYI @a-siva --- bin/flutter | 2 +- bin/flutter-dev | 2 +- dev/tracing_tests/README.md | 2 +- .../testing/Running-and-writing-tests.md | 4 +- docs/tool/README.md | 4 +- ...g-custom-embedders-with-the-Flutter-CLI.md | 3 +- .../src/flutter/ci/builders/linux_unopt.json | 6 +-- .../src/flutter/docs/Debugging-the-engine.md | 2 +- engine/src/flutter/docs/Flutter's-modes.md | 29 ++++++----- .../impeller/docs/xcode_frame_capture.md | 4 +- engine/src/flutter/shell/common/switches.cc | 28 ++--------- engine/src/flutter/shell/common/switches.h | 27 ---------- .../flutter/embedding/engine/FlutterJNI.java | 14 ------ .../embedding/engine/FlutterShellArgs.java | 10 ---- .../ios/framework/Headers/FlutterEngine.h | 10 ---- .../ios/framework/Source/FlutterEngine.mm | 4 -- .../empty_main.dart | 0 .../{observatory => vm_service}/launcher.dart | 0 .../service_client.dart | 0 .../{observatory => vm_service}/test.dart | 12 ----- .../flutter/testing/android_systrace_test.py | 2 +- .../testing/dart/observatory/README.md | 6 +-- engine/src/flutter/testing/run_tests.py | 16 +++--- packages/flutter/lib/src/widgets/basic.dart | 2 +- .../lib/src/widgets/widget_inspector.dart | 5 +- .../flutter_driver/lib/src/driver/driver.dart | 7 ++- .../lib/src/commands/attach.dart | 4 -- .../lib/src/commands/daemon.dart | 2 - .../flutter_tools/lib/src/commands/run.dart | 2 - .../lib/src/commands/screenshot.dart | 1 - .../flutter_tools/lib/src/commands/test.dart | 2 - packages/flutter_tools/lib/src/device.dart | 10 +--- .../lib/src/proxied_devices/devices.dart | 4 +- .../lib/src/resident_runner.dart | 17 ------- packages/flutter_tools/lib/src/run_cold.dart | 8 --- packages/flutter_tools/lib/src/run_hot.dart | 5 -- .../lib/src/runner/flutter_command.dart | 26 +--------- .../lib/src/test/event_printer.dart | 7 +-- .../lib/src/test/flutter_tester_device.dart | 11 +---- .../lib/src/test/flutter_web_platform.dart | 1 + .../flutter_tester_device_test.dart | 4 +- .../test/event_printer_test.dart | 6 +-- .../flutter_attach_test.dart | 49 ------------------- .../test/integration.shard/test_driver.dart | 4 -- .../test/integration.shard/test_test.dart | 29 ----------- .../lib/src/fuchsia_remote_connection.dart | 2 +- 46 files changed, 60 insertions(+), 335 deletions(-) rename engine/src/flutter/shell/testing/{observatory => vm_service}/empty_main.dart (100%) rename engine/src/flutter/shell/testing/{observatory => vm_service}/launcher.dart (100%) rename engine/src/flutter/shell/testing/{observatory => vm_service}/service_client.dart (100%) rename engine/src/flutter/shell/testing/{observatory => vm_service}/test.dart (87%) diff --git a/bin/flutter b/bin/flutter index a3f1541532d..39d3aab8a6d 100755 --- a/bin/flutter +++ b/bin/flutter @@ -14,7 +14,7 @@ set -e # To debug the tool, you can uncomment the following lines to enable debug -# mode and set an observatory port: +# mode and set a VM service port: # FLUTTER_TOOL_ARGS="--enable-asserts $FLUTTER_TOOL_ARGS" # FLUTTER_TOOL_ARGS="$FLUTTER_TOOL_ARGS --observe=65432" diff --git a/bin/flutter-dev b/bin/flutter-dev index 100f998b032..b70147e14c0 100755 --- a/bin/flutter-dev +++ b/bin/flutter-dev @@ -19,7 +19,7 @@ set -e # the effects immediately, but is much slower than using the prebuilt snapshot. # To debug the tool, you can uncomment the following lines to enable debug -# mode and set an observatory port: +# mode and set a VM service port: # FLUTTER_TOOL_ARGS="--enable-asserts $FLUTTER_TOOL_ARGS" # FLUTTER_TOOL_ARGS="$FLUTTER_TOOL_ARGS --observe=65432" diff --git a/dev/tracing_tests/README.md b/dev/tracing_tests/README.md index b09135a9f5e..50725d17885 100644 --- a/dev/tracing_tests/README.md +++ b/dev/tracing_tests/README.md @@ -13,6 +13,6 @@ The strings in these files are used in `dev/bots/test.dart`. The tests in this folder must be run with `flutter test --enable-vmservice`, since they test that trace data is written to the timeline by connecting to -the observatory. +the VM service. These tests will fail if run without this flag. diff --git a/docs/contributing/testing/Running-and-writing-tests.md b/docs/contributing/testing/Running-and-writing-tests.md index 993d62752b8..ac1105b2ecd 100644 --- a/docs/contributing/testing/Running-and-writing-tests.md +++ b/docs/contributing/testing/Running-and-writing-tests.md @@ -36,9 +36,9 @@ application (which is necessary to use `flutter run` with a test). Unit tests run with `flutter test` run inside a headless flutter shell on your workstation, you won't see any UI. You can use `print` to generate console output or you can interact -with the Dart VM via the Dart Observatory at [http://localhost:8181/](http://localhost:8181/). +with the Dart VM via Flutter DevTools at [http://localhost:8181/](http://localhost:8181/). -To debug tests in Observatory, use the `--start-paused` option to start the test in a +To debug tests in Flutter DevTools, use the `--start-paused` option to start the test in a paused state and wait for connection from a debugger. This option lets you set breakpoints before the test runs. diff --git a/docs/tool/README.md b/docs/tool/README.md index 87e9952764c..b8cc911cba2 100644 --- a/docs/tool/README.md +++ b/docs/tool/README.md @@ -78,8 +78,8 @@ To run or debug the tests in IDE, make sure `FLUTTER_ROOT` directory is set up. For example, in Android Studio, select the configuration for the test, click "Edit Configurations...", under "Environment Variables" section, enter `FLUTTER_ROOT=directory_to_your_flutter_framework_repo`. -The pre-built flutter tool runs in release mode with the observatory off by default. -To enable debugging mode and the observatory on the `flutter` tool, uncomment the +The pre-built flutter tool runs in release mode with the Dart VM service off by default. +To enable debugging mode and Dart DevTools for the `flutter` tool, uncomment the `FLUTTER_TOOL_ARGS` line in the `bin/flutter` (or `bin/flutter-dev`) shell script. ## Debugging the `flutter` command-line tool in VS Code diff --git a/docs/tool/Using-custom-embedders-with-the-Flutter-CLI.md b/docs/tool/Using-custom-embedders-with-the-Flutter-CLI.md index cf15dac27bc..459dc29e155 100644 --- a/docs/tool/Using-custom-embedders-with-the-Flutter-CLI.md +++ b/docs/tool/Using-custom-embedders-with-the-Flutter-CLI.md @@ -21,6 +21,7 @@ The config file contains all the configured custom devices. To see documentation If your device is reachable via ssh, you can add it to the config with a guided setup using `flutter custom-devices add`. The setup really is self-explanatory, but for example for my Raspberry Pi, the setup looks like this: + ``` hannes@pop-os:~/devel$ flutter custom-devices add Please enter the id you want to device to have. Must contain only alphanumeric @@ -45,7 +46,7 @@ Please enter the command executed on the remote device for starting the app. flutter-pi /tmp/${appName} Should the device use port forwarding? Using port forwarding is the default because it works in all cases, however if your remote device has a static IP -address and you have a way of specifying the "--observatory-host=" engine +address and you have a way of specifying the "--vm-service-host=" engine option, you might prefer not using port forwarding. [Y/n] (empty for default) Enter the command executed on the remote device for taking a screenshot. diff --git a/engine/src/flutter/ci/builders/linux_unopt.json b/engine/src/flutter/ci/builders/linux_unopt.json index 7af97ebabf8..cbcbb38b908 100644 --- a/engine/src/flutter/ci/builders/linux_unopt.json +++ b/engine/src/flutter/ci/builders/linux_unopt.json @@ -80,11 +80,11 @@ }, { "language": "dart", - "name": "test: observatory and service protocol", - "script": "flutter/shell/testing/observatory/test.dart", + "name": "test: service protocol", + "script": "flutter/shell/testing/vm_service/test.dart", "parameters": [ "out/ci/host_debug_unopt/flutter_tester", - "flutter/shell/testing/observatory/empty_main.dart" + "flutter/shell/testing/vm_service/empty_main.dart" ] }, { diff --git a/engine/src/flutter/docs/Debugging-the-engine.md b/engine/src/flutter/docs/Debugging-the-engine.md index 6d358de97ed..23b9f83b019 100644 --- a/engine/src/flutter/docs/Debugging-the-engine.md +++ b/engine/src/flutter/docs/Debugging-the-engine.md @@ -161,7 +161,7 @@ Then you can open it in the debugger with: gdb build/linux/x64/debug/bundle/your_app_name ``` -Note that this won't help you debug the Dart portion of the app: this is just for debugging the engine code. If you need to simultaneously debug the Dart portion, you can connect to the observatory port given when you run the app in `gdb`. +Note that this won't help you debug the Dart portion of the app: this is just for debugging the engine code. If you need to simultaneously debug the Dart portion, you can connect to the VM service port given when you run the app in `gdb`. ## Logging in the engine diff --git a/engine/src/flutter/docs/Flutter's-modes.md b/engine/src/flutter/docs/Flutter's-modes.md index 5300a72d573..df3894d59fd 100644 --- a/engine/src/flutter/docs/Flutter's-modes.md +++ b/engine/src/flutter/docs/Flutter's-modes.md @@ -1,16 +1,15 @@ We aspire to reach a state where developers are able to use the following modes for running Flutter code. Our tools should not expose any other combinations of features or modes. Each mode corresponds to a separate build of the engine that we provide. -1. **Debug** mode on device (including simulators, emulators): Turns on all the assertions in the world, includes all debugging information, enables all the debugger aids (e.g. observatory) and service extensions. Optimizes for fast develop/run cycles. Does not optimize for execution speed, binary size, or deployment. Used by `flutter run`. Built with `sky/tools/gn --android` or `sky/tools/gn --ios`. Also sometimes called "**checked** mode" or "**slow** mode". +1. **Debug** mode on device (including simulators, emulators): Turns on all the assertions in the world, includes all debugging information, enables all the debugger aids (e.g. Flutter DevTools) and service extensions. Optimizes for fast develop/run cycles. Does not optimize for execution speed, binary size, or deployment. Used by `flutter run`. Built with `sky/tools/gn --android` or `sky/tools/gn --ios`. Also sometimes called "**checked** mode" or "**slow** mode". -2. **Release** mode on device (excluding simulators, emulators): Turns off all assertions, strips as much debugging information as possible, turns off all the debugger tools. Optimizes for fast startup, fast execution, small package sizes. Disables any debugging aids. Disables service extensions. Intended for deployment to end-users. Used by `flutter run --release`. Built with `sky/tools/gn --android --runtime-mode=release` or `sky/tools/gn --ios --runtime-mode=release`. +2. **Release** mode on device (excluding simulators, emulators): Turns off all assertions, strips as much debugging information as possible, turns off all the debugger tools. Optimizes for fast startup, fast execution, small package sizes. Disables any debugging aids. Disables service extensions. Intended for deployment to end-users. Used by `flutter run --release`. Built with `sky/tools/gn --android --runtime-mode=release` or `sky/tools/gn --ios --runtime-mode=release`. -3. **Profile** mode on device (excluding simulators, emulators): Same as release mode except that profile-mode service extensions (like the one that turns on the performance overlay) is enabled, and tracing is enabled, as well as the minimum required to support using the tracing information (e.g. observatory can probably connect to the process). Used by `flutter run --profile`. Built with `sky/tools/gn --android --runtime-mode=profile` or `sky/tools/gn --ios --runtime-mode=profile`. Not available on simulators or emulators because profiling on simulators is not representative of real performance. +3. **Profile** mode on device (excluding simulators, emulators): Same as release mode except that profile-mode service extensions (like the one that turns on the performance overlay) is enabled, and tracing is enabled, as well as the minimum required to support using the tracing information (e.g. Flutter DevTools can probably connect to the process). Used by `flutter run --profile`. Built with `sky/tools/gn --android --runtime-mode=profile` or `sky/tools/gn --ios --runtime-mode=profile`. Not available on simulators or emulators because profiling on simulators is not representative of real performance. 4. Headless **test** mode on desktop: Same as debug mode except headless and for desktop platforms. Used by `flutter test`. Built with `sky/tools/gn`. In addition, for our purposes during development, each of the above should be able to be built in two modes: optimized, which is what end-developers use, and unoptimized, which is what we would use when debugging the engine. Optimized is the default, unoptimized engines are built by adding `--unoptimized` to the arguments. - ### Artifact differences Debug mode produces a script snapshot, which is basically tokenized sources. Comments and whitespace are missing, literals are canonicalized. There is no machine code, tree-shaking or obfuscation. @@ -21,22 +20,22 @@ Profile and release modes produce app-aot snapshots, either as dylibs (iOS and F The following axes, as described above, exist: -* debug, release, profile -* opt, unopt -* iOS, Android, macOS, Linux, Windows +- debug, release, profile +- opt, unopt +- iOS, Android, macOS, Linux, Windows In addition, some versions can select alternative graphics backends: -* iOS can choose between: OpenGL, software -* Android can choose between: Vulkan, OpenGL, software -* macOS can choose between, OpenGL, software, headless (debug only) -* Linux can choose between: OpenGL, software, headless (debug only) -* Windows can choose between: OpenGL, software, headless (debug only) +- iOS can choose between: OpenGL, software +- Android can choose between: Vulkan, OpenGL, software +- macOS can choose between, OpenGL, software, headless (debug only) +- Linux can choose between: OpenGL, software, headless (debug only) +- Windows can choose between: OpenGL, software, headless (debug only) Separate from all the above, Fuchsia has the following modes: -* AOT, JIT, interpreted DBC -* Observatory present, observatory absent -* opt, unopt +- AOT, JIT, interpreted DBC +- VM Service present, VM Service absent +- opt, unopt In total therefore there are 3×2×(2+3+2+2+2) + 1×2×3 + 3×2×2 modes, which is 84 modes. diff --git a/engine/src/flutter/impeller/docs/xcode_frame_capture.md b/engine/src/flutter/impeller/docs/xcode_frame_capture.md index 5d97feebf3d..987b05b79f0 100644 --- a/engine/src/flutter/impeller/docs/xcode_frame_capture.md +++ b/engine/src/flutter/impeller/docs/xcode_frame_capture.md @@ -110,6 +110,6 @@ You also need to set the `--enable_playground` flag in order to do frame capturi This is also the spot where you will add other command line arguments that will aid in your debugging. In that example, `–timeout=-1` will disable the Flutter test hang watchdog which will kill your process if the test doesn’t complete in -30 seconds. I also like to set the observatory port to a known value so I can +30 seconds. I also like to set the VM service port to a known value so I can get to it and disable service auth codes so I can just refresh the page to -launch the latest version of the observatory. +connect to a new instance of the VM service. diff --git a/engine/src/flutter/shell/common/switches.cc b/engine/src/flutter/shell/common/switches.cc index 45b251532b2..8fbe60d079d 100644 --- a/engine/src/flutter/shell/common/switches.cc +++ b/engine/src/flutter/shell/common/switches.cc @@ -234,28 +234,16 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { // Enable the VM Service settings.enable_vm_service = - !command_line.HasOption(FlagForSwitch(Switch::DisableVMService)) && - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 - !command_line.HasOption(FlagForSwitch(Switch::DisableObservatory)); + !command_line.HasOption(FlagForSwitch(Switch::DisableVMService)); // Enable mDNS VM Service Publication - settings.enable_vm_service_publication = - !command_line.HasOption( - FlagForSwitch(Switch::DisableVMServicePublication)) && - !command_line.HasOption( - FlagForSwitch(Switch::DisableObservatoryPublication)); + settings.enable_vm_service_publication = !command_line.HasOption( + FlagForSwitch(Switch::DisableVMServicePublication)); // Set VM Service Host if (command_line.HasOption(FlagForSwitch(Switch::DeviceVMServiceHost))) { command_line.GetOptionValue(FlagForSwitch(Switch::DeviceVMServiceHost), &settings.vm_service_host); - } else if (command_line.HasOption( - FlagForSwitch(Switch::DeviceObservatoryHost))) { - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 - command_line.GetOptionValue(FlagForSwitch(Switch::DeviceObservatoryHost), - &settings.vm_service_host); } // Default the VM Service port based on --ipv6 if not set. if (settings.vm_service_host.empty()) { @@ -272,16 +260,6 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { << "VM Service port specified was malformed. Will default to " << settings.vm_service_port; } - } else if (command_line.HasOption( - FlagForSwitch(Switch::DeviceObservatoryPort))) { - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 - if (!GetSwitchValue(command_line, Switch::DeviceObservatoryPort, - &settings.vm_service_port)) { - FML_LOG(INFO) - << "VM Service port specified was malformed. Will default to " - << settings.vm_service_port; - } } settings.may_insecurely_connect_to_all_domains = !command_line.HasOption( diff --git a/engine/src/flutter/shell/common/switches.h b/engine/src/flutter/shell/common/switches.h index 238d890a962..c66eb12cef8 100644 --- a/engine/src/flutter/shell/common/switches.h +++ b/engine/src/flutter/shell/common/switches.h @@ -75,45 +75,18 @@ DEF_SWITCH(DeviceVMServiceHost, "The hostname/IP address on which the Dart VM Service should " "be served. If not set, defaults to 127.0.0.1 or ::1 depending on " "whether --ipv6 is specified.") -// TODO(bkonyi): remove once flutter_tools no longer uses this option. -// See https://github.com/dart-lang/sdk/issues/50233 -DEF_SWITCH( - DeviceObservatoryHost, - "observatory-host", - "(deprecated) The hostname/IP address on which the Dart VM Service should " - "be served. If not set, defaults to 127.0.0.1 or ::1 depending on " - "whether --ipv6 is specified.") DEF_SWITCH(DeviceVMServicePort, "vm-service-port", "A custom Dart VM Service port. The default is to pick a randomly " "available open port.") -// TODO(bkonyi): remove once flutter_tools no longer uses this option. -// See https://github.com/dart-lang/sdk/issues/50233 -DEF_SWITCH(DeviceObservatoryPort, - "observatory-port", - "(deprecated) A custom Dart VM Service port. The default is to pick " - "a randomly " - "available open port.") DEF_SWITCH( DisableVMService, "disable-vm-service", "Disable the Dart VM Service. The Dart VM Service is never available " "in release mode.") -// TODO(bkonyi): remove once flutter_tools no longer uses this option. -// See https://github.com/dart-lang/sdk/issues/50233 -DEF_SWITCH(DisableObservatory, - "disable-observatory", - "(deprecated) Disable the Dart VM Service. The Dart VM Service is " - "never available " - "in release mode.") DEF_SWITCH(DisableVMServicePublication, "disable-vm-service-publication", "Disable mDNS Dart VM Service publication.") -// TODO(bkonyi): remove once flutter_tools no longer uses this option. -// See https://github.com/dart-lang/sdk/issues/50233 -DEF_SWITCH(DisableObservatoryPublication, - "disable-observatory-publication", - "(deprecated) Disable mDNS Dart VM Service publication.") DEF_SWITCH(IPv6, "ipv6", "Bind to the IPv6 localhost address for the Dart VM Service. " diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index 8853e55c9dd..77d7269035f 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -257,20 +257,6 @@ public class FlutterJNI { return vmServiceUri; } - /** - * VM Service URI for the VM instance. - * - *

Its value is set by the native engine once {@link #init(Context, String[], String, String, - * String, long, int)} is run. - * - * @deprecated replaced by {@link #getVMServiceUri()}. - */ - @Deprecated - @Nullable - public static String getObservatoryUri() { - return vmServiceUri; - } - /** * Notifies the engine about the refresh rate of the display when the API level is below 30. * diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java index 36e5ef69089..ec819c6cc4a 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java @@ -61,9 +61,6 @@ public class FlutterShellArgs { public static final String ARG_VERBOSE_LOGGING = "--verbose-logging"; public static final String ARG_KEY_VM_SERVICE_PORT = "vm-service-port"; public static final String ARG_VM_SERVICE_PORT = "--vm-service-port="; - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 - public static final String ARG_KEY_OBSERVATORY_PORT = "observatory-port"; public static final String ARG_KEY_DART_FLAGS = "dart-flags"; public static final String ARG_DART_FLAGS = "--dart-flags"; @@ -83,13 +80,6 @@ public class FlutterShellArgs { int vmServicePort = intent.getIntExtra(ARG_KEY_VM_SERVICE_PORT, 0); if (vmServicePort > 0) { args.add(ARG_VM_SERVICE_PORT + Integer.toString(vmServicePort)); - } else { - // TODO(bkonyi): remove once flutter_tools no longer uses this option. - // See https://github.com/dart-lang/sdk/issues/50233 - vmServicePort = intent.getIntExtra(ARG_KEY_OBSERVATORY_PORT, 0); - if (vmServicePort > 0) { - args.add(ARG_VM_SERVICE_PORT + Integer.toString(vmServicePort)); - } } if (intent.getBooleanExtra(ARG_KEY_DISABLE_SERVICE_AUTH_CODES, false)) { args.add(ARG_DISABLE_SERVICE_AUTH_CODES); diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h b/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h index 931c8de7b09..0a67fd8d9be 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h @@ -411,16 +411,6 @@ FLUTTER_DARWIN_EXPORT */ @property(nonatomic, readonly) FlutterBasicMessageChannel* keyEventChannel; -/** - * The depcreated `NSURL` of the Dart VM Service for the service isolate. - * - * This is only set in debug and profile runtime modes, and only after the - * Dart VM Service is ready. In release mode or before the Dart VM Service has - * started, it returns `nil`. - */ -@property(nonatomic, readonly, nullable) - NSURL* observatoryUrl FLUTTER_DEPRECATED("Use vmServiceUrl instead"); - /** * The `NSURL` of the Dart VM Service for the service isolate. * diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 801a4debc0a..0390306bfc4 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -505,10 +505,6 @@ static constexpr int kNumProfilerSamplesPerSec = 5; _platformViewsController = nil; } -- (NSURL*)observatoryUrl { - return self.publisher.url; -} - - (NSURL*)vmServiceUrl { return self.publisher.url; } diff --git a/engine/src/flutter/shell/testing/observatory/empty_main.dart b/engine/src/flutter/shell/testing/vm_service/empty_main.dart similarity index 100% rename from engine/src/flutter/shell/testing/observatory/empty_main.dart rename to engine/src/flutter/shell/testing/vm_service/empty_main.dart diff --git a/engine/src/flutter/shell/testing/observatory/launcher.dart b/engine/src/flutter/shell/testing/vm_service/launcher.dart similarity index 100% rename from engine/src/flutter/shell/testing/observatory/launcher.dart rename to engine/src/flutter/shell/testing/vm_service/launcher.dart diff --git a/engine/src/flutter/shell/testing/observatory/service_client.dart b/engine/src/flutter/shell/testing/vm_service/service_client.dart similarity index 100% rename from engine/src/flutter/shell/testing/observatory/service_client.dart rename to engine/src/flutter/shell/testing/vm_service/service_client.dart diff --git a/engine/src/flutter/shell/testing/observatory/test.dart b/engine/src/flutter/shell/testing/vm_service/test.dart similarity index 87% rename from engine/src/flutter/shell/testing/observatory/test.dart rename to engine/src/flutter/shell/testing/vm_service/test.dart index 1318ccced53..6367e21d000 100644 --- a/engine/src/flutter/shell/testing/observatory/test.dart +++ b/engine/src/flutter/shell/testing/vm_service/test.dart @@ -58,23 +58,11 @@ Future testWebSocketProtocolRequest(Uri uri) async { } } -// Test accessing an Observatory UI asset. -Future testHttpAssetRequest(Uri uri) async { - uri = uri.replace(path: 'third_party/trace_viewer_full.html'); - final HttpClient client = HttpClient(); - final HttpClientRequest request = await client.getUrl(uri); - final HttpClientResponse response = await request.close(); - Expect.equals(response.statusCode, 200); - await response.drain(); - client.close(); -} - typedef TestFunction = Future Function(Uri uri); final List basicTests = [ testHttpProtocolRequest, testWebSocketProtocolRequest, - testHttpAssetRequest, ]; Future runTests(ShellLauncher launcher, List tests) async { diff --git a/engine/src/flutter/testing/android_systrace_test.py b/engine/src/flutter/testing/android_systrace_test.py index 9acf9b1c016..1805d66e856 100755 --- a/engine/src/flutter/testing/android_systrace_test.py +++ b/engine/src/flutter/testing/android_systrace_test.py @@ -67,7 +67,7 @@ def launch_package(package_name, activity_name, adb_path='adb'): stderr=subprocess.STDOUT) for line in logcat.stdout: print('>>>>>>>> ' + line.strip()) - if ('Observatory listening' in line) or ('Dart VM service is listening' in line): + if 'Dart VM service is listening' in line: logcat.kill() break diff --git a/engine/src/flutter/testing/dart/observatory/README.md b/engine/src/flutter/testing/dart/observatory/README.md index 41b57d88d8a..241faeabc6e 100644 --- a/engine/src/flutter/testing/dart/observatory/README.md +++ b/engine/src/flutter/testing/dart/observatory/README.md @@ -1,5 +1,5 @@ -Tests in this folder need to be run with the observatory enabled, e.g. to make +Tests in this folder need to be run with the Dart VM service enabled, e.g. to make VM service method calls. -The `run_tests.py` script disables the observatory for other tests in the -parent directory. \ No newline at end of file +The `run_tests.py` script disables the Dart VM service for other tests in the +parent directory. diff --git a/engine/src/flutter/testing/run_tests.py b/engine/src/flutter/testing/run_tests.py index eeacd250f7d..4734cc8244d 100755 --- a/engine/src/flutter/testing/run_tests.py +++ b/engine/src/flutter/testing/run_tests.py @@ -612,17 +612,17 @@ class FlutterTesterOptions(): self, multithreaded=False, enable_impeller=False, - enable_observatory=False, + enable_vm_service=False, expect_failure=False ): self.multithreaded = multithreaded self.enable_impeller = enable_impeller - self.enable_observatory = enable_observatory + self.enable_vm_service = enable_vm_service self.expect_failure = expect_failure def apply_args(self, command_args): - if not self.enable_observatory: - command_args.append('--disable-observatory') + if not self.enable_vm_service: + command_args.append('--disable-vm-service') if self.enable_impeller: command_args += ['--enable-impeller', '--enable-flutter-gpu'] @@ -867,15 +867,15 @@ def gather_dart_tests(build_dir, test_filter): cwd=dart_tests_dir, ) - dart_observatory_tests = glob.glob('%s/observatory/*_test.dart' % dart_tests_dir) + dart_vm_service_tests = glob.glob('%s/vm_service/*_test.dart' % dart_tests_dir) dart_tests = glob.glob('%s/*_test.dart' % dart_tests_dir) if 'release' not in build_dir: - for dart_test_file in dart_observatory_tests: + for dart_test_file in dart_vm_service_tests: if test_filter is not None and os.path.basename(dart_test_file) not in test_filter: logger.info("Skipping '%s' due to filter.", dart_test_file) else: - logger.info("Gathering dart test '%s' with observatory enabled", dart_test_file) + logger.info("Gathering dart test '%s' with VM service enabled", dart_test_file) for multithreaded in [False, True]: for enable_impeller in [False, True]: yield gather_dart_test( @@ -883,7 +883,7 @@ def gather_dart_tests(build_dir, test_filter): FlutterTesterOptions( multithreaded=multithreaded, enable_impeller=enable_impeller, - enable_observatory=True + enable_vm_service=True ) ) diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 8ceff607b19..dacdad29423 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -6990,7 +6990,7 @@ class MouseRegion extends SingleChildRenderObjectWidget { /// * [debugRepaintRainbowEnabled], a debugging flag to help visually monitor /// render tree repaints in a running app. /// * [debugProfilePaintsEnabled], a debugging flag to show render tree -/// repaints in the observatory's timeline view. +/// repaints in Flutter DevTools' timeline view. class RepaintBoundary extends SingleChildRenderObjectWidget { /// Creates a widget that isolates repaints. const RepaintBoundary({super.key, super.child}); diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index fbc9563b929..1b9044d198d 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -1820,7 +1820,7 @@ mixin WidgetInspectorService { /// Wrapper around `json.encode` that uses a ring of cached values to prevent /// the Dart garbage collector from collecting objects between when /// the value is returned over the VM service protocol and when the - /// separate observatory protocol command has to be used to retrieve its full + /// separate VM service protocol command has to be used to retrieve its full /// contents. // // TODO(jacobr): Replace this with a better solution once @@ -2804,8 +2804,7 @@ class _WidgetForTypeTests extends Widget { /// Select a location on your device or emulator and view what widgets and /// render object that best matches the location. An outline of the selected /// widget and terse summary information is shown on device with detailed -/// information is shown in the observatory or in IntelliJ when using the -/// Flutter Plugin. +/// information is shown in Flutter DevTools. /// /// The inspector has a select mode and a view mode. /// diff --git a/packages/flutter_driver/lib/src/driver/driver.dart b/packages/flutter_driver/lib/src/driver/driver.dart index fb2d6da01cf..5b1986d6f51 100644 --- a/packages/flutter_driver/lib/src/driver/driver.dart +++ b/packages/flutter_driver/lib/src/driver/driver.dart @@ -123,10 +123,9 @@ abstract class FlutterDriver { /// /// Resumes the application if it is currently paused (e.g. at a breakpoint). /// - /// The `dartVmServiceUrl` parameter is the URL to Dart observatory - /// (a.k.a. VM service). If not specified, the URL specified by the - /// `VM_SERVICE_URL` environment variable is used. One or the other must be - /// specified. + /// The `dartVmServiceUrl` parameter is the URL to the Dart VM service. If + /// not specified, the URL specified by the `VM_SERVICE_URL` environment + /// variable is used. One or the other must be specified. /// /// The `printCommunication` parameter determines whether the command /// communication between the test and the app should be printed to stdout. diff --git a/packages/flutter_tools/lib/src/commands/attach.dart b/packages/flutter_tools/lib/src/commands/attach.dart index 05fd9b5749c..813da2eec17 100644 --- a/packages/flutter_tools/lib/src/commands/attach.dart +++ b/packages/flutter_tools/lib/src/commands/attach.dart @@ -142,7 +142,6 @@ class AttachCommand extends FlutterCommand { usesTrackWidgetCreation(verboseHelp: verboseHelp); addDdsOptions(verboseHelp: verboseHelp); addDevToolsOptions(verboseHelp: verboseHelp); - addServeObservatoryOptions(verboseHelp: verboseHelp); usesDeviceTimeoutOption(); usesDeviceConnectionOption(); } @@ -208,8 +207,6 @@ known, it can be explicitly provided to attach via the command-line, e.g. return uri; } - bool get serveObservatory => boolArg('serve-observatory'); - String? get appId { return stringArg('app-id'); } @@ -487,7 +484,6 @@ known, it can be explicitly provided to attach via the command-line, e.g. enableDds: enableDds, ddsPort: ddsPort, devToolsServerAddress: devToolsServerAddress, - serveObservatory: serveObservatory, usingCISystem: usingCISystem, debugLogsDirectoryPath: debugLogsDirectoryPath, enableDevTools: boolArg(FlutterCommand.kEnableDevTools), diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index 1970058578d..9a486ab8545 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart @@ -1215,8 +1215,6 @@ class DeviceDomain extends Domain { return { 'started': result.started, 'vmServiceUri': result.vmServiceUri?.toString(), - // TODO(bkonyi): remove once clients have migrated to relying on vmServiceUri. - 'observatoryUri': result.vmServiceUri?.toString(), }; } diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart index ffc31feb73e..ceb589badce 100644 --- a/packages/flutter_tools/lib/src/commands/run.dart +++ b/packages/flutter_tools/lib/src/commands/run.dart @@ -214,7 +214,6 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment usesDeviceConnectionOption(); addDdsOptions(verboseHelp: verboseHelp); addDevToolsOptions(verboseHelp: verboseHelp); - addServeObservatoryOptions(verboseHelp: verboseHelp); addAndroidSpecificBuildOptions(hide: !verboseHelp); usesFatalWarningsOption(verboseHelp: verboseHelp); addEnableImpellerFlag(verboseHelp: verboseHelp); @@ -360,7 +359,6 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment enableImpeller: enableImpeller, enableVulkanValidation: enableVulkanValidation, uninstallFirst: uninstallFirst, - serveObservatory: boolArg('serve-observatory'), enableDartProfiling: enableDartProfiling, enableEmbedderApi: enableEmbedderApi, usingCISystem: usingCISystem, diff --git a/packages/flutter_tools/lib/src/commands/screenshot.dart b/packages/flutter_tools/lib/src/commands/screenshot.dart index 441338e7480..fb1d3a9bc49 100644 --- a/packages/flutter_tools/lib/src/commands/screenshot.dart +++ b/packages/flutter_tools/lib/src/commands/screenshot.dart @@ -29,7 +29,6 @@ class ScreenshotCommand extends FlutterCommand { ); argParser.addOption( _kVmServiceUrl, - aliases: ['observatory-url'], // for historical reasons valueHelp: 'URI', help: 'The VM Service URL to which to connect.\n' diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart index 6e3b84c04ba..92bc4c1e3d4 100644 --- a/packages/flutter_tools/lib/src/commands/test.dart +++ b/packages/flutter_tools/lib/src/commands/test.dart @@ -294,7 +294,6 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts { ); addDdsOptions(verboseHelp: verboseHelp); - addServeObservatoryOptions(verboseHelp: verboseHelp); usesFatalWarningsOption(verboseHelp: verboseHelp); } @@ -461,7 +460,6 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts { buildInfo, startPaused: startPaused, disableServiceAuthCodes: boolArg('disable-service-auth-codes'), - serveObservatory: boolArg('serve-observatory'), // On iOS >=14, keeping this enabled will leave a prompt on the screen. disablePortPublication: true, enableDds: enableDds, diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart index 3cdf50eaf8d..8bf3ebda6ce 100644 --- a/packages/flutter_tools/lib/src/device.dart +++ b/packages/flutter_tools/lib/src/device.dart @@ -968,7 +968,6 @@ class DebuggingOptions { this.enableImpeller = ImpellerStatus.platformDefault, this.enableVulkanValidation = false, this.uninstallFirst = false, - this.serveObservatory = false, this.enableDartProfiling = true, this.enableEmbedderApi = false, this.usingCISystem = false, @@ -1031,7 +1030,6 @@ class DebuggingOptions { fastStart = false, webEnableExpressionEvaluation = false, nativeNullAssertions = false, - serveObservatory = false, enableDevTools = false, ipv6 = false, google3WorkspaceRoot = null, @@ -1085,7 +1083,6 @@ class DebuggingOptions { required this.enableImpeller, required this.enableVulkanValidation, required this.uninstallFirst, - required this.serveObservatory, required this.enableDartProfiling, required this.enableEmbedderApi, required this.usingCISystem, @@ -1131,7 +1128,6 @@ class DebuggingOptions { final bool webUseSseForInjectedClient; final ImpellerStatus enableImpeller; final bool enableVulkanValidation; - final bool serveObservatory; final bool enableDartProfiling; final bool enableEmbedderApi; final bool usingCISystem; @@ -1281,7 +1277,6 @@ class DebuggingOptions { 'nativeNullAssertions': nativeNullAssertions, 'enableImpeller': enableImpeller.asBool, 'enableVulkanValidation': enableVulkanValidation, - 'serveObservatory': serveObservatory, 'enableDartProfiling': enableDartProfiling, 'enableEmbedderApi': enableEmbedderApi, 'usingCISystem': usingCISystem, @@ -1351,7 +1346,6 @@ class DebuggingOptions { enableImpeller: ImpellerStatus.fromBool(json['enableImpeller'] as bool?), enableVulkanValidation: (json['enableVulkanValidation'] as bool?) ?? false, uninstallFirst: (json['uninstallFirst'] as bool?) ?? false, - serveObservatory: (json['serveObservatory'] as bool?) ?? false, enableDartProfiling: (json['enableDartProfiling'] as bool?) ?? true, enableEmbedderApi: (json['enableEmbedderApi'] as bool?) ?? false, usingCISystem: (json['usingCISystem'] as bool?) ?? false, @@ -1364,9 +1358,7 @@ class DebuggingOptions { } class LaunchResult { - LaunchResult.succeeded({Uri? vmServiceUri, Uri? observatoryUri}) - : started = true, - vmServiceUri = vmServiceUri ?? observatoryUri; + LaunchResult.succeeded({this.vmServiceUri}) : started = true; LaunchResult.failed() : started = false, vmServiceUri = null; diff --git a/packages/flutter_tools/lib/src/proxied_devices/devices.dart b/packages/flutter_tools/lib/src/proxied_devices/devices.dart index f53b9765820..121ad9f3318 100644 --- a/packages/flutter_tools/lib/src/proxied_devices/devices.dart +++ b/packages/flutter_tools/lib/src/proxied_devices/devices.dart @@ -365,9 +365,7 @@ class ProxiedDevice extends Device { }), ); final bool started = _cast(result['started']); - // TODO(bkonyi): remove once clients have migrated to relying on vmServiceUri. - final String? vmServiceUriStr = - _cast(result['vmServiceUri']) ?? _cast(result['observatoryUri']); + final String? vmServiceUriStr = _cast(result['vmServiceUri']); final Uri? vmServiceUri = vmServiceUriStr == null ? null : Uri.parse(vmServiceUriStr); if (started) { if (vmServiceUri != null) { diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index e4dbf7ac32e..7d87339a6d1 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -1347,23 +1347,6 @@ abstract class ResidentRunner extends ResidentHandlers { _finished.complete(0); } - Future enableObservatory() async { - assert(debuggingOptions.serveObservatory); - final List> serveObservatoryRequests = - >[ - for (final FlutterDevice? device in flutterDevices) - if (device != null) - // Notify the VM service if the user wants Observatory to be served. - device.vmService?.callMethodWrapper('_serveObservatory') ?? - Future.value(), - ]; - try { - await Future.wait(serveObservatoryRequests); - } on vm_service.RPCError catch (e) { - globals.printWarning('Unable to enable Observatory: $e'); - } - } - @protected void appFinished() { if (_finished.isCompleted) { diff --git a/packages/flutter_tools/lib/src/run_cold.dart b/packages/flutter_tools/lib/src/run_cold.dart index e07e8c4408d..23d82b8da52 100644 --- a/packages/flutter_tools/lib/src/run_cold.dart +++ b/packages/flutter_tools/lib/src/run_cold.dart @@ -75,10 +75,6 @@ class ColdRunner extends ResidentRunner { } } - if (debuggingEnabled && debuggingOptions.serveObservatory) { - await enableObservatory(); - } - // TODO(bkonyi): remove when ready to serve DevTools from DDS. if (debuggingEnabled && debuggingOptions.enableDevTools) { // The method below is guaranteed never to return a failing future. @@ -160,10 +156,6 @@ class ColdRunner extends ResidentRunner { } } - if (debuggingEnabled && debuggingOptions.serveObservatory) { - await enableObservatory(); - } - appStartedCompleter?.complete(); if (stayResident) { return waitForAppToFinish(); diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index bc79b6c440a..f75911200a9 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -266,11 +266,6 @@ class HotRunner extends ResidentRunner { globals.printError('Error connecting to the service protocol: $error'); return 2; } - - if (debuggingOptions.serveObservatory) { - await enableObservatory(); - } - // TODO(bkonyi): remove when ready to serve DevTools from DDS. if (debuggingOptions.enableDevTools) { // The method below is guaranteed never to return a failing future. diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index 291ae8ee7f2..00f754f8591 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -169,9 +169,6 @@ abstract class FlutterCommand extends Command { /// The option name for a custom VM Service port. static const String vmServicePortOption = 'vm-service-port'; - /// The option name for a custom VM Service port. - static const String observatoryPortOption = 'observatory-port'; - /// The option name for a custom DevTools server address. static const String kDevToolsServerAddress = 'devtools-server-address'; @@ -518,16 +515,6 @@ abstract class FlutterCommand extends Command { 'of the VmService instance advertised on the command line.', hide: !verboseHelp, ); - argParser.addOption( - observatoryPortOption, - help: - '(deprecated; use host-vmservice-port instead) ' - 'Listen to the given port for a Dart VM Service connection.\n' - 'Specifying port 0 (the default) will find a random free port.\n ' - 'if the Dart Development Service (DDS) is enabled, this will not be the port ' - 'of the VmService instance advertised on the command line.', - hide: !verboseHelp, - ); argParser.addOption( 'device-vmservice-port', help: @@ -608,14 +595,6 @@ abstract class FlutterCommand extends Command { ); } - void addServeObservatoryOptions({required bool verboseHelp}) { - argParser.addFlag( - 'serve-observatory', - hide: !verboseHelp, - help: 'Serve the legacy Observatory developer tooling through the VM service.', - ); - } - late final bool enableDds = () { bool ddsEnabled = false; if (argResults?.wasParsed('disable-dds') ?? false) { @@ -646,12 +625,10 @@ abstract class FlutterCommand extends Command { bool get _hostVmServicePortProvided => (argResults?.wasParsed(vmServicePortOption) ?? false) || - (argResults?.wasParsed(observatoryPortOption) ?? false) || (argResults?.wasParsed('host-vmservice-port') ?? false); int _tryParseHostVmservicePort() { - final String? vmServicePort = - stringArg(vmServicePortOption) ?? stringArg(observatoryPortOption); + final String? vmServicePort = stringArg(vmServicePortOption); final String? hostPort = stringArg('host-vmservice-port'); if (vmServicePort == null && hostPort == null) { throwToolExit('Invalid port for `--vm-service-port/--host-vmservice-port`'); @@ -697,7 +674,6 @@ abstract class FlutterCommand extends Command { return null; } if ((argResults?.wasParsed(vmServicePortOption) ?? false) && - (argResults?.wasParsed(observatoryPortOption) ?? false) && (argResults?.wasParsed('host-vmservice-port') ?? false)) { throwToolExit( 'Only one of "--vm-service-port" and ' diff --git a/packages/flutter_tools/lib/src/test/event_printer.dart b/packages/flutter_tools/lib/src/test/event_printer.dart index 5a929e057e5..165fc14bb81 100644 --- a/packages/flutter_tools/lib/src/test/event_printer.dart +++ b/packages/flutter_tools/lib/src/test/event_printer.dart @@ -16,12 +16,7 @@ class EventPrinter extends TestWatcher { @override void handleStartedDevice(Uri? vmServiceUri) { - _sendEvent('test.startedProcess', { - 'vmServiceUri': vmServiceUri?.toString(), - // TODO(bkonyi): remove references to Observatory - // See https://github.com/flutter/flutter/issues/121271 - 'observatoryUri': vmServiceUri?.toString(), - }); + _sendEvent('test.startedProcess', {'vmServiceUri': vmServiceUri?.toString()}); _parent?.handleStartedDevice(vmServiceUri); } diff --git a/packages/flutter_tools/lib/src/test/flutter_tester_device.dart b/packages/flutter_tools/lib/src/test/flutter_tester_device.dart index fe21ff61aaf..daec947286e 100644 --- a/packages/flutter_tools/lib/src/test/flutter_tester_device.dart +++ b/packages/flutter_tools/lib/src/test/flutter_tester_device.dart @@ -8,7 +8,6 @@ import 'dart:io' as io; // flutter_ignore: dart_io_import; import 'package:meta/meta.dart'; import 'package:process/process.dart'; import 'package:stream_channel/stream_channel.dart'; -import 'package:vm_service/vm_service.dart' as vm_service; import '../base/dds.dart'; import '../base/file_system.dart'; @@ -189,20 +188,12 @@ class FlutterTesterTestDevice extends TestDevice { } logger.printTrace('Connecting to service protocol: $forwardingUri'); - final FlutterVmService vmService = await connectToVmServiceImpl( + await connectToVmServiceImpl( forwardingUri!, compileExpression: compileExpression, logger: logger, ); logger.printTrace('test $id: Successfully connected to service protocol: $forwardingUri'); - if (debuggingOptions.serveObservatory) { - try { - await vmService.callMethodWrapper('_serveObservatory'); - } on vm_service.RPCError { - logger.printWarning('Unable to enable Observatory'); - } - } - if (debuggingOptions.startPaused && !machine!) { logger.printStatus('The Dart VM service is listening on $forwardingUri'); await _startDevTools(forwardingUri, _ddsLauncher); diff --git a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart index 72bcbf250a0..aea3c00b93d 100644 --- a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart +++ b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart @@ -999,6 +999,7 @@ class _BrowserEnvironment implements Environment { @override final bool supportsDebugging = true; + // TODO(bkonyi): update package:test_core to no longer reference Observatory. @override final Uri? observatoryUrl; diff --git a/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart b/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart index d742ca6ef20..59ca5dd2952 100644 --- a/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart +++ b/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart @@ -361,9 +361,7 @@ class TestFlutterTesterDevice extends FlutterTesterTestDevice { CompileExpression? compileExpression, required Logger logger, }) async { - return FakeVmServiceHost( - requests: [const FakeVmServiceRequest(method: '_serveObservatory')], - ).vmService; + return FakeVmServiceHost(requests: []).vmService; } @override diff --git a/packages/flutter_tools/test/general.shard/test/event_printer_test.dart b/packages/flutter_tools/test/general.shard/test/event_printer_test.dart index 3c6b114d307..d3d74be34a5 100644 --- a/packages/flutter_tools/test/general.shard/test/event_printer_test.dart +++ b/packages/flutter_tools/test/general.shard/test/event_printer_test.dart @@ -35,8 +35,7 @@ void main() { expect( output.toString(), '\n' - '[{"event":"test.startedProcess","params":{"vmServiceUri":"http://localhost:1234",' - '"observatoryUri":"http://localhost:1234"}}]' + '[{"event":"test.startedProcess","params":{"vmServiceUri":"http://localhost:1234"}}]' '\n', ); }); @@ -47,8 +46,7 @@ void main() { expect( output.toString(), '\n' - '[{"event":"test.startedProcess","params":{"vmServiceUri":null,' - '"observatoryUri":null}}]' + '[{"event":"test.startedProcess","params":{"vmServiceUri":null}}]' '\n', ); }); diff --git a/packages/flutter_tools/test/integration.shard/flutter_attach_test.dart b/packages/flutter_tools/test/integration.shard/flutter_attach_test.dart index 1180c9f699d..4aaf36aadf7 100644 --- a/packages/flutter_tools/test/integration.shard/flutter_attach_test.dart +++ b/packages/flutter_tools/test/integration.shard/flutter_attach_test.dart @@ -5,8 +5,6 @@ @Tags(['flutter-test-driver']) library; -import 'dart:convert'; - import 'package:file/file.dart'; import 'package:flutter_tools/src/base/io.dart'; import 'package:vm_service/vm_service.dart'; @@ -153,51 +151,4 @@ void main() { expect(vmServiceUri.port, equals(ddsPort)); }); }); - - group('--serve-observatory', () { - late FlutterRunTestDriver flutterRun, flutterAttach; - - setUp(() async { - flutterRun = FlutterRunTestDriver(tempDir, logPrefix: ' RUN '); - flutterAttach = FlutterRunTestDriver( - tempDir, - logPrefix: 'ATTACH ', - // Only one DDS instance can be connected to the VM service at a time. - // DDS can also only initialize if the VM service doesn't have any existing - // clients, so we'll just let _flutterRun be responsible for spawning DDS. - spawnDdsInstance: false, - ); - }); - - tearDown(() async { - await flutterAttach.detach(); - await flutterRun.stop(); - }); - - Future isObservatoryAvailable() async { - final HttpClient client = HttpClient(); - final Uri vmServiceUri = Uri( - scheme: 'http', - host: flutterRun.vmServiceWsUri!.host, - port: flutterRun.vmServicePort, - ); - - final HttpClientRequest request = await client.getUrl(vmServiceUri); - final HttpClientResponse response = await request.close(); - final String content = await response.transform(utf8.decoder).join(); - return content.contains('Dart VM Observatory'); - } - - testWithoutContext('enables Observatory on run', () async { - await flutterRun.run(withDebugger: true, serveObservatory: true); - expect(await isObservatoryAvailable(), true); - }); - - testWithoutContext('enables Observatory on attach', () async { - await flutterRun.run(withDebugger: true); - expect(await isObservatoryAvailable(), false); - await flutterAttach.attach(flutterRun.vmServicePort!, serveObservatory: true); - expect(await isObservatoryAvailable(), true); - }); - }); } diff --git a/packages/flutter_tools/test/integration.shard/test_driver.dart b/packages/flutter_tools/test/integration.shard/test_driver.dart index 022b2b3c474..ee9e9d953d7 100644 --- a/packages/flutter_tools/test/integration.shard/test_driver.dart +++ b/packages/flutter_tools/test/integration.shard/test_driver.dart @@ -534,7 +534,6 @@ final class FlutterRunTestDriver extends FlutterTestDriver { String device = FlutterTesterDevices.kTesterDeviceId, bool expressionEvaluation = true, bool structuredErrors = false, - bool serveObservatory = false, bool noDevtools = false, bool verbose = false, String? script, @@ -559,7 +558,6 @@ final class FlutterRunTestDriver extends FlutterTestDriver { '--machine', if (!spawnDdsInstance) '--no-dds', if (noDevtools) '--no-devtools', - '--${serveObservatory ? '' : 'no-'}serve-observatory', ...getLocalEngineArguments(), '-d', ...deviceArgs, @@ -579,7 +577,6 @@ final class FlutterRunTestDriver extends FlutterTestDriver { bool withDebugger = false, bool startPaused = false, bool pauseOnExceptions = false, - bool serveObservatory = false, List? additionalCommandArgs, }) async { _attachPort = port; @@ -589,7 +586,6 @@ final class FlutterRunTestDriver extends FlutterTestDriver { ...getLocalEngineArguments(), '--machine', if (!spawnDdsInstance) '--no-dds', - '--${serveObservatory ? '' : 'no-'}serve-observatory', '-d', 'flutter-tester', '--debug-port', diff --git a/packages/flutter_tools/test/integration.shard/test_test.dart b/packages/flutter_tools/test/integration.shard/test_test.dart index 4001685f90d..e33ac678b23 100644 --- a/packages/flutter_tools/test/integration.shard/test_test.dart +++ b/packages/flutter_tools/test/integration.shard/test_test.dart @@ -471,35 +471,6 @@ void main() { ); }); - testWithoutContext('flutter test should respect --serve-observatory', () async { - Process? process; - StreamSubscription? sub; - try { - process = await _runFlutterTestConcurrent( - 'trivial', - automatedTestsDirectory, - flutterTestDirectory, - extraArguments: const ['--start-paused', '--serve-observatory'], - ); - final Completer completer = Completer(); - final RegExp vmServiceUriRegExp = RegExp(r'((http)?:\/\/)[^\s]+'); - sub = process.stdout.transform(utf8.decoder).listen((String e) { - if (!completer.isCompleted && vmServiceUriRegExp.hasMatch(e)) { - completer.complete(Uri.parse(vmServiceUriRegExp.firstMatch(e)!.group(0)!)); - } - }); - final Uri vmServiceUri = await completer.future; - final HttpClient client = HttpClient(); - final HttpClientRequest request = await client.getUrl(vmServiceUri); - final HttpClientResponse response = await request.close(); - final String content = await response.transform(utf8.decoder).join(); - expect(content, contains('Dart VM Observatory')); - } finally { - await sub?.cancel(); - process?.kill(); - } - }); - testWithoutContext('flutter test should serve DevTools', () async { Process? process; StreamSubscription? sub; diff --git a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart index b7af71ada90..0dd0ac882a0 100644 --- a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart +++ b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart @@ -557,7 +557,7 @@ class FuchsiaRemoteConnection { final List ports = getVmServicePortFromInspectSnapshot(inspectOutputJson); if (ports.length > 1) { - throw StateError('More than one Flutter observatory port found'); + throw StateError('More than one Dart VM service port found'); } return ports; }