Repository navigation
Enable track widget creation when generating Generated.xcconfig - #101123
Merged
Merged
Conversation
Contributor
|
@jmagman can you take a look at this one? |
jmagman
reviewed
Apr 7, 2022
jmagman
requested changes
Apr 8, 2022
jmagman
left a comment
Member
There was a problem hiding this comment.
Requesting changes to make this the default BuildInfo.debug behavior.
Contributor
Author
|
@jmagman Thanks for your review! Just updated |
jmagman
reviewed
Apr 8, 2022
jmagman
left a comment
Member
There was a problem hiding this comment.
LGTM with minor null nit.
Thanks for the contribution!
….dart Co-authored-by: Jenn Magder <[email protected]>
Contributor
|
This pull request is not suitable for automatic merging in its current state.
|
Member
|
Adding @christopherfujino for second review, forgot we needed that. |
Contributor
|
This pull request is not suitable for automatic merging in its current state.
|
This was referenced Apr 11, 2022
Closed
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/plugins
that referenced
this pull request
Apr 11, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 11, 2022
This was referenced Apr 11, 2022
Merged
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 11, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/plugins
that referenced
this pull request
Apr 11, 2022
patevs
pushed a commit
to patevs/flutter
that referenced
this pull request
Nov 13, 2026
…le (flutter#196078) Registers `BuildInfoOptions.trackWidgetCreation` in `AppleBuildOptionsBundle` so Apple build subcommands (`build ios`, `build ipa`, and `build macos`) register `--[no-]track-widget-creation` (defaulting to on). Note that `--profile` AOT builds for `build ios` and `build ipa` will also now compile with `--track-creation-locations` by default (unless `--no-track-widget-creation` is passed), matching `build macos`, `build apk`, `build appbundle`, and `flutter run --profile`. This regression was originally introduced in flutter#56094 (first shipped in Flutter 1.20.0). Prior to flutter#56094, `xcodeproj.dart` omitted `TRACK_WIDGET_CREATION` from `Generated.xcconfig` when `buildInfo.trackWidgetCreation` was `false`, and `KernelSnapshot` enabled widget creation tracking whenever `TrackWidgetCreation` was not `'false'`. flutter#56094 switched `xcodeproj.dart` to `buildInfo.toEnvironmentConfig()`, which unconditionally writes `TRACK_WIDGET_CREATION=${trackWidgetCreation}`. In flutter#101123 (fixing flutter#94681), `BuildInfo.debug` was updated to set `trackWidgetCreation: true`, which fixed `Generated.xcconfig` for projects built directly from Xcode after `flutter create` or `flutter pub get` (while `flutter run` already registered `--track-widget-creation`). However, `BuildIOSCommand` constructs its `BuildInfo` via `FlutterCommand.getBuildInfo()` and never registered `--track-widget-creation` (an omission later carried forward into `AppleBuildOptionsBundle` in flutter#192818), so running `flutter build ios --debug` overwrote `Generated.xcconfig` with `TRACK_WIDGET_CREATION=false` and caused the first hot reload after `flutter attach` to fail with `Lookup failed: _location`. Previous output: ``` +13: ios build debug config-only writes TRACK_WIDGET_CREATION=true to Generated.xcconfig by default Expected: contains 'TRACK_WIDGET_CREATION=true' Actual: '// This is a generated file; do not edit or check into version control.\n' 'FLUTTER_ROOT=/usr/local/google/home/bkonyi/.gemini/jetski/worktrees/flutter/issue-195792\n' 'FLUTTER_APPLICATION_PATH=/\n' 'FLUTTER_FRAMEWORK_SWIFT_PACKAGE_PATH=/ios/Flutter/ephemeral/Packages/.packages/FlutterFramework\n' 'COCOAPODS_PARALLEL_CODE_SIGN=true\n' 'FLUTTER_TARGET=lib/main.dart\n' 'FLUTTER_BUILD_DIR=build\n' 'FLUTTER_BUILD_NAME=1.0.0\n' 'FLUTTER_BUILD_NUMBER=1\n' 'EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386\n' 'EXCLUDED_ARCHS[sdk=iphoneos*]=armv7\n' 'DART_DEFINES=RkxVVFRFUl9WRVJTSU9OPTAuMC4w,RkxVVFRFUl9DSEFOTkVMPW1hc3Rlcg==,RkxVVFRFUl9HSVRfVVJMPWh0dHBzOi8vZ2l0aHViLmNvbS9mbHV0dGVyL2ZsdXR0ZXIuZ2l0,RkxVVFRFUl9GUkFNRVdPUktfUkVWSVNJT049MTExMTE=,RkxVVFRFUl9FTkdJTkVfUkVWSVNJT049YWJjZGU=,RkxVVFRFUl9EQVJUX1ZFUlNJT049MTI=\n' 'DART_OBFUSCATION=false\n' 'TRACK_WIDGET_CREATION=false\n' 'TREE_SHAKE_ICONS=false\n' 'PACKAGE_CONFIG=/.dart_tool/package_config.json\n' '' Which: does not contain 'TRACK_WIDGET_CREATION=true' ``` Current output: ``` 00:00 +0: loading /usr/local/google/home/bkonyi/.gemini/jetski/worktrees/flutter/issue-195792/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart 00:00 +0: (setUpAll) 00:00 +0: ios build debug config-only writes TRACK_WIDGET_CREATION=true to Generated.xcconfig by default 00:00 +1: (tearDownAll) 00:00 +1: All tests passed! ``` Fixes flutter#195792
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.
When initializing a flutter module project, flutter will generate a
Generated.xcconfigfor iOS, settingTRACK_WIDGET_CREATION=false. This file is used to generateflutter_export_environment.sh, and finally loaded bypodhelper.rbto build into the host app. However when we runflutter attachto it,track-widget-creationdefaults to true so hot reload breaks until we hot restart it.This fix set
TRACK_WIDGET_CREATION=trueinGenerated.xcconfig, making hot reload in add-to-app work as expected.Fixes #94681
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.