mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tool] allow disabling profile mode timeline traces (#97622)
This commit is contained in:
parent
4a7e30f87d
commit
0b72d5ca58
@ -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() {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
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>[
|
||||||
|
]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user