Skip to content

[flutter_tools] Register trackWidgetCreation in AppleBuildOptionsBundle - #196078

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:issue-195792
Nov 13, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:issue-195792

Conversation

@bkonyi

@bkonyi bkonyi commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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 #56094 (first shipped in Flutter 1.20.0). Prior to #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'. #56094 switched xcodeproj.dart to buildInfo.toEnvironmentConfig(), which unconditionally writes TRACK_WIDGET_CREATION=${trackWidgetCreation}.

In #101123 (fixing #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 #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 #195792

Registers `BuildInfoOptions.trackWidgetCreation` in `AppleBuildOptionsBundle` so Apple build subcommands (`build ios`, `build ipa`, and `build macos`) register `--[no-]track-widget-creation` (defaulting to on).

Previously, `AppleBuildOptionsBundle` omitted `trackWidgetCreation`, causing `flutter build ios --debug` to evaluate `trackWidgetCreation` as false in `getBuildInfo()` and emit `TRACK_WIDGET_CREATION=false` in `Generated.xcconfig`. When attaching to the running debug app with `flutter attach`, hot reloads compiled with `--track-widget-creation` resulted in a `Lookup failed: _location` runtime error.

Previous 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 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=true\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 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
@bkonyi bkonyi added the CICD Run CI/CD label Nov 6, 2026
@github-actions github-actions Bot added tool Affects the "flutter" command-line tool. See also t: labels. team-ios Owned by iOS platform team team-macos Owned by the macOS platform team labels Nov 6, 2026
@bkonyi
bkonyi requested a review from cbracken November 6, 2026 03:28
@bkonyi
bkonyi marked this pull request as ready for review November 6, 2026 03:28
@bkonyi
bkonyi requested review from a team as code owners November 6, 2026 03:28

@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 consolidates the trackWidgetCreation option by adding it directly to AppleBuildOptionsBundle and removing its redundant registration in BuildMacosCommand. It also adds corresponding tests to ensure that ios build config-only correctly writes the TRACK_WIDGET_CREATION flag to Generated.xcconfig and respects the --no-track-widget-creation flag. I have no feedback to provide.

cbracken
cbracken previously approved these changes Nov 10, 2026

@cbracken cbracken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM stamp from a Japanese personal seal

Explicitly passes `--debug` in the `build_ios_test.dart` config-only tests for `TRACK_WIDGET_CREATION` since `flutter build ios` defaults to release mode.

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!
```
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 13, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Nov 13, 2026
Merged via the queue into flutter:master with commit 22b8692 Nov 13, 2026
20 of 21 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 13, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 13, 2026
…13653)

Manual roll Flutter from 9c427b5d7b1c to 1b9585481095 (32 revisions)

Manual roll requested by [email protected]

flutter/flutter@9c427b5...1b95854

2026-11-13 [email protected] Roll pub packages (flutter/flutter#196541)
2026-11-13 [email protected] Do not route PRs for review without cla, convert to draft (flutter/flutter#196341)
2026-11-13 [email protected] Roll Skia from d87a6c04da74 to 11f46cfe8838 (13 revisions) (flutter/flutter#196533)
2026-11-13 [email protected] [flutter_tools, flutter_test] Deprecate --experimental-faster-testing (flutter/flutter#196123)
2026-11-13 [email protected] [flutter_tools] Handle RPCError in ScreenshotCommand.runSkia (flutter/flutter#196132)
2026-11-13 [email protected] Roll Dart SDK from a8b961fd48bb to c91e8b6674e2 (2 revisions) (flutter/flutter#196502)
2026-11-13 [email protected] Roll Skia from 0c5ce4960cef to d87a6c04da74 (12 revisions) (flutter/flutter#196497)
2026-11-13 [email protected] Don't call `skia_image()`  for raster-owned images in `DlImage::Equals` (flutter/flutter#196473)
2026-11-13 [email protected] [flutter_tools] Require FlutterCommandRunner DI fields and extract findCommandName (flutter/flutter#196331)
2026-11-13 [email protected] [web] Unify ui.Canvas behind a shared EngineCanvas frontend (flutter/flutter#196348)
2026-11-13 [email protected] Link to MediaQuery.displayFeaturesOf from DisplayFeatures (flutter/flutter#193728)
2026-11-13 [email protected] Removes reference to unnecessary ensureSemantics call in doc (flutter/flutter#195831)
2026-11-13 [email protected] [flutter_tools] Register trackWidgetCreation in AppleBuildOptionsBundle (flutter/flutter#196078)
2026-11-12 [email protected] [Android] Skip the HardwareBuffer defect fallback for platform views (flutter/flutter#193441)
2026-11-12 [email protected] Fix supports_decal check in framebuffer_blend.frag (flutter/flutter#196227)
2026-11-12 [email protected] [ios] Update the screen in didUpdateEffectiveGeometry (flutter/flutter#195508)
2026-11-12 [email protected] [flutter_tools] Add `Cache-Control` headers for web test assets (flutter/flutter#196414)
2026-11-12 [email protected] Roll Skia from 3b71ec08218f to 0c5ce4960cef (16 revisions) (flutter/flutter#196472)
2026-11-12 [email protected] [web] Render bounded ImageFilter.blur on wimp (flutter/flutter#196081)
2026-11-12 [email protected] Roll Dart SDK from 69567bd3c427 to a8b961fd48bb (2 revisions) (flutter/flutter#196464)
2026-11-12 [email protected] [engine] Release the Skia OpenGL resource context on shutdown (flutter/flutter#193592)
2026-11-12 [email protected] [web] Fix decoding of still AVIF images on Chrome (flutter/flutter#195958)
2026-11-12 [email protected] Gate SurfaceControl context setting on API 34+ (flutter/flutter#196394)
2026-11-12 [email protected] [flutter_tools] Only pass on a valid root tool in DASH__TOOL (flutter/flutter#196228)
2026-11-12 [email protected] Support GL_TEXTURE_EXTERNAL_OES embedder textures in Impeller (flutter/flutter#195857)
2026-11-12 [email protected] Stop building linux/wasm_release in local_engine_builds (flutter/flutter#196345)
2026-11-12 [email protected] Split flame out of Linux customer_testing (flutter/flutter#196347)
2026-11-12 Jiwon Lee [Windows] Fix Space input after Alt+Space with previous Microsoft IME (flutter/flutter#192105)
2026-11-12 [email protected] [flutter_tools] Add ToolExtensionException, exit() guard, graceful shutdown, and base modifiers (flutter/flutter#195908)
2026-11-12 [email protected] Roll Packages from 653628e to 14f9933 (9 revisions) (flutter/flutter#196450)
2026-11-12 [email protected] Roll Dart SDK from e5add7a25b32 to 69567bd3c427 (2 revisions) (flutter/flutter#196437)
2026-11-12 [email protected] Roll Skia from 9aa2513a4ac9 to 3b71ec08218f (1 revision) (flutter/flutter#196436)

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

...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD team-ios Owned by iOS platform team team-macos Owned by the macOS 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.

First hot reload after flutter attach fails for an app built with flutter build ios --debug

2 participants