Repository navigation
[tool] Migrate AssembleCommand and GenerateCommand to modular dependency injection - #190773
Conversation
b9fe2b9 to
8062f50
Compare
8062f50 to
383c5e7
Compare
383c5e7 to
2c5bd8c
Compare
2c5bd8c to
de02f0d
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors several Flutter commands, including AssembleCommand, GenerateCommand, and GenerateLocalizationsCommand, to accept and utilize a ToolContext instead of relying on global variables. This refactoring enables the migration of associated tests from testUsingContext to testWithoutContext by injecting mock dependencies. Feedback on the changes identifies that defaulting to true when featureFlags is null in artifactFromTargetPlatform is a testing anti-pattern that bypasses production checks, and suggests falling back to globals.featureFlags instead.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors several Flutter tool commands, including AssembleCommand, GenerateCommand, and GenerateLocalizationsCommand, to accept and utilize a ToolContext instead of relying on global variables. This change enables migrating associated tests from testUsingContext to testWithoutContext by directly injecting fake or mock contexts. The review feedback suggests removing the redundant _flutterProject field in AssembleCommand in favor of the inherited project getter, and renaming the featureFlags parameter in artifactFromTargetPlatform to prevent shadowing the global getter.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors several Flutter commands, including AssembleCommand, GenerateCommand, and GenerateLocalizationsCommand, to accept a ToolContext rather than relying on global variables or individual dependency parameters. Correspondingly, unit tests are migrated from testUsingContext to testWithoutContext by utilizing a FakeToolContext. Feedback on the changes suggests simplifying AssembleCommand by removing the redundant _effectiveAnalytics getter and using the inherited analytics property directly.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors AssembleCommand, GenerateCommand, and GenerateLocalizationsCommand to accept dependencies via a ToolContext parameter rather than relying on global context, enabling the migration of associated tests from testUsingContext to testWithoutContext. The review feedback suggests caching the project getter in AssembleCommand._createEnvironment and caching the l10n.yaml file reference in GenerateLocalizationsCommand.runCommand to avoid redundant lookups and object creation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors AssembleCommand, GenerateCommand, and GenerateLocalizationsCommand to accept and utilize a ToolContext instead of relying on global variables, improving dependency injection and allowing tests to be migrated from testUsingContext to testWithoutContext. Feedback suggests overriding the hidden property to true in GenerateCommand to satisfy the new test assertions, and extracting the repeated customFeatureFlags ?? globals.featureFlags expression in flutter_command.dart into a local variable for better readability.
…factFromTargetPlatform
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors AssembleCommand, GenerateCommand, and GenerateLocalizationsCommand to accept and utilize a ToolContext instead of relying on global variables from globals.dart. Consequently, the associated hermetic tests in assemble_test.dart and generate_localizations_test.dart are migrated from testUsingContext to testWithoutContext using a FakeToolContext to inject dependencies. Additionally, FlutterCommand.project is updated to resolve the project from the file system using _projectFactory rather than FlutterProject.current(). No review comments were provided for this pull request, so there is no feedback to evaluate.
…d and remove globals fallback
|
/gemini review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…romTargetPlatform
…ss in AssembleCommand
flutter/flutter@5a6cfa7...63170e9 2026-09-05 [email protected] Roll Dart SDK from 6882c3b4b542 to 77094991d1c1 (1 revision) (flutter/flutter#192339) 2026-09-05 [email protected] Roll Skia from 10652f9d64d6 to db200e27a634 (1 revision) (flutter/flutter#192338) 2026-09-05 [email protected] Roll Fuchsia Linux SDK from FgDQeF6jb1dVRVh3K... to _IgixhH4vEgdz9Oqn... (flutter/flutter#192333) 2026-09-05 [email protected] Roll Dart SDK from 5744c2480a12 to 6882c3b4b542 (1 revision) (flutter/flutter#192331) 2026-09-05 [email protected] Roll Skia from 9b1e5fd08d2c to 10652f9d64d6 (4 revisions) (flutter/flutter#192329) 2026-09-05 [email protected] ci(engine): target ignore_phone|none for new macs (flutter/flutter#192317) 2026-09-04 [email protected] [devicelab] Fix Mac ios_universal_link_test CI build and scheme configuration (flutter/flutter#192321) 2026-09-04 [email protected] Roll Dart SDK from 5501d02b583d to 5744c2480a12 (5 revisions) (flutter/flutter#192316) 2026-09-04 [email protected] [iOS] Add native deep link lifecycle integration tests for UIScene plugins (flutter/flutter#192173) 2026-09-04 [email protected] Roll Skia from 93ac1e630d1d to 9b1e5fd08d2c (3 revisions) (flutter/flutter#192314) 2026-09-04 [email protected] [tool] Migrate AssembleCommand and GenerateCommand to modular dependency injection (flutter/flutter#190773) 2026-09-04 [email protected] [tool] Migrate Apple build subcommands and toolchain to modular dependency injection (flutter/flutter#190780) 2026-09-04 [email protected] [flutter_tools] Safely handle non-JSON messages in test stream parsers (flutter/flutter#192089) 2026-09-04 [email protected] [tool] Migrate LogsCommand to modular dependency injection (flutter/flutter#190765) 2026-09-04 [email protected] [tool] Migrate DevicesCommand to modular dependency injection (flutter/flutter#190768) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [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
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.
…r#12767) flutter/flutter@5a6cfa7...63170e9 2026-09-05 [email protected] Roll Dart SDK from 6882c3b4b542 to 77094991d1c1 (1 revision) (flutter/flutter#192339) 2026-09-05 [email protected] Roll Skia from 10652f9d64d6 to db200e27a634 (1 revision) (flutter/flutter#192338) 2026-09-05 [email protected] Roll Fuchsia Linux SDK from FgDQeF6jb1dVRVh3K... to _IgixhH4vEgdz9Oqn... (flutter/flutter#192333) 2026-09-05 [email protected] Roll Dart SDK from 5744c2480a12 to 6882c3b4b542 (1 revision) (flutter/flutter#192331) 2026-09-05 [email protected] Roll Skia from 9b1e5fd08d2c to 10652f9d64d6 (4 revisions) (flutter/flutter#192329) 2026-09-05 [email protected] ci(engine): target ignore_phone|none for new macs (flutter/flutter#192317) 2026-09-04 [email protected] [devicelab] Fix Mac ios_universal_link_test CI build and scheme configuration (flutter/flutter#192321) 2026-09-04 [email protected] Roll Dart SDK from 5501d02b583d to 5744c2480a12 (5 revisions) (flutter/flutter#192316) 2026-09-04 [email protected] [iOS] Add native deep link lifecycle integration tests for UIScene plugins (flutter/flutter#192173) 2026-09-04 [email protected] Roll Skia from 93ac1e630d1d to 9b1e5fd08d2c (3 revisions) (flutter/flutter#192314) 2026-09-04 [email protected] [tool] Migrate AssembleCommand and GenerateCommand to modular dependency injection (flutter/flutter#190773) 2026-09-04 [email protected] [tool] Migrate Apple build subcommands and toolchain to modular dependency injection (flutter/flutter#190780) 2026-09-04 [email protected] [flutter_tools] Safely handle non-JSON messages in test stream parsers (flutter/flutter#192089) 2026-09-04 [email protected] [tool] Migrate LogsCommand to modular dependency injection (flutter/flutter#190765) 2026-09-04 [email protected] [tool] Migrate DevicesCommand to modular dependency injection (flutter/flutter#190768) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [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#12767) flutter/flutter@5a6cfa7...63170e9 2026-09-05 [email protected] Roll Dart SDK from 6882c3b4b542 to 77094991d1c1 (1 revision) (flutter/flutter#192339) 2026-09-05 [email protected] Roll Skia from 10652f9d64d6 to db200e27a634 (1 revision) (flutter/flutter#192338) 2026-09-05 [email protected] Roll Fuchsia Linux SDK from FgDQeF6jb1dVRVh3K... to _IgixhH4vEgdz9Oqn... (flutter/flutter#192333) 2026-09-05 [email protected] Roll Dart SDK from 5744c2480a12 to 6882c3b4b542 (1 revision) (flutter/flutter#192331) 2026-09-05 [email protected] Roll Skia from 9b1e5fd08d2c to 10652f9d64d6 (4 revisions) (flutter/flutter#192329) 2026-09-05 [email protected] ci(engine): target ignore_phone|none for new macs (flutter/flutter#192317) 2026-09-04 [email protected] [devicelab] Fix Mac ios_universal_link_test CI build and scheme configuration (flutter/flutter#192321) 2026-09-04 [email protected] Roll Dart SDK from 5501d02b583d to 5744c2480a12 (5 revisions) (flutter/flutter#192316) 2026-09-04 [email protected] [iOS] Add native deep link lifecycle integration tests for UIScene plugins (flutter/flutter#192173) 2026-09-04 [email protected] Roll Skia from 93ac1e630d1d to 9b1e5fd08d2c (3 revisions) (flutter/flutter#192314) 2026-09-04 [email protected] [tool] Migrate AssembleCommand and GenerateCommand to modular dependency injection (flutter/flutter#190773) 2026-09-04 [email protected] [tool] Migrate Apple build subcommands and toolchain to modular dependency injection (flutter/flutter#190780) 2026-09-04 [email protected] [flutter_tools] Safely handle non-JSON messages in test stream parsers (flutter/flutter#192089) 2026-09-04 [email protected] [tool] Migrate LogsCommand to modular dependency injection (flutter/flutter#190765) 2026-09-04 [email protected] [tool] Migrate DevicesCommand to modular dependency injection (flutter/flutter#190768) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [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 13 of the modular dependency injection migration.
AssembleCommand,GenerateCommand, andGenerateLocalizationsCommandto constructor dependency injection:AssembleCommand({required BuildSystem buildSystem, required FeatureFlags featureFlags, required ToolContext toolContext, bool verboseHelp = false})GenerateCommand({required ToolContext toolContext})GenerateLocalizationsCommand({required ToolContext toolContext})globals.featureFlagsand ambient context lookups across assemble/generate workflows; exposesfeatureFlagsonToolDependencies.loggerinparseLocalizationsOptionsFromCommandand explicitfeatureFlagsinartifactFromTargetPlatform.packages/flutter_tools/test/commands.shard/hermetic/assemble_test.dartandgenerate_localizations_test.dartto hermetictestWithoutContext.Part of #188471