Unverified Commit 0b72d5ca authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tool] allow disabling profile mode timeline traces (#97622)

parent 4a7e30f8
...@@ -177,8 +177,12 @@ List<String> buildModeOptions(BuildMode mode, List<String> dartDefines) { ...@@ -177,8 +177,12 @@ List<String> buildModeOptions(BuildMode mode, List<String> dartDefines) {
]; ];
case BuildMode.profile: case BuildMode.profile:
return <String>[ return <String>[
'-Ddart.vm.profile=true', // These checks allow the CLI to override the value of this define for
'-Ddart.vm.product=false', // benchmarks with most timeline traces disabled.
if (!dartDefines.any((String define) => define.startsWith('dart.vm.profile')))
'-Ddart.vm.profile=true',
if (!dartDefines.any((String define) => define.startsWith('dart.vm.product')))
'-Ddart.vm.product=false',
]; ];
case BuildMode.release: case BuildMode.release:
return <String>[ return <String>[
......
...@@ -89,16 +89,27 @@ void main() { ...@@ -89,16 +89,27 @@ void main() {
]); ]);
}); });
testWithoutContext('buildModeOptions removes matching profile define', () { testWithoutContext('buildModeOptions removes matching profile define in debug mode', () {
expect(buildModeOptions(BuildMode.debug, <String>['dart.vm.profile=true']), <String>[ expect(buildModeOptions(BuildMode.debug, <String>['dart.vm.profile=true']), <String>[
'-Ddart.vm.product=false', '-Ddart.vm.product=false',
'--enable-asserts', '--enable-asserts',
]); ]);
}); });
testWithoutContext('buildModeOptions removes both matching profile and release define', () { testWithoutContext('buildModeOptions removes both matching profile and release define in debug mode', () {
expect(buildModeOptions(BuildMode.debug, <String>['dart.vm.profile=true', 'dart.vm.product=true']), <String>[ expect(buildModeOptions(BuildMode.debug, <String>['dart.vm.profile=true', 'dart.vm.product=true']), <String>[
'--enable-asserts', '--enable-asserts',
]); ]);
}); });
testWithoutContext('buildModeOptions removes matching profile define in profile mode', () {
expect(buildModeOptions(BuildMode.profile, <String>['dart.vm.profile=true']), <String>[
'-Ddart.vm.product=false',
]);
});
testWithoutContext('buildModeOptions removes both matching profile and release define in profile mode', () {
expect(buildModeOptions(BuildMode.profile, <String>['dart.vm.profile=false', 'dart.vm.product=true']), <String>[
]);
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment