Repository navigation
Commit 22b8692
authored
[flutter_tools] Register trackWidgetCreation in AppleBuildOptionsBundle (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#1957921 parent 945b567 commit 22b8692
4 files changed
Lines changed: 57 additions & 4 deletions
File tree
- packages/flutter_tools
- lib/src
- commands
- runner/options
- test
- commands.shard/hermetic
- general.shard/runner/options
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 38 | + | |
42 | 39 | | |
43 | 40 | | |
44 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
| 720 | + | |
720 | 721 | | |
721 | 722 | | |
722 | 723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
676 | 676 | | |
677 | 677 | | |
678 | 678 | | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
679 | 733 | | |
680 | 734 | | |
681 | 735 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
| 676 | + | |
676 | 677 | | |
677 | 678 | | |
678 | 679 | | |
| |||
0 commit comments