Repository navigation
[flutter_tools] Inject dependencies into iOS, macOS, and Windows application packages - #194047
Conversation
… project Inject dependencies into FlutterApplicationMigration, buildMacOS, and XcodeBasedProject (IosProject and MacOSProject) to remove direct globals.dart usages.
…and inject FlutterVersion into MacOSDevice
…and-xcode-project
…ix FlutterProject.fromDirectoryTest logger fallback
…and-xcode-project
# Conflicts: # packages/flutter_tools/test/commands.shard/hermetic/update_packages_test.dart
# Conflicts: # packages/flutter_tools/lib/src/context/tool_dependencies.dart
…ication packages Eliminates ambient `globals` usage in `ios/application_package.dart`, `macos/application_package.dart`, `windows/application_package.dart`, and `flutter_application_package.dart` by injecting `FileSystem`, `Logger`, `OperatingSystemUtils`, `Platform`, and `PlistParser` explicitly.
There was a problem hiding this comment.
Code Review
This pull request refactors FlutterApplicationPackageFactory, IOSApp, MacOSApp, and WindowsApp to accept explicitly injected dependencies (such as FileSystem, Logger, Platform, PlistParser, and OperatingSystemUtils) instead of relying on global variables. Consequently, numerous unit tests are migrated from testUsingContext to testWithoutContext. Feedback suggests further migrating a test in application_package_test.dart to testWithoutContext by utilizing FlutterProject.fromDirectoryTest instead of FlutterProject.fromDirectory.
…devices Migrates buildLinux, buildWindows, DesktopDevice, and CustomDevice away from globals.dart to explicit dependency injection via ToolContext. Part of flutter#188471
…utterProject and XcodeBasedProject
…and-xcode-project
…SDevice Uses required this._toolContext in MacOSDevice and expression-bodied members for single-use ToolContext getters in SwiftPackageManagerIntegrationMigration.
…lication-packages # Conflicts: # packages/flutter_tools/lib/src/macos/macos_device.dart
…and-xcode-project # Conflicts: # packages/flutter_tools/lib/src/context/tool_dependencies.dart # packages/flutter_tools/lib/src/flutter_device_manager.dart # packages/flutter_tools/lib/src/macos/macos_device.dart # packages/flutter_tools/test/general.shard/desktop_device_test.dart # packages/flutter_tools/test/general.shard/macos/macos_device_test.dart
…lication-packages
…and-xcode-project # Conflicts: # packages/flutter_tools/lib/src/context/tool_dependencies.dart # packages/flutter_tools/lib/src/flutter_device_manager.dart
…ct' into di/28f-2-application-packages
…and-xcode-project # Conflicts: # packages/flutter_tools/lib/src/commands/build_macos.dart # packages/flutter_tools/lib/src/context/tool_dependencies.dart # packages/flutter_tools/lib/src/globals.dart # packages/flutter_tools/lib/src/ios/mac.dart # packages/flutter_tools/lib/src/macos/build_macos.dart # packages/flutter_tools/lib/src/macos/macos_device.dart # packages/flutter_tools/lib/src/project.dart # packages/flutter_tools/lib/src/xcode_project.dart # packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart # packages/flutter_tools/test/general.shard/xcode_project_test.dart # packages/flutter_tools/test/src/fake_build_command.dart # packages/flutter_tools/test/src/fakes.dart
…lication-packages
…and-xcode-project # Conflicts: # packages/flutter_tools/lib/src/context/tool_dependencies.dart
…lication-packages
…n-packages # Conflicts: # packages/flutter_tools/test/src/fake_build_command.dart
…uation in Google3 tests
There was a problem hiding this comment.
Code Review
This pull request refactors the FlutterApplicationPackageFactory and related classes to replace reliance on global state with explicit dependency injection of PlistParser and ToolContext. The changes update the application package creation methods for iOS, macOS, and Windows to accept these dependencies. Additionally, the corresponding tests have been updated to reflect these architectural changes, including a migration from testUsingContext to testWithoutContext where appropriate. I have no feedback to provide as there were no review comments.
…n build_macos.dart
flutter/flutter@5e805bf...ee8b482 2026-10-31 [email protected] Roll Skia from 9bab765df357 to 607de4b035dc (1 revision) (flutter/flutter#195728) 2026-10-31 [email protected] Roll Skia from 284054bec98a to 9bab765df357 (2 revisions) (flutter/flutter#195726) 2026-10-31 [email protected] Roll Skia from 3a3f56f7ddd4 to 284054bec98a (1 revision) (flutter/flutter#195724) 2026-10-31 [email protected] Roll Skia from 466994d27b1e to 3a3f56f7ddd4 (1 revision) (flutter/flutter#195719) 2026-10-30 [email protected] Fix XcodeProjectInterpreter dependency cycle in flutter_tools (flutter/flutter#195694) 2026-10-30 [email protected] Document that Positioned also works inside an Overlay (flutter/flutter#190607) 2026-10-30 [email protected] Roll Skia from ce0b85b46db6 to 466994d27b1e (3 revisions) (flutter/flutter#195711) 2026-10-30 [email protected] Adds Vulkan sync validation test run (flutter/flutter#195596) 2026-10-30 [email protected] [Android] Let the raster thread use every core of a chip without little cores (flutter/flutter#195071) 2026-10-30 [email protected] Roll Skia from 121d04c01e2d to ce0b85b46db6 (6 revisions) (flutter/flutter#195699) 2026-10-30 [email protected] [web] Anchor platform view slots to top-left to fix RTL document layout (flutter/flutter#194601) 2026-10-30 [email protected] Update golden file testing docs (flutter/flutter#195449) 2026-10-30 [email protected] [tool] Migrate Cache.flutterRoot static state to instance configuration (flutter/flutter#190795) 2026-10-30 [email protected] Apply view metrics overrides below the framework (flutter/flutter#194311) 2026-10-30 [email protected] Roll Skia from c0c46ee9f938 to 121d04c01e2d (9 revisions) (flutter/flutter#195687) 2026-10-30 [email protected] Use uniforms in the Porter Duff blend shader instead of specialization constants (flutter/flutter#195458) 2026-10-30 [email protected] [flutter_tools] Inject dependencies into iOS, macOS, and Windows application packages (flutter/flutter#194047) 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
…ication packages (flutter#194047) Eliminates ambient `globals.dart` usage in `ios/application_package.dart`, `macos/application_package.dart`, `windows/application_package.dart`, and `flutter_application_package.dart` by injecting `PlistParser` and `ToolContext` explicitly. Part of flutter#47161 ## 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]. - [x] 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] All existing and new tests are passing.
Eliminates ambient
globals.dartusage inios/application_package.dart,macos/application_package.dart,windows/application_package.dart, andflutter_application_package.dartby injectingPlistParserandToolContextexplicitly.Part of #47161
Pre-launch Checklist
///).