Repository navigation
Fix XcodeProjectInterpreter dependency cycle in flutter_tools - #195694
Merged
Merged
Conversation
This fixes an issue where accessing `globals.projectFactory` would immediately evaluate `globals.xcode` and `globals.xcodeProjectInterpreter`, creating a circular dependency cycle when Analytics initializes the Cache. Fixes flutter#47161 Fixes flutter#188471
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates globals.dart to lazily evaluate Xcode and XcodeProjectInterpreter by using builder functions, and introduces a new test file to verify this lazy evaluation. The review feedback suggests removing a redundant null assertion on a non-nullable object and making the fake test classes private to follow Dart best practices.
harryterkelsen
self-requested a review
October 30, 2026 18:27
harryterkelsen
requested changes
Oct 30, 2026
harryterkelsen
previously approved these changes
Oct 30, 2026
# Conflicts: # packages/flutter_tools/lib/src/globals.dart
harryterkelsen
approved these changes
Oct 30, 2026
Contributor
|
autosubmit label was removed for flutter/flutter/195694, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
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
…r#195694) Defer `xcode` and `xcodeProjectInterpreter` evaluation in `globals.projectFactory` by passing `xcodeBuilder: () => xcode` and `xcodeProjectInterpreterBuilder: () => xcodeProjectInterpreter` instead of eagerly evaluating the `context.get` getters. Previously, accessing `globals.projectFactory` (e.g., via `Cache` during `Analytics` initialization) eagerly evaluated `globals.xcode` and `globals.xcodeProjectInterpreter`, triggering an `AppContext` dependency cycle (`Analytics -> Cache -> Xcode -> XcodeProjectInterpreter`). Includes a regression test in `packages/flutter_tools/test/general.shard/globals_test.dart`. Part of flutter#47161 Related to flutter#188471 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [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. - [ ] I updated/added relevant in-code documentation (doc comments with `///`). - [ ] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [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. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
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.
Defer
xcodeandxcodeProjectInterpreterevaluation inglobals.projectFactoryby passingxcodeBuilder: () => xcodeandxcodeProjectInterpreterBuilder: () => xcodeProjectInterpreterinstead of eagerly evaluating thecontext.getgetters.Previously, accessing
globals.projectFactory(e.g., viaCacheduringAnalyticsinitialization) eagerly evaluatedglobals.xcodeandglobals.xcodeProjectInterpreter, triggering anAppContextdependency cycle (Analytics -> Cache -> Xcode -> XcodeProjectInterpreter).Includes a regression test in
packages/flutter_tools/test/general.shard/globals_test.dart.Part of #47161
Related to #188471
Pre-launch Checklist
///).