Made flag for debugging build time of user created widgets (#100926)

* Added a bool that allows us to limit debugProfileBuildsEnabled to user
created widgets.

* made it turned on by default

* switched to hashmap

* Cleaned everything up and added tests

* fixed an odd test where it wants to be able to add asserts and run in profile mode

* hixie feedback

* hixie2

* made it default to false

* updated docstring as per dans request
This commit is contained in:
gaaclarke
2022-04-05 10:54:21 -07:00
committed by GitHub
parent 839a183ea6
commit 35b18ba2e9
7 changed files with 139 additions and 25 deletions

View File

@@ -222,7 +222,7 @@ class KernelSnapshot extends Target {
),
aot: buildMode.isPrecompiled,
buildMode: buildMode,
trackWidgetCreation: trackWidgetCreation && buildMode == BuildMode.debug,
trackWidgetCreation: trackWidgetCreation && buildMode != BuildMode.release,
targetModel: targetModel,
outputFilePath: environment.buildDir.childFile('app.dill').path,
packagesPath: packagesFile.path,

View File

@@ -93,6 +93,7 @@ void main() {
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.profile, <String>[]),
'--track-widget-creation',
'--aot',
'--tfa',
'--packages',
@@ -109,7 +110,7 @@ void main() {
expect(processManager, hasNoRemainingExpectations);
});
testWithoutContext('KernelSnapshot does not use track widget creation on profile builds', () async {
testWithoutContext('KernelSnapshot does use track widget creation on profile builds', () async {
fileSystem.file('.dart_tool/package_config.json')
..createSync(recursive: true)
..writeAsStringSync('{"configVersion": 2, "packages":[]}');
@@ -129,6 +130,7 @@ void main() {
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.profile, <String>[]),
'--track-widget-creation',
'--aot',
'--tfa',
'--packages',
@@ -166,6 +168,7 @@ void main() {
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.profile, <String>[]),
'--track-widget-creation',
'--aot',
'--tfa',
'--packages',
@@ -204,6 +207,7 @@ void main() {
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.profile, <String>[]),
'--track-widget-creation',
'--aot',
'--tfa',
'--packages',