Repository navigation
feat(flutter_tools): migrate Desktop build commands to typed options - #193323
Merged
auto-submit[bot] merged 4 commits intoOct 8, 2026
Merged
Conversation
Migrate `BuildLinuxCommand` (`build linux`) and `BuildWindowsCommand` (`build windows`) to typed `OptionDescriptor`s and `OptionBundle`s: - Add `DesktopBuildOptionsBundle` in `common_options.dart` (encapsulating `CommonBuildOptionsBundle`, `BuildModeOptionsBundle`, `DartCompileOptionsBundle`, `BuildInfoOptions.flavor`, `splitDebugInfo`, `obfuscate`, `extraFrontEndOptions`, `extraGenSnapshotOptions`, `performanceMeasurementFile`, `analyzeSize`, `codeSizeDirectory`, `trackWidgetCreation`, and `configOnly`). - Migrate `BuildLinuxCommand` to `DesktopBuildOptionsBundle`, `DefaultedEnumOptionDescriptor<TargetPlatform>` (`_targetPlatformOption`), and `DefaultedStringOptionDescriptor` (`_targetSysroot`). - Migrate `BuildWindowsCommand` to `DesktopBuildOptionsBundle`. - Remove obsolete `FlutterCommand.addCommonDesktopBuildOptions`.
kevmoo
marked this pull request as ready for review
September 25, 2026 04:02
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the desktop build commands for Linux and Windows to use the new DesktopBuildOptionsBundle for registering common build options, removing the deprecated addCommonDesktopBuildOptions helper. Feedback suggests refactoring the _targetPlatformOption in BuildLinuxCommand from a static factory method to a late final instance field to avoid recreating the descriptor when retrieving its value.
…eld on BuildLinuxCommand
bkonyi
approved these changes
Oct 8, 2026
This was referenced Oct 8, 2026
This was referenced Oct 8, 2026
feat(flutter_tools): extract AndroidGradleConfig and move toGradleConfig to AndroidBuildInfo
#194016
Merged
This was referenced Oct 9, 2026
andywolff
pushed a commit
to andywolff/flutter
that referenced
this pull request
Oct 13, 2026
…lutter#194017) ### Rationale `FlutterTestRunner.runTests` accepted 33 loose parameters (duplicating 23 of them on `runTestsBySpawningLightweightEngines` alongside duplicated `package:test` CLI argument lists), and `DriverService.startTest` accepted 12 loose parameters fed by untyped `boolArg` / `stringArg` / regex splitting in `TestCommand` and `DriveCommand`. Following flutter#191018, flutter#191510, flutter#191760, flutter#192307, flutter#192455, flutter#192524, flutter#192818, and flutter#193323, this change introduces immutable service-layer specification objects and migrates `TestCommand` and `DriveCommand` to typed `OptionDescriptor`s. ### Summary of Changes - Introduce `@immutable class TestFilterSpecification` and `@immutable class TestExecutionSpecification` (with `toPackageTestArgs()`) in `test/runner.dart`, shrinking `FlutterTestRunner.runTests` from 33 parameters to 3 (`testWrapper`, `testFiles`, `spec`) and `runTestsBySpawningLightweightEngines` from 25 parameters to 2 (`testFiles`, `spec`). - Migrate `TestCommand` (`commands/test.dart`) from inline `argParser` registrations and untyped `boolArg`/`stringArg`/`stringsArg` queries to private typed `OptionDescriptor` constants (`argParser.addDescriptors` + `getValue` / `wasParsed`), and update `bin/fuchsia_tester.dart`. - Introduce `@immutable class DriveTestSpecification` (with `parseBrowserDimension`) in `drive/drive_service.dart`, shrinking `DriverService.startTest` (and `FlutterDriverService` / `WebDriverService`) from 12 parameters to 2 (`testFile`, `spec`). - Migrate `DriveCommand` (`commands/drive.dart`) from inline registrations and ad-hoc string/int/enum parsing to private typed `OptionDescriptor` constants (`IntOptionDescriptor`, `DefaultedEnumOptionDescriptor<Browser>`, etc.) and `DriveTestSpecification`. - Update unit tests across `test_test.dart`, `drive_test.dart`, `drive_service_test.dart`, and `web_driver_service_test.dart`. ### Flow / Surface Delta ```mermaid flowchart LR A["TestCommand (OptionDescriptors)"] --> B["TestExecutionSpecification"] B --> C["FlutterTestRunner.runTests(spec)"] D["DriveCommand (OptionDescriptors)"] --> E["DriveTestSpecification"] E --> F["DriverService.startTest(spec)"] ``` ### Verification - Executed `dart analyze --fatal-infos` on `packages/flutter_tools` with 0 issues. - Executed `dart test` across `test_test.dart`, `drive_test.dart`, `drive_service_test.dart`, and `web_driver_service_test.dart` (`148/148` passing). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
This was referenced Oct 13, 2026
dayanruben
pushed a commit
to dayanruben/flutter
that referenced
this pull request
Oct 14, 2026
…fig to AndroidBuildInfo (flutter#194016) ### Rationale `BuildInfo` is the cross-platform build configuration passed across Android, iOS, Web, Desktop, and Fuchsia targets, yet it carried 6 loose Android/Gradle fields (`androidProjectArgs`, `androidGradleProjectCacheDir`, `androidGradleDaemon`, `androidSkipBuildDependencyValidation`, `androidEnableHcpp`, `explicitAndroidEnableHcpp`) and the Gradle `-P` flag serializer `toGradleConfig()`. Following flutter#191018, flutter#191510, flutter#191760, flutter#192307, flutter#192455, flutter#192524, flutter#192818, and flutter#193323, this change encapsulates those fields into `AndroidGradleConfig` and moves `toGradleConfig()` onto `AndroidBuildInfo` where all production callers already operate. ### Summary of Changes - Introduce `@immutable class AndroidGradleConfig` in `build_info.dart` and replace the 6 loose `android*` parameters on `BuildInfo` and `BuildInfo.copyWith` with `androidGradleConfig` (shrinking `BuildInfo`'s constructor from 28 to 23 parameters while preserving `AndroidDevice.startApp` forwarding during `flutter run`). - Move `toGradleConfig()` off `BuildInfo` onto `AndroidBuildInfo` (with zero `@deprecated` forwarders) and add `gradleDaemon` and `skipBuildDependencyValidation` convenience getters on `AndroidBuildInfo`. - Update `FlutterCommand.getBuildInfo()` in `flutter_command.dart` to construct `AndroidGradleConfig`. - Update `buildGradleApp`, `buildGradleAar`, and `_checkJavaAndGradleCompatibility` in `gradle.dart` to read Gradle configuration via `AndroidBuildInfo`. - Update unit tests across `build_info_test.dart`, `flutter_command_test.dart`, `android_gradle_builder_test.dart`, and `build_aar_test.dart`. ### Flow / Surface Delta ```mermaid flowchart LR A["FlutterCommand.getBuildInfo()"] --> B["BuildInfo(androidGradleConfig)"] B --> C["AndroidBuildInfo.toGradleConfig()"] C --> D["gradle.dart (-P flags)"] ``` ### Verification - Executed `dart analyze --fatal-infos` on `packages/flutter_tools` with 0 issues. - Executed `dart test` across `build_info_test.dart`, `flutter_command_test.dart`, `android_gradle_builder_test.dart`, and `build_aar_test.dart` (`160/160` passing). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
suryaKommana2662
pushed a commit
to suryaKommana2662/flutter
that referenced
this pull request
Oct 29, 2026
…lutter#193323) Migrate `BuildLinuxCommand` (`build linux`) and `BuildWindowsCommand` (`build windows`) to typed `OptionDescriptor`s and `OptionBundle`s (following flutter#191018, flutter#191510, flutter#191760, flutter#192307, flutter#192455, flutter#192524, and flutter#192818): - Add `DesktopBuildOptionsBundle` in `common_options.dart`, encapsulating `CommonBuildOptionsBundle`, `BuildModeOptionsBundle`, `DartCompileOptionsBundle`, `BuildInfoOptions.flavor`, `splitDebugInfo`, `obfuscate`, `extraFrontEndOptions`, `extraGenSnapshotOptions`, `performanceMeasurementFile`, `analyzeSize`, `codeSizeDirectory`, `trackWidgetCreation`, and `configOnly`. - Migrate `BuildLinuxCommand` (`build_linux.dart`) to `DesktopBuildOptionsBundle`, `DefaultedEnumOptionDescriptor<TargetPlatform>` (`_targetPlatformOption`), and `DefaultedStringOptionDescriptor` (`_targetSysroot`), replacing untyped `boolArg('config-only')`, `stringArg('target-platform')!`, and `stringArg('target-sysroot')!` queries. - Migrate `BuildWindowsCommand` (`build_windows.dart`) to `DesktopBuildOptionsBundle` and `getValue(DesktopBuildOptionsBundle.configOnly)`. - Delete the obsolete `FlutterCommand.addCommonDesktopBuildOptions` helper method from `flutter_command.dart` (no remaining callers in `flutter_tools`). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
suryaKommana2662
pushed a commit
to suryaKommana2662/flutter
that referenced
this pull request
Oct 29, 2026
…lutter#194017) ### Rationale `FlutterTestRunner.runTests` accepted 33 loose parameters (duplicating 23 of them on `runTestsBySpawningLightweightEngines` alongside duplicated `package:test` CLI argument lists), and `DriverService.startTest` accepted 12 loose parameters fed by untyped `boolArg` / `stringArg` / regex splitting in `TestCommand` and `DriveCommand`. Following flutter#191018, flutter#191510, flutter#191760, flutter#192307, flutter#192455, flutter#192524, flutter#192818, and flutter#193323, this change introduces immutable service-layer specification objects and migrates `TestCommand` and `DriveCommand` to typed `OptionDescriptor`s. ### Summary of Changes - Introduce `@immutable class TestFilterSpecification` and `@immutable class TestExecutionSpecification` (with `toPackageTestArgs()`) in `test/runner.dart`, shrinking `FlutterTestRunner.runTests` from 33 parameters to 3 (`testWrapper`, `testFiles`, `spec`) and `runTestsBySpawningLightweightEngines` from 25 parameters to 2 (`testFiles`, `spec`). - Migrate `TestCommand` (`commands/test.dart`) from inline `argParser` registrations and untyped `boolArg`/`stringArg`/`stringsArg` queries to private typed `OptionDescriptor` constants (`argParser.addDescriptors` + `getValue` / `wasParsed`), and update `bin/fuchsia_tester.dart`. - Introduce `@immutable class DriveTestSpecification` (with `parseBrowserDimension`) in `drive/drive_service.dart`, shrinking `DriverService.startTest` (and `FlutterDriverService` / `WebDriverService`) from 12 parameters to 2 (`testFile`, `spec`). - Migrate `DriveCommand` (`commands/drive.dart`) from inline registrations and ad-hoc string/int/enum parsing to private typed `OptionDescriptor` constants (`IntOptionDescriptor`, `DefaultedEnumOptionDescriptor<Browser>`, etc.) and `DriveTestSpecification`. - Update unit tests across `test_test.dart`, `drive_test.dart`, `drive_service_test.dart`, and `web_driver_service_test.dart`. ### Flow / Surface Delta ```mermaid flowchart LR A["TestCommand (OptionDescriptors)"] --> B["TestExecutionSpecification"] B --> C["FlutterTestRunner.runTests(spec)"] D["DriveCommand (OptionDescriptors)"] --> E["DriveTestSpecification"] E --> F["DriverService.startTest(spec)"] ``` ### Verification - Executed `dart analyze --fatal-infos` on `packages/flutter_tools` with 0 issues. - Executed `dart test` across `test_test.dart`, `drive_test.dart`, `drive_service_test.dart`, and `web_driver_service_test.dart` (`148/148` passing). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
suryaKommana2662
pushed a commit
to suryaKommana2662/flutter
that referenced
this pull request
Oct 29, 2026
…fig to AndroidBuildInfo (flutter#194016) ### Rationale `BuildInfo` is the cross-platform build configuration passed across Android, iOS, Web, Desktop, and Fuchsia targets, yet it carried 6 loose Android/Gradle fields (`androidProjectArgs`, `androidGradleProjectCacheDir`, `androidGradleDaemon`, `androidSkipBuildDependencyValidation`, `androidEnableHcpp`, `explicitAndroidEnableHcpp`) and the Gradle `-P` flag serializer `toGradleConfig()`. Following flutter#191018, flutter#191510, flutter#191760, flutter#192307, flutter#192455, flutter#192524, flutter#192818, and flutter#193323, this change encapsulates those fields into `AndroidGradleConfig` and moves `toGradleConfig()` onto `AndroidBuildInfo` where all production callers already operate. ### Summary of Changes - Introduce `@immutable class AndroidGradleConfig` in `build_info.dart` and replace the 6 loose `android*` parameters on `BuildInfo` and `BuildInfo.copyWith` with `androidGradleConfig` (shrinking `BuildInfo`'s constructor from 28 to 23 parameters while preserving `AndroidDevice.startApp` forwarding during `flutter run`). - Move `toGradleConfig()` off `BuildInfo` onto `AndroidBuildInfo` (with zero `@deprecated` forwarders) and add `gradleDaemon` and `skipBuildDependencyValidation` convenience getters on `AndroidBuildInfo`. - Update `FlutterCommand.getBuildInfo()` in `flutter_command.dart` to construct `AndroidGradleConfig`. - Update `buildGradleApp`, `buildGradleAar`, and `_checkJavaAndGradleCompatibility` in `gradle.dart` to read Gradle configuration via `AndroidBuildInfo`. - Update unit tests across `build_info_test.dart`, `flutter_command_test.dart`, `android_gradle_builder_test.dart`, and `build_aar_test.dart`. ### Flow / Surface Delta ```mermaid flowchart LR A["FlutterCommand.getBuildInfo()"] --> B["BuildInfo(androidGradleConfig)"] B --> C["AndroidBuildInfo.toGradleConfig()"] C --> D["gradle.dart (-P flags)"] ``` ### Verification - Executed `dart analyze --fatal-infos` on `packages/flutter_tools` with 0 issues. - Executed `dart test` across `build_info_test.dart`, `flutter_command_test.dart`, `android_gradle_builder_test.dart`, and `build_aar_test.dart` (`160/160` passing). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrate
BuildLinuxCommand(build linux) andBuildWindowsCommand(build windows) to typedOptionDescriptors andOptionBundles (following #191018, #191510, #191760, #192307, #192455, #192524, and #192818):DesktopBuildOptionsBundleincommon_options.dart, encapsulatingCommonBuildOptionsBundle,BuildModeOptionsBundle,DartCompileOptionsBundle,BuildInfoOptions.flavor,splitDebugInfo,obfuscate,extraFrontEndOptions,extraGenSnapshotOptions,performanceMeasurementFile,analyzeSize,codeSizeDirectory,trackWidgetCreation, andconfigOnly.BuildLinuxCommand(build_linux.dart) toDesktopBuildOptionsBundle,DefaultedEnumOptionDescriptor<TargetPlatform>(_targetPlatformOption), andDefaultedStringOptionDescriptor(_targetSysroot), replacing untypedboolArg('config-only'),stringArg('target-platform')!, andstringArg('target-sysroot')!queries.BuildWindowsCommand(build_windows.dart) toDesktopBuildOptionsBundleandgetValue(DesktopBuildOptionsBundle.configOnly).FlutterCommand.addCommonDesktopBuildOptionshelper method fromflutter_command.dart(no remaining callers influtter_tools).Pre-launch Checklist
///).