Repository navigation
[tool] Let --local-engine reach the build system again - #192361
Conversation
Desktop builds with --local-engine quietly used the cached engine instead of the one just built, and often failed outright with "Can't load Kernel binary: Invalid SDK hash", because cached engine artifacts stop being updated once --local-engine is used and eventually no longer match the Dart SDK. Commands are created with the artifacts to build against when the tool starts up, which is before the command line has been parsed, so they always used the cached ones. --local-engine and --local-web-sdk were applied afterwards, and only to the legacy zone that commands used to read artifacts from. flutter assemble stopped reading from that zone in flutter#190773, taking the build system with it. Use artifacts that can be changed after they are created instead, and update them as soon as the runner has parsed the command line, which happens before any command runs. Everything then builds against the right engine.
There was a problem hiding this comment.
Code Review
This pull request introduces the DeferredArtifacts class to allow resolving artifact dependencies after tool startup, specifically when a local engine is specified. It updates dependency injection in tool_dependencies.dart and command execution in flutter_command_runner.dart, and adds corresponding unit tests. Review feedback suggests adding documentation warnings against eager caching, adding assertions to prevent self-resolution and nested wrapping, and using an explicit bool type instead of var for _isResolved to align with the Flutter style guide.
mattkae
left a comment
There was a problem hiding this comment.
OK by me, but I suggest getting someone more privy to the artifacts system to review it 👍
|
autosubmit label was removed for flutter/flutter/192361, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
flutter/flutter@63170e9...b444e78 2026-09-08 [email protected] Clean up lint errors in workflows (flutter/flutter#191987) 2026-09-08 [email protected] Remove no-shuffle tag from dropdown_test.dart (flutter/flutter#186398) 2026-09-08 [email protected] Remove no-shuffle from scrollbar test (flutter/flutter#186656) 2026-09-08 [email protected] [tool] Let --local-engine reach the build system again (flutter/flutter#192361) 2026-09-08 [email protected] [flutter_tools] Safely remove web loading indicator on dart-app-ready (flutter/flutter#192233) 2026-09-08 [email protected] [Linux] Don't clear the OpenGL context when a frame has been drawn (flutter/flutter#192137) 2026-09-08 [email protected] ci: update dartdoc from 9.0.6 to 9.0.9 (flutter/flutter#192405) 2026-09-07 [email protected] Add itemExtentBuilder support to ListView.separated (flutter/flutter#191157) 2026-09-07 [email protected] Roll Skia from e1437642d259 to b3fa80a0e168 (5 revisions) (flutter/flutter#192362) 2026-09-07 [email protected] Roll Skia from 2df865d9d369 to e1437642d259 (1 revision) (flutter/flutter#192360) 2026-09-07 [email protected] Roll Skia from c7aa5512d148 to 2df865d9d369 (2 revisions) (flutter/flutter#192357) 2026-09-06 [email protected] Roll Skia from db200e27a634 to c7aa5512d148 (2 revisions) (flutter/flutter#192351) 2026-09-06 [email protected] Roll Fuchsia Linux SDK from _IgixhH4vEgdz9Oqn... to p8hHkUi8uWT9R3N4z... (flutter/flutter#192349) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@bkonyi as a followup I think it would be really good if we could understand how something could break every engine/embedder developers' workflow without the pre/post submits catching it. Without having looked into the code, it seems like we must be missing some pretty important test coverage here. |
…r#12791) flutter/flutter@63170e9...b444e78 2026-09-08 [email protected] Clean up lint errors in workflows (flutter/flutter#191987) 2026-09-08 [email protected] Remove no-shuffle tag from dropdown_test.dart (flutter/flutter#186398) 2026-09-08 [email protected] Remove no-shuffle from scrollbar test (flutter/flutter#186656) 2026-09-08 [email protected] [tool] Let --local-engine reach the build system again (flutter/flutter#192361) 2026-09-08 [email protected] [flutter_tools] Safely remove web loading indicator on dart-app-ready (flutter/flutter#192233) 2026-09-08 [email protected] [Linux] Don't clear the OpenGL context when a frame has been drawn (flutter/flutter#192137) 2026-09-08 [email protected] ci: update dartdoc from 9.0.6 to 9.0.9 (flutter/flutter#192405) 2026-09-07 [email protected] Add itemExtentBuilder support to ListView.separated (flutter/flutter#191157) 2026-09-07 [email protected] Roll Skia from e1437642d259 to b3fa80a0e168 (5 revisions) (flutter/flutter#192362) 2026-09-07 [email protected] Roll Skia from 2df865d9d369 to e1437642d259 (1 revision) (flutter/flutter#192360) 2026-09-07 [email protected] Roll Skia from c7aa5512d148 to 2df865d9d369 (2 revisions) (flutter/flutter#192357) 2026-09-06 [email protected] Roll Skia from db200e27a634 to c7aa5512d148 (2 revisions) (flutter/flutter#192351) 2026-09-06 [email protected] Roll Fuchsia Linux SDK from _IgixhH4vEgdz9Oqn... to p8hHkUi8uWT9R3N4z... (flutter/flutter#192349) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#12791) flutter/flutter@63170e9...b444e78 2026-09-08 [email protected] Clean up lint errors in workflows (flutter/flutter#191987) 2026-09-08 [email protected] Remove no-shuffle tag from dropdown_test.dart (flutter/flutter#186398) 2026-09-08 [email protected] Remove no-shuffle from scrollbar test (flutter/flutter#186656) 2026-09-08 [email protected] [tool] Let --local-engine reach the build system again (flutter/flutter#192361) 2026-09-08 [email protected] [flutter_tools] Safely remove web loading indicator on dart-app-ready (flutter/flutter#192233) 2026-09-08 [email protected] [Linux] Don't clear the OpenGL context when a frame has been drawn (flutter/flutter#192137) 2026-09-08 [email protected] ci: update dartdoc from 9.0.6 to 9.0.9 (flutter/flutter#192405) 2026-09-07 [email protected] Add itemExtentBuilder support to ListView.separated (flutter/flutter#191157) 2026-09-07 [email protected] Roll Skia from e1437642d259 to b3fa80a0e168 (5 revisions) (flutter/flutter#192362) 2026-09-07 [email protected] Roll Skia from 2df865d9d369 to e1437642d259 (1 revision) (flutter/flutter#192360) 2026-09-07 [email protected] Roll Skia from c7aa5512d148 to 2df865d9d369 (2 revisions) (flutter/flutter#192357) 2026-09-06 [email protected] Roll Skia from db200e27a634 to c7aa5512d148 (2 revisions) (flutter/flutter#192351) 2026-09-06 [email protected] Roll Fuchsia Linux SDK from _IgixhH4vEgdz9Oqn... to p8hHkUi8uWT9R3N4z... (flutter/flutter#192349) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…mmands and DI (flutter#192510) ## Description Adds tests verifying that local engine options specified via CLI flags or artifacts are properly propagated across `flutter_tools` commands and dependency injection bootstrapping, addressing [flutter#192361 (comment)](flutter#192361 (comment)). Also refactors `Artifacts.getLocalEngine` to make `cache`, `fileSystem`, `operatingSystemUtils`, `platform`, and `processManager` required named parameters, eliminating ambient `globals.*` fallbacks. ## Related Issues - Follow-up to [flutter#192361](flutter#192361) ## Tests - Hermetic unit tests in `packages/flutter_tools/test/commands.shard/hermetic/` (`assemble_test.dart`, `build_ios_test.dart`, `build_linux_test.dart`, `build_macos_test.dart`, `build_web_test.dart`, `build_windows_test.dart`) - Unit tests in `packages/flutter_tools/test/general.shard/` (`bundle_builder_test.dart`, `context/dependency_injection_test.dart`, `runner/flutter_command_runner_test.dart`) - Integration test in `packages/flutter_tools/test/integration.shard/build_linux_config_only_test.dart`
Desktop builds with --local-engine quietly used the cached engine instead of the one just built, and often failed outright with "Can't load Kernel binary: Invalid SDK hash", because cached engine artifacts stop being updated once --local-engine is used and eventually no longer match the Dart SDK.
Commands are created with the artifacts to build against when the tool starts up, which is before the command line has been parsed, so they always used the cached ones. --local-engine and --local-web-sdk were applied afterwards, and only to the legacy zone that commands used to read artifacts from. flutter assemble stopped reading from that zone in #190773, taking the build system with it.
Use artifacts that can be changed after they are created instead, and update them as soon as the runner has parsed the command line, which happens before any command runs. Everything then builds against the right engine.