Skip to content

[flutter_tools] Migrate lib/runner.dart off runInContext and overrides - #196387

Merged
auto-submit[bot] merged 7 commits into
flutter:masterfrom
bkonyi:di/runner-2-remove-run-in-context
Nov 18, 2026
Merged

auto-submit[bot] merged 7 commits into
flutter:masterfrom
bkonyi:di/runner-2-remove-run-in-context

Conversation

@bkonyi

@bkonyi bkonyi commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Migrates lib/runner.dart off runInContext and overrides to accept an explicit ToolDependencies instance, and removes AppContext.hasOverride and AppContext.resolveOverride.

Part of #47161

…eateGlobalArgParser

Makes `FlutterCommandRunner` dependency fields required and non-nullable, extracts `FlutterCommandRunner.createGlobalArgParser` for early top-level flag parsing, and removes `_FallbackToolContext` from `lib/executable.dart`.

Part of flutter#47161
Migrates `lib/runner.dart` off `runInContext` and `overrides` so it accepts
an explicit `ToolDependencies` instance alongside explicit
`FlutterHookRunner` and `WebRunnerFactory` arguments. Removes
`AppContext.hasOverride` and `AppContext.resolveOverride`, which are no
longer needed.

Part of flutter#47161
@bkonyi bkonyi added tool Affects the "flutter" command-line tool. See also t: labels. CICD Run CI/CD labels Nov 11, 2026
…findCommandName

Make _createGlobalArgParser private on FlutterCommandRunner and move findCommandName onto FlutterCommandRunner for pre-bootstrap command inspection.
…e-run-in-context

# Conflicts:
#	packages/flutter_tools/lib/executable.dart
#	packages/flutter_tools/lib/runner.dart
#	packages/flutter_tools/test/general.shard/runner/runner_test.dart
# Conflicts:
#	packages/flutter_tools/lib/runner.dart
@bkonyi
bkonyi marked this pull request as ready for review November 18, 2026 04:06

@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 refactors the Flutter tool execution and runner entry points by bootstrapping ToolDependencies prior to calling runner.run and passing it directly as a parameter. This simplifies the run function signature, removes the need for several individual dependency parameters, and allows the removal of the hasOverride and resolveOverride methods from AppContext. Additionally, numerous tests in runner_test.dart have been refactored from testUsingContext to testWithoutContext using a new _bootstrapForTest helper. There are no review comments provided, and I have no additional feedback to offer.

@bkonyi
bkonyi requested a review from chingjun November 18, 2026 04:09
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 18, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Nov 18, 2026
Merged via the queue into flutter:master with commit 4dfbad3 Nov 18, 2026
22 of 23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 18, 2026
@gaaclarke

Copy link
Copy Markdown
Member

reason for revert: causing failures in Mac tool_tests_general

example:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8664762008551069969/+/u/run_test.dart_for_tool_tests_shard_and_subshard_general/stdout

Failing tests:
  test/general.shard/runner/runner_test.dart: runner (crash reporting) doesn't send multiple events for additional asynchronous exceptions thrown during shutdown

@gaaclarke gaaclarke added the revert Autorevert PR (with "Reason for revert:" comment) label Nov 18, 2026
@flutteractionsbot

Copy link
Copy Markdown
Contributor

Successfully created revert PR: #196926

@flutteractionsbot flutteractionsbot removed the revert Autorevert PR (with "Reason for revert:" comment) label Nov 18, 2026
Subhanshu20135 pushed a commit to The-Developer-Diaries/flutter that referenced this pull request Nov 18, 2026
…overrides (flutter#196926)

Reverts: [[flutter_tools] Migrate lib/runner.dart off runInContext and
overrides](flutter#196387)

Initiated by: @gaaclarke

Reason for reverting: ```

Original PR Author: @bkonyi

Reviewed By: @chingjun

The original PR description is provided below:

Migrates `lib/runner.dart` off `runInContext` and `overrides` to accept
an explicit `ToolDependencies` instance, and removes
`AppContext.hasOverride` and `AppContext.resolveOverride`.

Part of flutter#47161
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 19, 2026
flutter/flutter@06f32f8...e8cc6f3

2026-11-19 [email protected] Roll Skia from 280e0965687d to 3dfb69d709c7 (1 revision) (flutter/flutter#196970)
2026-11-19 [email protected] Update outdated `_formattedValues` documentation (flutter/flutter#195765)
2026-11-19 [email protected] [Impeller] Fix Vulkan GPU frame time metrics in benchmarks (flutter/flutter#196339)
2026-11-19 [email protected] Windows: Enable D3D11 multithread protection on ANGLE's device (flutter/flutter#196897)
2026-11-19 [email protected] Roll Skia from 7356c7627e87 to 280e0965687d (1 revision) (flutter/flutter#196957)
2026-11-19 [email protected] Roll Dart SDK from 091f346ad95c to d8d40cf9c21b (2 revisions) (flutter/flutter#196949)
2026-11-19 [email protected] Roll Skia from 73b9219fd1fa to 7356c7627e87 (4 revisions) (flutter/flutter#196951)
2026-11-19 [email protected] Roll Skia from 7bca23228537 to 73b9219fd1fa (1 revision) (flutter/flutter#196948)
2026-11-19 [email protected] [libimpeller] Fix swapped x and y glyph coordinates (flutter/flutter#196552)
2026-11-19 [email protected] [ios][spm]When using cocoapods plugin, give instruction that plugins may just need update (flutter/flutter#195853)
2026-11-19 [email protected] [web] Let the browser handle Control+wheel zoom outside of macOS (flutter/flutter#193362)
2026-11-19 [email protected] Fix focus violation when canRequestFocus set to false for all siblings in same build (flutter/flutter#191536)
2026-11-19 [email protected] Roll Skia from 9fc4f9e23d56 to 7bca23228537 (10 revisions) (flutter/flutter#196941)
2026-11-19 [email protected] Roll Dart SDK from 753488ede427 to 091f346ad95c (2 revisions) (flutter/flutter#196940)
2026-11-19 [email protected] iOS: Convert platform views to points with the frame's pixel ratio (flutter/flutter#196858)
2026-11-19 [email protected] [engine] Defer default font manager resolution to first use for platforms that have a prefetching API only (flutter/flutter#196377)
2026-11-18 [email protected] [flutter_tools] Add example app to package template and decouple platform configurations (flutter/flutter#192441)
2026-11-18 [email protected] [flutter_tools] Rebuild asset bundle when generated manifest content changes (flutter/flutter#191638)
2026-11-18 [email protected] Roll Skia from b11d69796f71 to 9fc4f9e23d56 (2 revisions) (flutter/flutter#196909)
2026-11-18 [email protected] [flutter_tools] Bump cupertino_icons to ^2.0.0 in app and module templates (flutter/flutter#196828)
2026-11-18 [email protected] Update iOS plugin language instructions (flutter/flutter#196614)
2026-11-18 [email protected] iOS: Add tests for rounded rect clips with per-corner/elliptical radii (flutter/flutter#196854)
2026-11-18 [email protected] Revert: [flutter_tools] Migrate lib/runner.dart off runInContext and overrides (flutter/flutter#196926)
2026-11-18 [email protected] Revert: Move macOS desktop builds to ThinLTO (flutter/flutter#196917)
2026-11-18 [email protected] [FGP] Offset split-APK versionCodes from a manifest-only versionCode (flutter/flutter#196561)
2026-11-18 [email protected] [flutter_tools] Migrate lib/runner.dart off runInContext and overrides (flutter/flutter#196387)
2026-11-18 [email protected] docs: remove broken image references from dev/snippets/README.md (flutter/flutter#195587)
2026-11-18 [email protected] Remove the FGP AGP-public-API migration coordination docs (flutter/flutter#196733)
2026-11-18 [email protected] [web] Skip stale safeBlur focus transfer when the element was refocused (flutter/flutter#196550)
2026-11-18 [email protected] Roll Skia from 81ee7327e81c to b11d69796f71 (4 revisions) (flutter/flutter#196900)

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
bdero pushed a commit to bdero/flutter that referenced this pull request Nov 20, 2026
…overrides (flutter#196931)

Relands [flutter#196387](flutter#196387)
(reverted in [flutter#196926](flutter#196926))
with a fix for the postsubmit failure in `runner (crash reporting)
doesn't send multiple events for additional asynchronous exceptions
thrown during shutdown`.

Migrates `lib/runner.dart` off `runInContext` and `overrides` to accept
an explicit `ToolDependencies` instance, removes
`AppContext.hasOverride` and `AppContext.resolveOverride`, and fixes the
`MultipleExceptionCrashingFlutterCommand` off-by-one and
`Timer.periodic` / `exitWithHooks(0)` timing race in `runner_test.dart`
(alongside restoring `firstError ??= error` in `lib/runner.dart`).

Previous output:
```text
00:00 +0: loading /usr/local/google/home/bkonyi/.gemini/jetski/worktrees/flutter/wt_reland_196387/packages/flutter_tools/test/general.shard/runner/runner_test.dart
00:00 +0: runner (crash reporting) doesn't send multiple events for additional asynchronous exceptions thrown during shutdown
00:00 +0 -1: runner (crash reporting) doesn't send multiple events for additional asynchronous exceptions thrown during shutdown [E]
  Expected: <5>
    Actual: <4>
  package:matcher                                   expect
  test/general.shard/runner/runner_test.dart 490:7  main.<fn>.<fn>
00:00 +0 -1: Some tests failed.
Failing tests:
  /usr/local/google/home/bkonyi/.gemini/jetski/worktrees/flutter/wt_reland_196387/packages/flutter_tools/test/general.shard/runner/runner_test.dart: runner (crash reporting) doesn't send multiple events for additional asynchronous exceptions thrown during shutdown
Consider enabling the flag chain-stack-traces to receive more detailed exceptions.
For example, 'dart test --chain-stack-traces'.
```

Current output:
```text
00:00 +0: loading /usr/local/google/home/bkonyi/.gemini/jetski/worktrees/flutter/wt_reland_196387/packages/flutter_tools/test/general.shard/runner/runner_test.dart
00:00 +0: runner (crash reporting) doesn't send multiple events for additional asynchronous exceptions thrown during shutdown
00:00 +1: All tests passed!
```

Part of flutter#47161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants