Skip to content

Reland [tool][engine] Enable experimental VM service by default - #197483

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:reland_enable_experimental_vm_service
Nov 27, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:reland_enable_experimental_vm_service

Conversation

@bkonyi

@bkonyi bkonyi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Relands #190100 (reverted in #197481) with a fix for Windows and Linux desktop profile-mode bundling on existing projects.

Root cause

#190100 added the install(FILES ... libvmservice_snapshot.{dll,so} ...) rule only to the new-project CMakeLists.txt.tmpl templates. Existing Windows and Linux apps (including DeviceLab apps such as flutter_gallery and flutter_view) have checked-in CMakeLists.txt files without that rule, so UnpackWindows/UnpackLinux unpacked the library into flutter/ephemeral/, but CMake INSTALL never copied it to the app bundle. At startup, DartVMData::GetServiceIsolateSnapshot() fell back to the app snapshot and failed in DartServiceIsolate::Startup. The template rule also omitted CONFIGURATIONS Profile, risking stale bundling into subsequent Release builds.

Fix

  • Emit the install(FILES ...) rule in writeGeneratedCmakeConfig (packages/flutter_tools/lib/src/cmake.dart) for WindowsProject (data/libvmservice_snapshot.dll) and LinuxProject (lib/libvmservice_snapshot.so) with CONFIGURATIONS Profile, COMPONENT Runtime, and OPTIONAL.
  • On CMake 3.19+, defer the install() call to ${PROJECT_SOURCE_DIR} via cmake_language(DEFER ...) so it runs after parent bundle cleanup rules (such as Linux file(REMOVE_RECURSE ...) when cmake_minimum_required is 3.14+ / CMP0082 NEW).
  • Revert the CMakeLists.txt.tmpl changes from #190100.
  • Add unit tests in packages/flutter_tools/test/general.shard/cmake_test.dart and integration tests in packages/flutter_tools/test/integration.shard/flutter_build_windows_test.dart and packages/flutter_tools/test/integration.shard/flutter_build_linux_test.dart (covering profile bundling, release exclusion, and CMake 3.14 ordering).

Previous output:

[IMPORTANT:flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc(127)] Using the Impeller rendering backend (OpenGLESSDF).
[ERROR:flutter/runtime/dart_isolate.cc(1095)] DartServiceIsolate::Startup failed: Unhandled exception:
NoSuchMethodError: No top-level setter '_ip=' declared.
Receiver: top-level
Tried calling: _ip="127.0.0.1"
#0      NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:174)

Current output:

[IMPORTANT:flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc(127)] Using the Impeller rendering backend (OpenGLESSDF).
The Dart VM service is listening on http://127.0.0.1:45591/3O4DhxOyHcE=/

Fixes #191966

Move the Windows (`libvmservice_snapshot.dll`) and Linux
(`libvmservice_snapshot.so`) profile-mode VM service install rules from
the app `CMakeLists.txt.tmpl` templates into `generated_config.cmake`
generated by `writeGeneratedCmakeConfig`.

Existing Windows and Linux projects (including DeviceLab apps such as
`flutter_gallery` and `flutter_view`) have checked-in `CMakeLists.txt`
files that did not receive the template install rule, causing profile
builds to omit `libvmservice_snapshot.{dll,so}` and fail at startup when
`DartVMData::GetServiceIsolateSnapshot()` fell back to the app snapshot.
The previous template rule also lacked `CONFIGURATIONS Profile`, which
risked bundling a stale snapshot library into subsequent Release builds.

On CMake 3.19+, defer the `install()` call to the end of
`${PROJECT_SOURCE_DIR}` via `cmake_language(DEFER ...)` so it runs after
parent bundle cleanup rules (such as Linux `file(REMOVE_RECURSE ...)`
under `CMP0082` NEW).

Previous output:
```
[IMPORTANT:flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc(127)] Using the Impeller rendering backend (OpenGLESSDF).
[ERROR:flutter/runtime/dart_isolate.cc(1095)] DartServiceIsolate::Startup failed: Unhandled exception:
NoSuchMethodError: No top-level setter '_ip=' declared.
Receiver: top-level
Tried calling: _ip="127.0.0.1"
#0      NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:174)
```

Current output:
```
[IMPORTANT:flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc(127)] Using the Impeller rendering backend (OpenGLESSDF).
The Dart VM service is listening on http://127.0.0.1:45591/3O4DhxOyHcE=/
```
@bkonyi bkonyi added the CICD Run CI/CD label Nov 26, 2026
@github-actions github-actions Bot added a: tests "flutter test", flutter_test, or one of our tests platform-android Android applications specifically platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. platform-macos Building on or for macOS specifically platform-fuchsia Fuchsia code specifically platform-windows Building on or for Windows specifically platform-linux Building on or for Linux specifically a: desktop Running on desktop f: integration_test The flutter/packages/integration_test plugin team-android Owned by Android platform team team-ios Owned by iOS platform team team-macos Owned by the macOS platform team team-windows Owned by the Windows platform team team-linux Owned by the Linux platform team labels Nov 26, 2026
@bkonyi
bkonyi marked this pull request as ready for review November 26, 2026 23:25
@bkonyi
bkonyi requested review from a team as code owners November 26, 2026 23:25
@bkonyi
bkonyi requested review from jesswrd and removed request for a team November 26, 2026 23:25

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Flutter engine and tools to package and load the Dart VM Service snapshot across all platforms. In debug mode, the VM service is bundled as a kernel snapshot (vmservice_snapshot.dill), while in profile mode, it is packaged as a precompiled AOT library (such as VMService.framework on iOS and macOS, or shared libraries on Windows and Linux). The build systems, including GN, CMake, and Xcode backend scripts, are updated to handle, thin, codesign, and install these new artifacts. Feedback on the changes suggests refactoring the path resolution in macos.dart to use the more idiomatic childDirectory and childFile APIs instead of manual path joining.

- Use `childDirectory`/`childFile` in `UnpackMacOSVmService.build` in
  `packages/flutter_tools/lib/src/build_system/targets/macos.dart`,
  matching `UnpackIosVmService`.
- Add `test/integration.shard/flutter_build_linux_test.dart` entries to
  `dev/bots/tool_test_durations.json` (`linux`: 56, `macos`: 0,
  `windows`: 0) to satisfy `tool_test_durations_test.dart`.
@bkonyi bkonyi added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Nov 27, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Nov 27, 2026
Merged via the queue into flutter:master with commit 116ad36 Nov 27, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop a: tests "flutter test", flutter_test, or one of our tests CICD Run CI/CD engine flutter/engine related. See also e: labels. f: integration_test The flutter/packages/integration_test plugin framework flutter/packages/flutter repository. See also f: labels. platform-android Android applications specifically platform-fuchsia Fuchsia code specifically platform-ios iOS applications specifically platform-linux Building on or for Linux specifically platform-macos Building on or for macOS specifically platform-windows Building on or for Windows specifically team-android Owned by Android platform team team-ios Owned by iOS platform team team-linux Owned by the Linux platform team team-macos Owned by the macOS platform team team-windows Owned by the Windows platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[engine] Enable new modular VM service (dart_runtime_service_vm) by default

2 participants