Repository navigation
[tool] Migrate Desktop build subcommands and toolchain to modular dependency injection - #190781
Conversation
b4d1727 to
6a55c06
Compare
…endency injection
6a55c06 to
541ae40
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors BuildCommand, BuildLinuxCommand, and BuildWindowsCommand to accept a ToolContext for dependency injection, reducing reliance on global context lookups. The associated tests are also updated to use new helper methods for command instantiation. The review feedback suggests further simplifying the code by removing redundant operatingSystemUtils parameters and fields that are already accessible via toolContext.os. Additionally, it is recommended to use effectivePlatform consistently in fallback instantiations and to avoid overriding the passed platform parameter with global context lookups.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the BuildCommand and its subcommands, BuildLinuxCommand and BuildWindowsCommand, to improve dependency injection by introducing ToolContext and FeatureFlags. The changes update constructors to accept these dependencies and provide fallback mechanisms, enhancing testability and modularity. Corresponding tests have been updated to reflect these architectural changes. The reviewer suggests further improving dependency injection by retrieving services such as PersistentToolState, HttpClientFactory, UserMessages, and Stdio from the context instead of hardcoding them.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors BuildCommand and its subclasses to use ToolContext for dependency management, simplifying constructor logic and updating test suites accordingly. Review feedback suggests extracting complex initialization logic into factory methods, consolidating duplicate _DefaultFeatureFlags definitions, and centralizing test setup to improve maintainability.
…ck implementations
…t.dart and fix directives ordering
flutter/flutter@b444e78...63b9518 2026-09-09 [email protected] Roll Packages from 9af9c60 to 36e088a (24 revisions) (flutter/flutter#192485) 2026-09-09 [email protected] Re-add Xcode and OpenJDK dependencies to macOS wasm local_engine builders (flutter/flutter#192238) 2026-09-09 [email protected] Roll Dart SDK from 77094991d1c1 to 4be1b711b4ba (5 revisions) (flutter/flutter#192453) 2026-09-09 [email protected] [material] Use super parameters in more places (flutter/flutter#192149) 2026-09-09 [email protected] [cupertino] Use super parameters in more places (flutter/flutter#192148) 2026-09-09 [email protected] [flutter_tools] Gracefully handle EROFS and write-protected file system errors (flutter/flutter#192431) 2026-09-09 [email protected] [tool] Migrate BuildIOSCommand and BuildIOSArchiveCommand to modular dependency injection (flutter/flutter#192250) 2026-09-09 [email protected] Replace more enum instances comparison to use `equality ==` instead of `identical` and update related tests (flutter/flutter#192229) 2026-09-09 [email protected] [web] Support local screenshot and golden testing in felt test (flutter/flutter#191318) 2026-09-09 [email protected] [tool] Migrate DaemonCommand and DebugAdapterCommand to modular dependency injection (flutter/flutter#190793) 2026-09-09 [email protected] [web] Support local golden testing in flutter test (flutter/flutter#191386) 2026-09-09 [email protected] [flutter_tools] Ignore widget previews outside lib/ during LSP code generation (flutter/flutter#192326) 2026-09-09 [email protected] [flutter_tools] Read package_config.json asynchronously in loadPackageConfigWithLogging (flutter/flutter#192443) 2026-09-08 [email protected] Add precacheTestImage to flutter_test and unskip web image tests (flutter/flutter#191435) 2026-09-08 [email protected] et: Fix compile_commands.json post-processing (flutter/flutter#192395) 2026-09-08 [email protected] Refactor createDebuggingOptions and option registrations to OptionDescriptor (flutter/flutter#192307) 2026-09-08 [email protected] [flutter_tools] Fix test separation between `VersionFreshnessValidator` and `FlutterVersion.checkFlutterVersionFreshness` (flutter/flutter#191593) 2026-09-08 [email protected] [tool] Migrate EmulatorsCommand to modular dependency injection (flutter/flutter#190769) 2026-09-08 [email protected] [tool] Migrate Desktop build subcommands and toolchain to modular dependency injection (flutter/flutter#190781) 2026-09-08 [email protected] [tool] Migrate Tooling and Analysis commands to modular dependency injection (flutter/flutter#190788) 2026-09-08 [email protected] Skip KGP version validation for AGP built-in Kotlin (flutter/flutter#192206) 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#12814) flutter/flutter@b444e78...63b9518 2026-09-09 [email protected] Roll Packages from 9af9c60 to 36e088a (24 revisions) (flutter/flutter#192485) 2026-09-09 [email protected] Re-add Xcode and OpenJDK dependencies to macOS wasm local_engine builders (flutter/flutter#192238) 2026-09-09 [email protected] Roll Dart SDK from 77094991d1c1 to 4be1b711b4ba (5 revisions) (flutter/flutter#192453) 2026-09-09 [email protected] [material] Use super parameters in more places (flutter/flutter#192149) 2026-09-09 [email protected] [cupertino] Use super parameters in more places (flutter/flutter#192148) 2026-09-09 [email protected] [flutter_tools] Gracefully handle EROFS and write-protected file system errors (flutter/flutter#192431) 2026-09-09 [email protected] [tool] Migrate BuildIOSCommand and BuildIOSArchiveCommand to modular dependency injection (flutter/flutter#192250) 2026-09-09 [email protected] Replace more enum instances comparison to use `equality ==` instead of `identical` and update related tests (flutter/flutter#192229) 2026-09-09 [email protected] [web] Support local screenshot and golden testing in felt test (flutter/flutter#191318) 2026-09-09 [email protected] [tool] Migrate DaemonCommand and DebugAdapterCommand to modular dependency injection (flutter/flutter#190793) 2026-09-09 [email protected] [web] Support local golden testing in flutter test (flutter/flutter#191386) 2026-09-09 [email protected] [flutter_tools] Ignore widget previews outside lib/ during LSP code generation (flutter/flutter#192326) 2026-09-09 [email protected] [flutter_tools] Read package_config.json asynchronously in loadPackageConfigWithLogging (flutter/flutter#192443) 2026-09-08 [email protected] Add precacheTestImage to flutter_test and unskip web image tests (flutter/flutter#191435) 2026-09-08 [email protected] et: Fix compile_commands.json post-processing (flutter/flutter#192395) 2026-09-08 [email protected] Refactor createDebuggingOptions and option registrations to OptionDescriptor (flutter/flutter#192307) 2026-09-08 [email protected] [flutter_tools] Fix test separation between `VersionFreshnessValidator` and `FlutterVersion.checkFlutterVersionFreshness` (flutter/flutter#191593) 2026-09-08 [email protected] [tool] Migrate EmulatorsCommand to modular dependency injection (flutter/flutter#190769) 2026-09-08 [email protected] [tool] Migrate Desktop build subcommands and toolchain to modular dependency injection (flutter/flutter#190781) 2026-09-08 [email protected] [tool] Migrate Tooling and Analysis commands to modular dependency injection (flutter/flutter#190788) 2026-09-08 [email protected] Skip KGP version validation for AGP built-in Kotlin (flutter/flutter#192206) 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#12814) flutter/flutter@b444e78...63b9518 2026-09-09 [email protected] Roll Packages from 9af9c60 to 36e088a (24 revisions) (flutter/flutter#192485) 2026-09-09 [email protected] Re-add Xcode and OpenJDK dependencies to macOS wasm local_engine builders (flutter/flutter#192238) 2026-09-09 [email protected] Roll Dart SDK from 77094991d1c1 to 4be1b711b4ba (5 revisions) (flutter/flutter#192453) 2026-09-09 [email protected] [material] Use super parameters in more places (flutter/flutter#192149) 2026-09-09 [email protected] [cupertino] Use super parameters in more places (flutter/flutter#192148) 2026-09-09 [email protected] [flutter_tools] Gracefully handle EROFS and write-protected file system errors (flutter/flutter#192431) 2026-09-09 [email protected] [tool] Migrate BuildIOSCommand and BuildIOSArchiveCommand to modular dependency injection (flutter/flutter#192250) 2026-09-09 [email protected] Replace more enum instances comparison to use `equality ==` instead of `identical` and update related tests (flutter/flutter#192229) 2026-09-09 [email protected] [web] Support local screenshot and golden testing in felt test (flutter/flutter#191318) 2026-09-09 [email protected] [tool] Migrate DaemonCommand and DebugAdapterCommand to modular dependency injection (flutter/flutter#190793) 2026-09-09 [email protected] [web] Support local golden testing in flutter test (flutter/flutter#191386) 2026-09-09 [email protected] [flutter_tools] Ignore widget previews outside lib/ during LSP code generation (flutter/flutter#192326) 2026-09-09 [email protected] [flutter_tools] Read package_config.json asynchronously in loadPackageConfigWithLogging (flutter/flutter#192443) 2026-09-08 [email protected] Add precacheTestImage to flutter_test and unskip web image tests (flutter/flutter#191435) 2026-09-08 [email protected] et: Fix compile_commands.json post-processing (flutter/flutter#192395) 2026-09-08 [email protected] Refactor createDebuggingOptions and option registrations to OptionDescriptor (flutter/flutter#192307) 2026-09-08 [email protected] [flutter_tools] Fix test separation between `VersionFreshnessValidator` and `FlutterVersion.checkFlutterVersionFreshness` (flutter/flutter#191593) 2026-09-08 [email protected] [tool] Migrate EmulatorsCommand to modular dependency injection (flutter/flutter#190769) 2026-09-08 [email protected] [tool] Migrate Desktop build subcommands and toolchain to modular dependency injection (flutter/flutter#190781) 2026-09-08 [email protected] [tool] Migrate Tooling and Analysis commands to modular dependency injection (flutter/flutter#190788) 2026-09-08 [email protected] Skip KGP version validation for AGP built-in Kotlin (flutter/flutter#192206) 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
Summary
Part 16 of the modular dependency injection migration.
BuildWindowsCommand({required this.buildSystem, required ToolContext toolContext, required bool verboseHelp, required FeatureFlags featureFlags, required VisualStudio visualStudio})BuildLinuxCommand({required this.buildSystem, required ToolContext toolContext, required bool verboseHelp, required FeatureFlags featureFlags})_DefaultFeatureFlagsand all constructor/ambient fallbacks, requiring explicitFeatureFlags,BuildSystem, andToolContext.ToolDependenciesinexecutable.dart.test/commands.shard/hermetic/build_windows_test.dartandbuild_linux_test.dartto hermetictestWithoutContext.Part of #188471