Skip to content

[flutter_tools] Inject dependencies into iOS, macOS, and Windows application packages - #194047

Merged
auto-submit[bot] merged 66 commits into
flutter:masterfrom
bkonyi:di/28f-2-application-packages
Oct 30, 2026
Merged

auto-submit[bot] merged 66 commits into
flutter:masterfrom
bkonyi:di/28f-2-application-packages

Conversation

@bkonyi

@bkonyi bkonyi commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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 #47161

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

bkonyi added 11 commits October 1, 2026 05:27
… project

Inject dependencies into FlutterApplicationMigration, buildMacOS, and XcodeBasedProject (IosProject and MacOSProject) to remove direct globals.dart usages.
…ix FlutterProject.fromDirectoryTest logger fallback
# 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.
@bkonyi
bkonyi requested review from a team as code owners October 9, 2026 00:08
@bkonyi bkonyi added the CICD Run CI/CD label Oct 9, 2026
@github-actions github-actions Bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. platform-macos Building on or for macOS specifically platform-windows Building on or for Windows specifically a: desktop Running on desktop team-ios Owned by iOS platform team team-macos Owned by the macOS platform team team-windows Owned by the Windows platform team labels Oct 9, 2026

@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 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
@bkonyi
bkonyi marked this pull request as draft October 9, 2026 16:46
…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
@github-actions github-actions Bot removed platform-linux Building on or for Linux specifically team-linux Owned by the Linux platform team labels Oct 19, 2026
…and-xcode-project

# Conflicts:
#	packages/flutter_tools/lib/src/context/tool_dependencies.dart
#	packages/flutter_tools/lib/src/flutter_device_manager.dart
…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
@github-actions github-actions Bot removed the team-android Owned by Android platform team label Oct 25, 2026
@bkonyi
bkonyi marked this pull request as ready for review October 28, 2026 21:56
@bkonyi
bkonyi requested a review from chingjun October 28, 2026 21:56

@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 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.

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 30, 2026
Merged via the queue into flutter:master with commit a1ba683 Oct 30, 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 Oct 30, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 31, 2026
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
gmackall pushed a commit to gmackall/flutter that referenced this pull request Nov 3, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD platform-ios iOS applications specifically platform-macos Building on or for macOS specifically platform-windows Building on or for Windows specifically team-ios Owned by iOS platform team team-macos Owned by the macOS platform team team-windows Owned by the Windows platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants