forked from firka/flutter
Add testing shard for release mode guard (#71411)
This commit is contained in:
@@ -146,12 +146,15 @@ class StdoutHandler {
|
||||
}
|
||||
|
||||
/// List the preconfigured build options for a given build mode.
|
||||
List<String> buildModeOptions(BuildMode mode) {
|
||||
List<String> buildModeOptions(BuildMode mode, List<String> dartDefines) {
|
||||
switch (mode) {
|
||||
case BuildMode.debug:
|
||||
return <String>[
|
||||
'-Ddart.vm.profile=false',
|
||||
'-Ddart.vm.product=false',
|
||||
// This allows the CLI to override the value of this define for unit
|
||||
// testing the framework.
|
||||
if (!dartDefines.any((String define) => define.startsWith('dart.vm.product')))
|
||||
'-Ddart.vm.product=false',
|
||||
'--enable-asserts',
|
||||
];
|
||||
case BuildMode.profile:
|
||||
@@ -241,7 +244,7 @@ class KernelCompiler {
|
||||
'-Ddart.developer.causal_async_stacks=${buildMode == BuildMode.debug}',
|
||||
for (final Object dartDefine in dartDefines)
|
||||
'-D$dartDefine',
|
||||
...buildModeOptions(buildMode),
|
||||
...buildModeOptions(buildMode, dartDefines),
|
||||
if (trackWidgetCreation) '--track-widget-creation',
|
||||
if (!linkPlatformKernelIn) '--no-link-platform',
|
||||
if (aot) ...<String>[
|
||||
@@ -672,7 +675,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
|
||||
'--packages',
|
||||
packagesPath,
|
||||
],
|
||||
...buildModeOptions(buildMode),
|
||||
...buildModeOptions(buildMode, dartDefines),
|
||||
if (trackWidgetCreation) '--track-widget-creation',
|
||||
if (fileSystemRoots != null)
|
||||
for (final String root in fileSystemRoots) ...<String>[
|
||||
|
||||
@@ -90,7 +90,7 @@ void main() {
|
||||
'--target=flutter',
|
||||
'--no-print-incremental-dependencies',
|
||||
'-Ddart.developer.causal_async_stacks=false',
|
||||
...buildModeOptions(BuildMode.profile),
|
||||
...buildModeOptions(BuildMode.profile, <String>[]),
|
||||
'--aot',
|
||||
'--tfa',
|
||||
'--packages',
|
||||
@@ -127,7 +127,7 @@ void main() {
|
||||
'--target=flutter',
|
||||
'--no-print-incremental-dependencies',
|
||||
'-Ddart.developer.causal_async_stacks=false',
|
||||
...buildModeOptions(BuildMode.profile),
|
||||
...buildModeOptions(BuildMode.profile, <String>[]),
|
||||
'--aot',
|
||||
'--tfa',
|
||||
'--packages',
|
||||
@@ -164,7 +164,7 @@ void main() {
|
||||
'--target=flutter',
|
||||
'--no-print-incremental-dependencies',
|
||||
'-Ddart.developer.causal_async_stacks=false',
|
||||
...buildModeOptions(BuildMode.profile),
|
||||
...buildModeOptions(BuildMode.profile, <String>[]),
|
||||
'--aot',
|
||||
'--tfa',
|
||||
'--packages',
|
||||
@@ -202,7 +202,7 @@ void main() {
|
||||
'--target=flutter',
|
||||
'--no-print-incremental-dependencies',
|
||||
'-Ddart.developer.causal_async_stacks=false',
|
||||
...buildModeOptions(BuildMode.profile),
|
||||
...buildModeOptions(BuildMode.profile, <String>[]),
|
||||
'--aot',
|
||||
'--tfa',
|
||||
'--packages',
|
||||
@@ -242,7 +242,7 @@ void main() {
|
||||
'--target=flutter',
|
||||
'--no-print-incremental-dependencies',
|
||||
'-Ddart.developer.causal_async_stacks=true',
|
||||
...buildModeOptions(BuildMode.debug),
|
||||
...buildModeOptions(BuildMode.debug, <String>[]),
|
||||
'--no-link-platform',
|
||||
'--packages',
|
||||
'/.dart_tool/package_config.json',
|
||||
@@ -280,7 +280,7 @@ void main() {
|
||||
'--target=flutter',
|
||||
'--no-print-incremental-dependencies',
|
||||
'-Ddart.developer.causal_async_stacks=true',
|
||||
...buildModeOptions(BuildMode.debug),
|
||||
...buildModeOptions(BuildMode.debug, <String>[]),
|
||||
'--packages',
|
||||
'/.dart_tool/package_config.json',
|
||||
'--output-dill',
|
||||
@@ -330,7 +330,7 @@ void main() {
|
||||
'--target=flutter',
|
||||
'--no-print-incremental-dependencies',
|
||||
'-Ddart.developer.causal_async_stacks=true',
|
||||
...buildModeOptions(BuildMode.debug),
|
||||
...buildModeOptions(BuildMode.debug, <String>[]),
|
||||
'--track-widget-creation',
|
||||
'--no-link-platform',
|
||||
'--packages',
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/compile.dart';
|
||||
|
||||
import '../src/common.dart';
|
||||
@@ -43,4 +44,11 @@ void main() {
|
||||
expect(toMultiRootPath(Uri.parse('org-dartlang-app:///a/b/c'), null, <String>[], false), 'org-dartlang-app:///a/b/c');
|
||||
expect(toMultiRootPath(Uri.parse('org-dartlang-app:///a/b/c'), 'scheme', <String>['/d/b'], false), 'org-dartlang-app:///a/b/c');
|
||||
});
|
||||
|
||||
testWithoutContext('buildModeOptions removes matching product define', () {
|
||||
expect(buildModeOptions(BuildMode.debug, <String>['dart.vm.product=true']), <String>[
|
||||
'-Ddart.vm.profile=false',
|
||||
'--enable-asserts',
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user