This reverts commit 7c3088cf22c8a863ca38e3890851fd8dc776768d.
This commit is contained in:
parent
7a859f7760
commit
f6bc147c91
@ -573,7 +573,9 @@ Future<void> _runExampleProjectBuildTests(Directory exampleDirectory, [File? mai
|
|||||||
// Only verify caching with flutter gallery.
|
// Only verify caching with flutter gallery.
|
||||||
final bool verifyCaching = exampleDirectory.path.contains('flutter_gallery');
|
final bool verifyCaching = exampleDirectory.path.contains('flutter_gallery');
|
||||||
final String examplePath = path.relative(exampleDirectory.path, from: Directory.current.path);
|
final String examplePath = path.relative(exampleDirectory.path, from: Directory.current.path);
|
||||||
|
final bool hasNullSafety = File(path.join(examplePath, 'null_safety')).existsSync();
|
||||||
final List<String> additionalArgs = <String>[
|
final List<String> additionalArgs = <String>[
|
||||||
|
if (hasNullSafety) '--no-sound-null-safety',
|
||||||
if (mainFile != null) path.relative(mainFile.path, from: exampleDirectory.absolute.path),
|
if (mainFile != null) path.relative(mainFile.path, from: exampleDirectory.absolute.path),
|
||||||
];
|
];
|
||||||
if (Directory(path.join(examplePath, 'android')).existsSync()) {
|
if (Directory(path.join(examplePath, 'android')).existsSync()) {
|
||||||
@ -769,6 +771,8 @@ Future<void> _runAddToAppLifeCycleTests() async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _runFrameworkTests() async {
|
Future<void> _runFrameworkTests() async {
|
||||||
|
final List<String> soundNullSafetyOptions = <String>['--null-assertions', '--sound-null-safety'];
|
||||||
|
final List<String> mixedModeNullSafetyOptions = <String>['--null-assertions', '--no-sound-null-safety'];
|
||||||
final List<String> trackWidgetCreationAlternatives = <String>['--track-widget-creation', '--no-track-widget-creation'];
|
final List<String> trackWidgetCreationAlternatives = <String>['--track-widget-creation', '--no-track-widget-creation'];
|
||||||
|
|
||||||
Future<void> runWidgets() async {
|
Future<void> runWidgets() async {
|
||||||
@ -776,7 +780,7 @@ Future<void> _runFrameworkTests() async {
|
|||||||
for (final String trackWidgetCreationOption in trackWidgetCreationAlternatives) {
|
for (final String trackWidgetCreationOption in trackWidgetCreationAlternatives) {
|
||||||
await _runFlutterTest(
|
await _runFlutterTest(
|
||||||
path.join(flutterRoot, 'packages', 'flutter'),
|
path.join(flutterRoot, 'packages', 'flutter'),
|
||||||
options: <String>[trackWidgetCreationOption],
|
options: <String>[trackWidgetCreationOption, ...soundNullSafetyOptions],
|
||||||
tests: <String>[ path.join('test', 'widgets') + path.separator ],
|
tests: <String>[ path.join('test', 'widgets') + path.separator ],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -791,13 +795,13 @@ Future<void> _runFrameworkTests() async {
|
|||||||
// Run release mode tests (see packages/flutter/test_release/README.md)
|
// Run release mode tests (see packages/flutter/test_release/README.md)
|
||||||
await _runFlutterTest(
|
await _runFlutterTest(
|
||||||
path.join(flutterRoot, 'packages', 'flutter'),
|
path.join(flutterRoot, 'packages', 'flutter'),
|
||||||
options: <String>['--dart-define=dart.vm.product=true'],
|
options: <String>['--dart-define=dart.vm.product=true', ...soundNullSafetyOptions],
|
||||||
tests: <String>['test_release${path.separator}'],
|
tests: <String>['test_release${path.separator}'],
|
||||||
);
|
);
|
||||||
// Run profile mode tests (see packages/flutter/test_profile/README.md)
|
// Run profile mode tests (see packages/flutter/test_profile/README.md)
|
||||||
await _runFlutterTest(
|
await _runFlutterTest(
|
||||||
path.join(flutterRoot, 'packages', 'flutter'),
|
path.join(flutterRoot, 'packages', 'flutter'),
|
||||||
options: <String>['--dart-define=dart.vm.product=false', '--dart-define=dart.vm.profile=true'],
|
options: <String>['--dart-define=dart.vm.product=false', '--dart-define=dart.vm.profile=true', ...soundNullSafetyOptions],
|
||||||
tests: <String>['test_profile${path.separator}'],
|
tests: <String>['test_profile${path.separator}'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -813,7 +817,7 @@ Future<void> _runFrameworkTests() async {
|
|||||||
for (final String trackWidgetCreationOption in trackWidgetCreationAlternatives) {
|
for (final String trackWidgetCreationOption in trackWidgetCreationAlternatives) {
|
||||||
await _runFlutterTest(
|
await _runFlutterTest(
|
||||||
path.join(flutterRoot, 'packages', 'flutter'),
|
path.join(flutterRoot, 'packages', 'flutter'),
|
||||||
options: <String>[trackWidgetCreationOption],
|
options: <String>[trackWidgetCreationOption, ...soundNullSafetyOptions],
|
||||||
tests: tests,
|
tests: tests,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -833,9 +837,9 @@ Future<void> _runFrameworkTests() async {
|
|||||||
workingDirectory: path.join(flutterRoot, 'examples', 'api'),
|
workingDirectory: path.join(flutterRoot, 'examples', 'api'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'examples', 'api'));
|
await _runFlutterTest(path.join(flutterRoot, 'examples', 'api'), options: soundNullSafetyOptions);
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'examples', 'hello_world'));
|
await _runFlutterTest(path.join(flutterRoot, 'examples', 'hello_world'), options: soundNullSafetyOptions);
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'examples', 'layers'));
|
await _runFlutterTest(path.join(flutterRoot, 'examples', 'layers'), options: soundNullSafetyOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> runTracingTests() async {
|
Future<void> runTracingTests() async {
|
||||||
@ -941,6 +945,7 @@ Future<void> _runFrameworkTests() async {
|
|||||||
|
|
||||||
Future<void> runPrivateTests() async {
|
Future<void> runPrivateTests() async {
|
||||||
final List<String> args = <String>[
|
final List<String> args = <String>[
|
||||||
|
'--sound-null-safety',
|
||||||
'run',
|
'run',
|
||||||
'bin/test_private.dart',
|
'bin/test_private.dart',
|
||||||
];
|
];
|
||||||
@ -984,17 +989,17 @@ Future<void> _runFrameworkTests() async {
|
|||||||
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'gen_defaults'));
|
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'gen_defaults'));
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'gen_keycodes'));
|
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'gen_keycodes'));
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'dev', 'benchmarks', 'test_apps', 'stocks'));
|
await _runFlutterTest(path.join(flutterRoot, 'dev', 'benchmarks', 'test_apps', 'stocks'));
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_driver'), tests: <String>[path.join('test', 'src', 'real_tests')]);
|
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_driver'), tests: <String>[path.join('test', 'src', 'real_tests')], options: soundNullSafetyOptions);
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'packages', 'integration_test'), options: <String>[
|
await _runFlutterTest(path.join(flutterRoot, 'packages', 'integration_test'), options: <String>[
|
||||||
'--enable-vmservice',
|
'--enable-vmservice',
|
||||||
// Web-specific tests depend on Chromium, so they run as part of the web_long_running_tests shard.
|
// Web-specific tests depend on Chromium, so they run as part of the web_long_running_tests shard.
|
||||||
'--exclude-tags=web',
|
'--exclude-tags=web',
|
||||||
]);
|
]);
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_goldens'));
|
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_goldens'), options: soundNullSafetyOptions);
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_localizations'));
|
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_localizations'), options: soundNullSafetyOptions);
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_test'));
|
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_test'), options: soundNullSafetyOptions);
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'packages', 'fuchsia_remote_debug_protocol'));
|
await _runFlutterTest(path.join(flutterRoot, 'packages', 'fuchsia_remote_debug_protocol'), options: soundNullSafetyOptions);
|
||||||
await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'non_nullable'));
|
await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'non_nullable'), options: mixedModeNullSafetyOptions);
|
||||||
const String httpClientWarning =
|
const String httpClientWarning =
|
||||||
'Warning: At least one test in this suite creates an HttpClient. When\n'
|
'Warning: At least one test in this suite creates an HttpClient. When\n'
|
||||||
'running a test suite that uses TestWidgetsFlutterBinding, all HTTP\n'
|
'running a test suite that uses TestWidgetsFlutterBinding, all HTTP\n'
|
||||||
@ -1224,7 +1229,7 @@ Future<void> _runWebLongRunningTests() async {
|
|||||||
() => _runWebDebugTest('lib/framework_stack_trace.dart'),
|
() => _runWebDebugTest('lib/framework_stack_trace.dart'),
|
||||||
() => _runWebDebugTest('lib/web_directory_loading.dart'),
|
() => _runWebDebugTest('lib/web_directory_loading.dart'),
|
||||||
() => _runWebDebugTest('test/test.dart'),
|
() => _runWebDebugTest('test/test.dart'),
|
||||||
() => _runWebDebugTest('lib/null_safe_main.dart'),
|
() => _runWebDebugTest('lib/null_safe_main.dart', enableNullSafety: true),
|
||||||
() => _runWebDebugTest('lib/web_define_loading.dart',
|
() => _runWebDebugTest('lib/web_define_loading.dart',
|
||||||
additionalArguments: <String>[
|
additionalArguments: <String>[
|
||||||
'--dart-define=test.valueA=Example,A',
|
'--dart-define=test.valueA=Example,A',
|
||||||
@ -1237,8 +1242,12 @@ Future<void> _runWebLongRunningTests() async {
|
|||||||
'--dart-define=test.valueB=Value',
|
'--dart-define=test.valueB=Value',
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
() => _runWebDebugTest('lib/sound_mode.dart'),
|
() => _runWebDebugTest('lib/sound_mode.dart', additionalArguments: <String>[
|
||||||
() => _runWebReleaseTest('lib/sound_mode.dart'),
|
'--sound-null-safety',
|
||||||
|
]),
|
||||||
|
() => _runWebReleaseTest('lib/sound_mode.dart', additionalArguments: <String>[
|
||||||
|
'--sound-null-safety',
|
||||||
|
]),
|
||||||
() => _runFlutterWebTest(
|
() => _runFlutterWebTest(
|
||||||
'html',
|
'html',
|
||||||
path.join(flutterRoot, 'packages', 'integration_test'),
|
path.join(flutterRoot, 'packages', 'integration_test'),
|
||||||
@ -1297,6 +1306,7 @@ Future<void> _runFlutterDriverWebTest({
|
|||||||
if (driver != null) '--driver=$driver',
|
if (driver != null) '--driver=$driver',
|
||||||
'--target=$target',
|
'--target=$target',
|
||||||
'--browser-name=chrome',
|
'--browser-name=chrome',
|
||||||
|
'--no-sound-null-safety',
|
||||||
'-d',
|
'-d',
|
||||||
'web-server',
|
'web-server',
|
||||||
'--$buildMode',
|
'--$buildMode',
|
||||||
@ -1338,6 +1348,7 @@ Future<void> _runWebTreeshakeTest() async {
|
|||||||
'build',
|
'build',
|
||||||
'web',
|
'web',
|
||||||
'--target=$target',
|
'--target=$target',
|
||||||
|
'--no-sound-null-safety',
|
||||||
'--profile',
|
'--profile',
|
||||||
],
|
],
|
||||||
workingDirectory: testAppDirectory,
|
workingDirectory: testAppDirectory,
|
||||||
@ -1563,6 +1574,7 @@ Future<void> _runGalleryE2eWebTest(String buildMode, { bool canvasKit = false })
|
|||||||
'--driver=test_driver/transitions_perf_e2e_test.dart',
|
'--driver=test_driver/transitions_perf_e2e_test.dart',
|
||||||
'--target=test_driver/transitions_perf_e2e.dart',
|
'--target=test_driver/transitions_perf_e2e.dart',
|
||||||
'--browser-name=chrome',
|
'--browser-name=chrome',
|
||||||
|
'--no-sound-null-safety',
|
||||||
'-d',
|
'-d',
|
||||||
'web-server',
|
'web-server',
|
||||||
'--$buildMode',
|
'--$buildMode',
|
||||||
@ -1669,6 +1681,7 @@ Future<void> _runWebReleaseTest(String target, {
|
|||||||
///
|
///
|
||||||
/// Instead, we use `flutter run --debug` and sniff out the standard output.
|
/// Instead, we use `flutter run --debug` and sniff out the standard output.
|
||||||
Future<void> _runWebDebugTest(String target, {
|
Future<void> _runWebDebugTest(String target, {
|
||||||
|
bool enableNullSafety = false,
|
||||||
List<String> additionalArguments = const<String>[],
|
List<String> additionalArguments = const<String>[],
|
||||||
}) async {
|
}) async {
|
||||||
final String testAppDirectory = path.join(flutterRoot, 'dev', 'integration_tests', 'web');
|
final String testAppDirectory = path.join(flutterRoot, 'dev', 'integration_tests', 'web');
|
||||||
@ -1682,6 +1695,11 @@ Future<void> _runWebDebugTest(String target, {
|
|||||||
<String>[
|
<String>[
|
||||||
'run',
|
'run',
|
||||||
'--debug',
|
'--debug',
|
||||||
|
if (enableNullSafety)
|
||||||
|
...<String>[
|
||||||
|
'--no-sound-null-safety',
|
||||||
|
'--null-assertions',
|
||||||
|
],
|
||||||
'-d',
|
'-d',
|
||||||
'chrome',
|
'chrome',
|
||||||
'--web-run-headless',
|
'--web-run-headless',
|
||||||
@ -1724,6 +1742,7 @@ Future<void> _runFlutterWebTest(String webRenderer, String workingDirectory, Lis
|
|||||||
'--platform=chrome',
|
'--platform=chrome',
|
||||||
'--web-renderer=$webRenderer',
|
'--web-renderer=$webRenderer',
|
||||||
'--dart-define=DART_HHH_BOT=$_runningInDartHHHBot',
|
'--dart-define=DART_HHH_BOT=$_runningInDartHHHBot',
|
||||||
|
'--sound-null-safety',
|
||||||
...flutterTestArgs,
|
...flutterTestArgs,
|
||||||
...tests,
|
...tests,
|
||||||
],
|
],
|
||||||
|
@ -80,7 +80,8 @@ Future<int> test5CallCompute(int value) {
|
|||||||
return compute(test5, value);
|
return compute(test5, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> expectFileSuccessfullyCompletes(String filename) async {
|
Future<void> expectFileSuccessfullyCompletes(String filename,
|
||||||
|
[bool unsound = false]) async {
|
||||||
// Run a Dart script that calls compute().
|
// Run a Dart script that calls compute().
|
||||||
// The Dart process will terminate only if the script exits cleanly with
|
// The Dart process will terminate only if the script exits cleanly with
|
||||||
// all isolate ports closed.
|
// all isolate ports closed.
|
||||||
@ -92,10 +93,12 @@ Future<void> expectFileSuccessfullyCompletes(String filename) async {
|
|||||||
final String packageRoot = fs.path.dirname(fs.path.fromUri(platform.script));
|
final String packageRoot = fs.path.dirname(fs.path.fromUri(platform.script));
|
||||||
final String scriptPath =
|
final String scriptPath =
|
||||||
fs.path.join(packageRoot, 'test', 'foundation', filename);
|
fs.path.join(packageRoot, 'test', 'foundation', filename);
|
||||||
|
final String nullSafetyArg =
|
||||||
|
unsound ? '--no-sound-null-safety' : '--sound-null-safety';
|
||||||
|
|
||||||
// Enable asserts to also catch potentially invalid assertions.
|
// Enable asserts to also catch potentially invalid assertions.
|
||||||
final ProcessResult result = await Process.run(
|
final ProcessResult result = await Process.run(
|
||||||
dartPath, <String>['run', '--enable-asserts', scriptPath]);
|
dartPath, <String>[nullSafetyArg, 'run', '--enable-asserts', scriptPath]);
|
||||||
expect(result.exitCode, 0);
|
expect(result.exitCode, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ class TestCase {
|
|||||||
for (final File test in tests) {
|
for (final File test in tests) {
|
||||||
final String testPath = path.join(path.dirname(test.path), 'lib', path.basenameWithoutExtension(test.path));
|
final String testPath = path.join(path.dirname(test.path), 'lib', path.basenameWithoutExtension(test.path));
|
||||||
final ProcessRunnerResult result = await runner.runProcess(
|
final ProcessRunnerResult result = await runner.runProcess(
|
||||||
<String>[flutter, 'test', testPath],
|
<String>[flutter, 'test', '--enable-experiment=non-nullable', '--no-sound-null-safety', '--null-assertions', testPath],
|
||||||
failOk: true,
|
failOk: true,
|
||||||
);
|
);
|
||||||
if (result.exitCode != 0) {
|
if (result.exitCode != 0) {
|
||||||
|
@ -171,6 +171,7 @@ List<FlutterCommand> generateCommands({
|
|||||||
osUtils: globals.os,
|
osUtils: globals.os,
|
||||||
verboseHelp: verboseHelp,
|
verboseHelp: verboseHelp,
|
||||||
androidSdk: globals.androidSdk,
|
androidSdk: globals.androidSdk,
|
||||||
|
logger: globals.logger,
|
||||||
),
|
),
|
||||||
ChannelCommand(verboseHelp: verboseHelp),
|
ChannelCommand(verboseHelp: verboseHelp),
|
||||||
CleanCommand(verbose: verbose),
|
CleanCommand(verbose: verbose),
|
||||||
|
@ -91,7 +91,12 @@ enum HostArtifact {
|
|||||||
webPlatformDart2JSSoundKernelDill,
|
webPlatformDart2JSSoundKernelDill,
|
||||||
|
|
||||||
/// The precompiled SDKs and sourcemaps for web debug builds.
|
/// The precompiled SDKs and sourcemaps for web debug builds.
|
||||||
|
webPrecompiledSdk,
|
||||||
|
webPrecompiledSdkSourcemaps,
|
||||||
|
webPrecompiledCanvaskitSdk,
|
||||||
|
webPrecompiledCanvaskitSdkSourcemaps,
|
||||||
|
webPrecompiledCanvaskitAndHtmlSdk,
|
||||||
|
webPrecompiledCanvaskitAndHtmlSdkSourcemaps,
|
||||||
webPrecompiledSoundSdk,
|
webPrecompiledSoundSdk,
|
||||||
webPrecompiledSoundSdkSourcemaps,
|
webPrecompiledSoundSdkSourcemaps,
|
||||||
webPrecompiledCanvaskitSoundSdk,
|
webPrecompiledCanvaskitSoundSdk,
|
||||||
@ -243,10 +248,16 @@ String _hostArtifactToFileName(HostArtifact artifact, Platform platform) {
|
|||||||
return 'dart2js_platform.dill';
|
return 'dart2js_platform.dill';
|
||||||
case HostArtifact.flutterWebLibrariesJson:
|
case HostArtifact.flutterWebLibrariesJson:
|
||||||
return 'libraries.json';
|
return 'libraries.json';
|
||||||
|
case HostArtifact.webPrecompiledSdk:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitSdk:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
|
||||||
case HostArtifact.webPrecompiledSoundSdk:
|
case HostArtifact.webPrecompiledSoundSdk:
|
||||||
case HostArtifact.webPrecompiledCanvaskitSoundSdk:
|
case HostArtifact.webPrecompiledCanvaskitSoundSdk:
|
||||||
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk:
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk:
|
||||||
return 'dart_sdk.js';
|
return 'dart_sdk.js';
|
||||||
|
case HostArtifact.webPrecompiledSdkSourcemaps:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
|
||||||
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
|
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
|
||||||
case HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps:
|
case HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps:
|
||||||
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps:
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps:
|
||||||
@ -396,6 +407,18 @@ class CachedArtifacts implements Artifacts {
|
|||||||
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
||||||
return _fileSystem.file(path);
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPrecompiledSdk:
|
||||||
|
case HostArtifact.webPrecompiledSdkSourcemaps:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitSdk:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
return _fileSystem.file(path);
|
||||||
case HostArtifact.webPrecompiledSoundSdk:
|
case HostArtifact.webPrecompiledSoundSdk:
|
||||||
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
|
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
|
||||||
@ -828,6 +851,18 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
||||||
return _fileSystem.file(path);
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPrecompiledSdk:
|
||||||
|
case HostArtifact.webPrecompiledSdkSourcemaps:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitSdk:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
return _fileSystem.file(path);
|
||||||
case HostArtifact.webPrecompiledSoundSdk:
|
case HostArtifact.webPrecompiledSoundSdk:
|
||||||
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
|
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
|
||||||
@ -1118,6 +1153,18 @@ class CachedLocalWebSdkArtifacts implements Artifacts {
|
|||||||
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
||||||
return _fileSystem.file(path);
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPrecompiledSdk:
|
||||||
|
case HostArtifact.webPrecompiledSdkSourcemaps:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitSdk:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
|
||||||
|
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
return _fileSystem.file(path);
|
||||||
case HostArtifact.webPrecompiledSoundSdk:
|
case HostArtifact.webPrecompiledSoundSdk:
|
||||||
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
|
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
|
||||||
|
@ -40,6 +40,7 @@ class BuildInfo {
|
|||||||
this.performanceMeasurementFile,
|
this.performanceMeasurementFile,
|
||||||
this.dartDefineConfigJsonMap,
|
this.dartDefineConfigJsonMap,
|
||||||
this.packagesPath = '.dart_tool/package_config.json', // TODO(zanderso): make this required and remove the default.
|
this.packagesPath = '.dart_tool/package_config.json', // TODO(zanderso): make this required and remove the default.
|
||||||
|
this.nullSafetyMode = NullSafetyMode.sound,
|
||||||
this.codeSizeDirectory,
|
this.codeSizeDirectory,
|
||||||
this.androidGradleDaemon = true,
|
this.androidGradleDaemon = true,
|
||||||
this.packageConfig = PackageConfig.empty,
|
this.packageConfig = PackageConfig.empty,
|
||||||
@ -53,6 +54,11 @@ class BuildInfo {
|
|||||||
|
|
||||||
final BuildMode mode;
|
final BuildMode mode;
|
||||||
|
|
||||||
|
/// The null safety mode the application should be run in.
|
||||||
|
///
|
||||||
|
/// If not provided, defaults to [NullSafetyMode.autodetect].
|
||||||
|
final NullSafetyMode nullSafetyMode;
|
||||||
|
|
||||||
/// Whether the build should subset icon fonts.
|
/// Whether the build should subset icon fonts.
|
||||||
final bool treeShakeIcons;
|
final bool treeShakeIcons;
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ class AttachCommand extends FlutterCommand {
|
|||||||
usesDartDefineOption();
|
usesDartDefineOption();
|
||||||
usesDeviceUserOption();
|
usesDeviceUserOption();
|
||||||
addEnableExperimentation(hide: !verboseHelp);
|
addEnableExperimentation(hide: !verboseHelp);
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
usesInitializeFromDillOption(hide: !verboseHelp);
|
usesInitializeFromDillOption(hide: !verboseHelp);
|
||||||
argParser
|
argParser
|
||||||
..addOption(
|
..addOption(
|
||||||
|
@ -2,9 +2,13 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
import '../android/android_sdk.dart';
|
import '../android/android_sdk.dart';
|
||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
|
import '../base/logger.dart';
|
||||||
import '../base/os.dart';
|
import '../base/os.dart';
|
||||||
|
import '../build_info.dart';
|
||||||
import '../build_system/build_system.dart';
|
import '../build_system/build_system.dart';
|
||||||
import '../commands/build_linux.dart';
|
import '../commands/build_linux.dart';
|
||||||
import '../commands/build_macos.dart';
|
import '../commands/build_macos.dart';
|
||||||
@ -24,6 +28,7 @@ class BuildCommand extends FlutterCommand {
|
|||||||
required FileSystem fileSystem,
|
required FileSystem fileSystem,
|
||||||
required BuildSystem buildSystem,
|
required BuildSystem buildSystem,
|
||||||
required OperatingSystemUtils osUtils,
|
required OperatingSystemUtils osUtils,
|
||||||
|
required Logger logger,
|
||||||
required AndroidSdk? androidSdk,
|
required AndroidSdk? androidSdk,
|
||||||
bool verboseHelp = false,
|
bool verboseHelp = false,
|
||||||
}){
|
}){
|
||||||
@ -31,32 +36,37 @@ class BuildCommand extends FlutterCommand {
|
|||||||
BuildAarCommand(
|
BuildAarCommand(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
androidSdk: androidSdk,
|
androidSdk: androidSdk,
|
||||||
|
logger: logger,
|
||||||
verboseHelp: verboseHelp,
|
verboseHelp: verboseHelp,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
_addSubcommand(BuildApkCommand(verboseHelp: verboseHelp));
|
_addSubcommand(BuildApkCommand(logger: logger, verboseHelp: verboseHelp));
|
||||||
_addSubcommand(BuildAppBundleCommand(verboseHelp: verboseHelp));
|
_addSubcommand(BuildAppBundleCommand(logger: logger, verboseHelp: verboseHelp));
|
||||||
_addSubcommand(BuildIOSCommand(verboseHelp: verboseHelp));
|
_addSubcommand(BuildIOSCommand(logger: logger, verboseHelp: verboseHelp));
|
||||||
_addSubcommand(BuildIOSFrameworkCommand(
|
_addSubcommand(BuildIOSFrameworkCommand(
|
||||||
|
logger: logger,
|
||||||
buildSystem: buildSystem,
|
buildSystem: buildSystem,
|
||||||
verboseHelp: verboseHelp,
|
verboseHelp: verboseHelp,
|
||||||
));
|
));
|
||||||
_addSubcommand(BuildMacOSFrameworkCommand(
|
_addSubcommand(BuildMacOSFrameworkCommand(
|
||||||
|
logger: logger,
|
||||||
buildSystem: buildSystem,
|
buildSystem: buildSystem,
|
||||||
verboseHelp: verboseHelp,
|
verboseHelp: verboseHelp,
|
||||||
));
|
));
|
||||||
_addSubcommand(BuildIOSArchiveCommand(verboseHelp: verboseHelp));
|
_addSubcommand(BuildIOSArchiveCommand(logger: logger, verboseHelp: verboseHelp));
|
||||||
_addSubcommand(BuildBundleCommand(verboseHelp: verboseHelp));
|
_addSubcommand(BuildBundleCommand(logger: logger, verboseHelp: verboseHelp));
|
||||||
_addSubcommand(BuildWebCommand(
|
_addSubcommand(BuildWebCommand(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: logger,
|
||||||
verboseHelp: verboseHelp,
|
verboseHelp: verboseHelp,
|
||||||
));
|
));
|
||||||
_addSubcommand(BuildMacosCommand(verboseHelp: verboseHelp));
|
_addSubcommand(BuildMacosCommand(logger: logger, verboseHelp: verboseHelp));
|
||||||
_addSubcommand(BuildLinuxCommand(
|
_addSubcommand(BuildLinuxCommand(
|
||||||
|
logger: logger,
|
||||||
operatingSystemUtils: osUtils,
|
operatingSystemUtils: osUtils,
|
||||||
verboseHelp: verboseHelp
|
verboseHelp: verboseHelp
|
||||||
));
|
));
|
||||||
_addSubcommand(BuildWindowsCommand(verboseHelp: verboseHelp));
|
_addSubcommand(BuildWindowsCommand(logger: logger, verboseHelp: verboseHelp));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _addSubcommand(BuildSubCommand command) {
|
void _addSubcommand(BuildSubCommand command) {
|
||||||
@ -80,11 +90,36 @@ class BuildCommand extends FlutterCommand {
|
|||||||
|
|
||||||
abstract class BuildSubCommand extends FlutterCommand {
|
abstract class BuildSubCommand extends FlutterCommand {
|
||||||
BuildSubCommand({
|
BuildSubCommand({
|
||||||
|
required Logger logger,
|
||||||
required bool verboseHelp
|
required bool verboseHelp
|
||||||
}) {
|
}): _logger = logger {
|
||||||
requiresPubspecYaml();
|
requiresPubspecYaml();
|
||||||
usesFatalWarningsOption(verboseHelp: verboseHelp);
|
usesFatalWarningsOption(verboseHelp: verboseHelp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Logger _logger;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get reportNullSafety => true;
|
||||||
|
|
||||||
bool get supported => true;
|
bool get supported => true;
|
||||||
|
|
||||||
|
/// Display a message describing the current null safety runtime mode
|
||||||
|
/// that was selected.
|
||||||
|
///
|
||||||
|
/// This is similar to the run message in run_hot.dart
|
||||||
|
@protected
|
||||||
|
void displayNullSafetyMode(BuildInfo buildInfo) {
|
||||||
|
if (buildInfo.nullSafetyMode != NullSafetyMode.sound) {
|
||||||
|
_logger.printStatus('');
|
||||||
|
_logger.printStatus(
|
||||||
|
'Building without sound null safety ⚠️',
|
||||||
|
emphasis: true,
|
||||||
|
);
|
||||||
|
_logger.printStatus(
|
||||||
|
'Dart 3 will only support sound null safety, see https://dart.dev/null-safety',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
_logger.printStatus('');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import 'build.dart';
|
|||||||
|
|
||||||
class BuildAarCommand extends BuildSubCommand {
|
class BuildAarCommand extends BuildSubCommand {
|
||||||
BuildAarCommand({
|
BuildAarCommand({
|
||||||
|
required super.logger,
|
||||||
required AndroidSdk? androidSdk,
|
required AndroidSdk? androidSdk,
|
||||||
required FileSystem fileSystem,
|
required FileSystem fileSystem,
|
||||||
required bool verboseHelp,
|
required bool verboseHelp,
|
||||||
@ -49,6 +50,7 @@ class BuildAarCommand extends BuildSubCommand {
|
|||||||
usesDartDefineOption();
|
usesDartDefineOption();
|
||||||
usesExtraDartFlagOptions(verboseHelp: verboseHelp);
|
usesExtraDartFlagOptions(verboseHelp: verboseHelp);
|
||||||
usesTrackWidgetCreation(verboseHelp: false);
|
usesTrackWidgetCreation(verboseHelp: false);
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
addEnableExperimentation(hide: !verboseHelp);
|
addEnableExperimentation(hide: !verboseHelp);
|
||||||
addAndroidSpecificBuildOptions(hide: !verboseHelp);
|
addAndroidSpecificBuildOptions(hide: !verboseHelp);
|
||||||
argParser
|
argParser
|
||||||
@ -65,6 +67,9 @@ class BuildAarCommand extends BuildSubCommand {
|
|||||||
@override
|
@override
|
||||||
final String name = 'aar';
|
final String name = 'aar';
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get reportNullSafety => false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
|
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
|
||||||
DevelopmentArtifact.androidGenSnapshot,
|
DevelopmentArtifact.androidGenSnapshot,
|
||||||
@ -132,6 +137,7 @@ class BuildAarCommand extends BuildSubCommand {
|
|||||||
throwToolExit('Please specify a build mode and try again.');
|
throwToolExit('Please specify a build mode and try again.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayNullSafetyMode(androidBuildInfo.first.buildInfo);
|
||||||
await androidBuilder?.buildAar(
|
await androidBuilder?.buildAar(
|
||||||
project: _getProject(),
|
project: _getProject(),
|
||||||
target: targetFile.path,
|
target: targetFile.path,
|
||||||
|
@ -15,7 +15,7 @@ import 'build.dart';
|
|||||||
|
|
||||||
class BuildApkCommand extends BuildSubCommand {
|
class BuildApkCommand extends BuildSubCommand {
|
||||||
BuildApkCommand({
|
BuildApkCommand({
|
||||||
bool verboseHelp = false
|
required super.logger, bool verboseHelp = false
|
||||||
}) : super(verboseHelp: verboseHelp) {
|
}) : super(verboseHelp: verboseHelp) {
|
||||||
addTreeShakeIconsFlag();
|
addTreeShakeIconsFlag();
|
||||||
usesTargetOption();
|
usesTargetOption();
|
||||||
@ -32,6 +32,7 @@ class BuildApkCommand extends BuildSubCommand {
|
|||||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||||
addEnableExperimentation(hide: !verboseHelp);
|
addEnableExperimentation(hide: !verboseHelp);
|
||||||
addBuildPerformanceFile(hide: !verboseHelp);
|
addBuildPerformanceFile(hide: !verboseHelp);
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
usesAnalyzeSizeFlag();
|
usesAnalyzeSizeFlag();
|
||||||
addAndroidSpecificBuildOptions(hide: !verboseHelp);
|
addAndroidSpecificBuildOptions(hide: !verboseHelp);
|
||||||
addMultidexOption();
|
addMultidexOption();
|
||||||
@ -110,6 +111,7 @@ class BuildApkCommand extends BuildSubCommand {
|
|||||||
multidexEnabled: boolArg('multidex'),
|
multidexEnabled: boolArg('multidex'),
|
||||||
);
|
);
|
||||||
validateBuild(androidBuildInfo);
|
validateBuild(androidBuildInfo);
|
||||||
|
displayNullSafetyMode(androidBuildInfo.buildInfo);
|
||||||
globals.terminal.usesTerminalUi = true;
|
globals.terminal.usesTerminalUi = true;
|
||||||
await androidBuilder?.buildApk(
|
await androidBuilder?.buildApk(
|
||||||
project: FlutterProject.current(),
|
project: FlutterProject.current(),
|
||||||
|
@ -18,6 +18,7 @@ import 'build.dart';
|
|||||||
|
|
||||||
class BuildAppBundleCommand extends BuildSubCommand {
|
class BuildAppBundleCommand extends BuildSubCommand {
|
||||||
BuildAppBundleCommand({
|
BuildAppBundleCommand({
|
||||||
|
required super.logger,
|
||||||
bool verboseHelp = false,
|
bool verboseHelp = false,
|
||||||
}) : super(verboseHelp: verboseHelp) {
|
}) : super(verboseHelp: verboseHelp) {
|
||||||
addTreeShakeIconsFlag();
|
addTreeShakeIconsFlag();
|
||||||
@ -35,6 +36,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
|
|||||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||||
addBuildPerformanceFile(hide: !verboseHelp);
|
addBuildPerformanceFile(hide: !verboseHelp);
|
||||||
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
addEnableExperimentation(hide: !verboseHelp);
|
addEnableExperimentation(hide: !verboseHelp);
|
||||||
usesAnalyzeSizeFlag();
|
usesAnalyzeSizeFlag();
|
||||||
addAndroidSpecificBuildOptions(hide: !verboseHelp);
|
addAndroidSpecificBuildOptions(hide: !verboseHelp);
|
||||||
@ -146,6 +148,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validateBuild(androidBuildInfo);
|
validateBuild(androidBuildInfo);
|
||||||
|
displayNullSafetyMode(androidBuildInfo.buildInfo);
|
||||||
globals.terminal.usesTerminalUi = true;
|
globals.terminal.usesTerminalUi = true;
|
||||||
await androidBuilder?.buildAab(
|
await androidBuilder?.buildAab(
|
||||||
project: FlutterProject.current(),
|
project: FlutterProject.current(),
|
||||||
|
@ -15,6 +15,7 @@ import 'build.dart';
|
|||||||
|
|
||||||
class BuildBundleCommand extends BuildSubCommand {
|
class BuildBundleCommand extends BuildSubCommand {
|
||||||
BuildBundleCommand({
|
BuildBundleCommand({
|
||||||
|
required super.logger,
|
||||||
bool verboseHelp = false,
|
bool verboseHelp = false,
|
||||||
BundleBuilder? bundleBuilder,
|
BundleBuilder? bundleBuilder,
|
||||||
}) : _bundleBuilder = bundleBuilder ?? BundleBuilder(), super(verboseHelp: verboseHelp) {
|
}) : _bundleBuilder = bundleBuilder ?? BundleBuilder(), super(verboseHelp: verboseHelp) {
|
||||||
@ -125,9 +126,12 @@ class BuildBundleCommand extends BuildSubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final BuildInfo buildInfo = await getBuildInfo();
|
||||||
|
displayNullSafetyMode(buildInfo);
|
||||||
|
|
||||||
await _bundleBuilder.build(
|
await _bundleBuilder.build(
|
||||||
platform: platform,
|
platform: platform,
|
||||||
buildInfo: await getBuildInfo(),
|
buildInfo: buildInfo,
|
||||||
mainPath: targetFile,
|
mainPath: targetFile,
|
||||||
depfilePath: stringArg('depfile'),
|
depfilePath: stringArg('depfile'),
|
||||||
assetDirPath: stringArg('asset-dir'),
|
assetDirPath: stringArg('asset-dir'),
|
||||||
|
@ -26,7 +26,7 @@ import 'build.dart';
|
|||||||
/// Builds an .app for an iOS app to be used for local testing on an iOS device
|
/// Builds an .app for an iOS app to be used for local testing on an iOS device
|
||||||
/// or simulator. Can only be run on a macOS host.
|
/// or simulator. Can only be run on a macOS host.
|
||||||
class BuildIOSCommand extends _BuildIOSSubCommand {
|
class BuildIOSCommand extends _BuildIOSSubCommand {
|
||||||
BuildIOSCommand({ required super.verboseHelp }) {
|
BuildIOSCommand({ required super.logger, required super.verboseHelp }) {
|
||||||
argParser
|
argParser
|
||||||
..addFlag('config-only',
|
..addFlag('config-only',
|
||||||
help: 'Update the project configuration without performing a build. '
|
help: 'Update the project configuration without performing a build. '
|
||||||
@ -91,7 +91,7 @@ class _ImageAssetFileKey {
|
|||||||
///
|
///
|
||||||
/// Can only be run on a macOS host.
|
/// Can only be run on a macOS host.
|
||||||
class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
|
class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
|
||||||
BuildIOSArchiveCommand({ required super.verboseHelp }) {
|
BuildIOSArchiveCommand({required super.logger, required super.verboseHelp}) {
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
'export-method',
|
'export-method',
|
||||||
defaultsTo: 'app-store',
|
defaultsTo: 'app-store',
|
||||||
@ -412,6 +412,8 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
|
final BuildInfo buildInfo = await cachedBuildInfo;
|
||||||
|
displayNullSafetyMode(buildInfo);
|
||||||
final FlutterCommandResult xcarchiveResult = await super.runCommand();
|
final FlutterCommandResult xcarchiveResult = await super.runCommand();
|
||||||
|
|
||||||
final List<ValidationResult?> validationResults = <ValidationResult?>[];
|
final List<ValidationResult?> validationResults = <ValidationResult?>[];
|
||||||
@ -555,6 +557,7 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
|
|||||||
|
|
||||||
abstract class _BuildIOSSubCommand extends BuildSubCommand {
|
abstract class _BuildIOSSubCommand extends BuildSubCommand {
|
||||||
_BuildIOSSubCommand({
|
_BuildIOSSubCommand({
|
||||||
|
required super.logger,
|
||||||
required bool verboseHelp
|
required bool verboseHelp
|
||||||
}) : super(verboseHelp: verboseHelp) {
|
}) : super(verboseHelp: verboseHelp) {
|
||||||
addTreeShakeIconsFlag();
|
addTreeShakeIconsFlag();
|
||||||
@ -571,6 +574,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
|
|||||||
addEnableExperimentation(hide: !verboseHelp);
|
addEnableExperimentation(hide: !verboseHelp);
|
||||||
addBuildPerformanceFile(hide: !verboseHelp);
|
addBuildPerformanceFile(hide: !verboseHelp);
|
||||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
usesAnalyzeSizeFlag();
|
usesAnalyzeSizeFlag();
|
||||||
argParser.addFlag('codesign',
|
argParser.addFlag('codesign',
|
||||||
defaultsTo: true,
|
defaultsTo: true,
|
||||||
|
@ -33,6 +33,7 @@ abstract class BuildFrameworkCommand extends BuildSubCommand {
|
|||||||
required bool verboseHelp,
|
required bool verboseHelp,
|
||||||
Cache? cache,
|
Cache? cache,
|
||||||
Platform? platform,
|
Platform? platform,
|
||||||
|
required super.logger,
|
||||||
}) : _injectedFlutterVersion = flutterVersion,
|
}) : _injectedFlutterVersion = flutterVersion,
|
||||||
_buildSystem = buildSystem,
|
_buildSystem = buildSystem,
|
||||||
_injectedCache = cache,
|
_injectedCache = cache,
|
||||||
@ -45,6 +46,7 @@ abstract class BuildFrameworkCommand extends BuildSubCommand {
|
|||||||
addSplitDebugInfoOption();
|
addSplitDebugInfoOption();
|
||||||
addDartObfuscationOption();
|
addDartObfuscationOption();
|
||||||
usesExtraDartFlagOptions(verboseHelp: verboseHelp);
|
usesExtraDartFlagOptions(verboseHelp: verboseHelp);
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
addEnableExperimentation(hide: !verboseHelp);
|
addEnableExperimentation(hide: !verboseHelp);
|
||||||
|
|
||||||
argParser
|
argParser
|
||||||
@ -98,6 +100,9 @@ abstract class BuildFrameworkCommand extends BuildSubCommand {
|
|||||||
FlutterVersion get flutterVersion => _injectedFlutterVersion ?? globals.flutterVersion;
|
FlutterVersion get flutterVersion => _injectedFlutterVersion ?? globals.flutterVersion;
|
||||||
final FlutterVersion? _injectedFlutterVersion;
|
final FlutterVersion? _injectedFlutterVersion;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get reportNullSafety => false;
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
late final FlutterProject project = FlutterProject.current();
|
late final FlutterProject project = FlutterProject.current();
|
||||||
|
|
||||||
@ -172,6 +177,7 @@ abstract class BuildFrameworkCommand extends BuildSubCommand {
|
|||||||
/// managers.
|
/// managers.
|
||||||
class BuildIOSFrameworkCommand extends BuildFrameworkCommand {
|
class BuildIOSFrameworkCommand extends BuildFrameworkCommand {
|
||||||
BuildIOSFrameworkCommand({
|
BuildIOSFrameworkCommand({
|
||||||
|
required super.logger,
|
||||||
super.flutterVersion,
|
super.flutterVersion,
|
||||||
required super.buildSystem,
|
required super.buildSystem,
|
||||||
required bool verboseHelp,
|
required bool verboseHelp,
|
||||||
@ -230,6 +236,7 @@ class BuildIOSFrameworkCommand extends BuildFrameworkCommand {
|
|||||||
|
|
||||||
final Directory outputDirectory = globals.fs.directory(globals.fs.path.absolute(globals.fs.path.normalize(outputArgument)));
|
final Directory outputDirectory = globals.fs.directory(globals.fs.path.absolute(globals.fs.path.normalize(outputArgument)));
|
||||||
final List<BuildInfo> buildInfos = await getBuildInfos();
|
final List<BuildInfo> buildInfos = await getBuildInfos();
|
||||||
|
displayNullSafetyMode(buildInfos.first);
|
||||||
for (final BuildInfo buildInfo in buildInfos) {
|
for (final BuildInfo buildInfo in buildInfos) {
|
||||||
final String? productBundleIdentifier = await project.ios.productBundleIdentifier(buildInfo);
|
final String? productBundleIdentifier = await project.ios.productBundleIdentifier(buildInfo);
|
||||||
globals.printStatus('Building frameworks for $productBundleIdentifier in ${getNameForBuildMode(buildInfo.mode)} mode...');
|
globals.printStatus('Building frameworks for $productBundleIdentifier in ${getNameForBuildMode(buildInfo.mode)} mode...');
|
||||||
|
@ -17,6 +17,7 @@ import 'build.dart';
|
|||||||
/// A command to build a linux desktop target through a build shell script.
|
/// A command to build a linux desktop target through a build shell script.
|
||||||
class BuildLinuxCommand extends BuildSubCommand {
|
class BuildLinuxCommand extends BuildSubCommand {
|
||||||
BuildLinuxCommand({
|
BuildLinuxCommand({
|
||||||
|
required super.logger,
|
||||||
required OperatingSystemUtils operatingSystemUtils,
|
required OperatingSystemUtils operatingSystemUtils,
|
||||||
bool verboseHelp = false,
|
bool verboseHelp = false,
|
||||||
}) : _operatingSystemUtils = operatingSystemUtils,
|
}) : _operatingSystemUtils = operatingSystemUtils,
|
||||||
@ -81,6 +82,7 @@ class BuildLinuxCommand extends BuildSubCommand {
|
|||||||
throwToolExit(
|
throwToolExit(
|
||||||
'Cross-build from Linux x64 host to Linux arm64 target is not currently supported.');
|
'Cross-build from Linux x64 host to Linux arm64 target is not currently supported.');
|
||||||
}
|
}
|
||||||
|
displayNullSafetyMode(buildInfo);
|
||||||
await buildLinux(
|
await buildLinux(
|
||||||
flutterProject.linux,
|
flutterProject.linux,
|
||||||
buildInfo,
|
buildInfo,
|
||||||
|
@ -16,6 +16,7 @@ import 'build.dart';
|
|||||||
/// A command to build a macOS desktop target through a build shell script.
|
/// A command to build a macOS desktop target through a build shell script.
|
||||||
class BuildMacosCommand extends BuildSubCommand {
|
class BuildMacosCommand extends BuildSubCommand {
|
||||||
BuildMacosCommand({
|
BuildMacosCommand({
|
||||||
|
required super.logger,
|
||||||
required bool verboseHelp,
|
required bool verboseHelp,
|
||||||
}) : super(verboseHelp: verboseHelp) {
|
}) : super(verboseHelp: verboseHelp) {
|
||||||
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
|
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
|
||||||
@ -57,6 +58,7 @@ class BuildMacosCommand extends BuildSubCommand {
|
|||||||
if (!supported) {
|
if (!supported) {
|
||||||
throwToolExit('"build macos" only supported on macOS hosts.');
|
throwToolExit('"build macos" only supported on macOS hosts.');
|
||||||
}
|
}
|
||||||
|
displayNullSafetyMode(buildInfo);
|
||||||
await buildMacOS(
|
await buildMacOS(
|
||||||
flutterProject: flutterProject,
|
flutterProject: flutterProject,
|
||||||
buildInfo: buildInfo,
|
buildInfo: buildInfo,
|
||||||
|
@ -29,6 +29,7 @@ class BuildMacOSFrameworkCommand extends BuildFrameworkCommand {
|
|||||||
super.flutterVersion,
|
super.flutterVersion,
|
||||||
required super.buildSystem,
|
required super.buildSystem,
|
||||||
required super.verboseHelp,
|
required super.verboseHelp,
|
||||||
|
required super.logger,
|
||||||
super.cache,
|
super.cache,
|
||||||
super.platform,
|
super.platform,
|
||||||
});
|
});
|
||||||
@ -68,6 +69,7 @@ class BuildMacOSFrameworkCommand extends BuildFrameworkCommand {
|
|||||||
globals.fs.directory(globals.fs.path.absolute(globals.fs.path.normalize(outputArgument)));
|
globals.fs.directory(globals.fs.path.absolute(globals.fs.path.normalize(outputArgument)));
|
||||||
|
|
||||||
final List<BuildInfo> buildInfos = await getBuildInfos();
|
final List<BuildInfo> buildInfos = await getBuildInfos();
|
||||||
|
displayNullSafetyMode(buildInfos.first);
|
||||||
|
|
||||||
for (final BuildInfo buildInfo in buildInfos) {
|
for (final BuildInfo buildInfo in buildInfos) {
|
||||||
globals.printStatus('Building macOS frameworks in ${getNameForBuildMode(buildInfo.mode)} mode...');
|
globals.printStatus('Building macOS frameworks in ${getNameForBuildMode(buildInfo.mode)} mode...');
|
||||||
|
@ -16,6 +16,7 @@ import 'build.dart';
|
|||||||
|
|
||||||
class BuildWebCommand extends BuildSubCommand {
|
class BuildWebCommand extends BuildSubCommand {
|
||||||
BuildWebCommand({
|
BuildWebCommand({
|
||||||
|
required super.logger,
|
||||||
required FileSystem fileSystem,
|
required FileSystem fileSystem,
|
||||||
required bool verboseHelp,
|
required bool verboseHelp,
|
||||||
}) : _fileSystem = fileSystem, super(verboseHelp: verboseHelp) {
|
}) : _fileSystem = fileSystem, super(verboseHelp: verboseHelp) {
|
||||||
@ -28,6 +29,7 @@ class BuildWebCommand extends BuildSubCommand {
|
|||||||
addBuildModeFlags(verboseHelp: verboseHelp, excludeDebug: true);
|
addBuildModeFlags(verboseHelp: verboseHelp, excludeDebug: true);
|
||||||
usesDartDefineOption();
|
usesDartDefineOption();
|
||||||
addEnableExperimentation(hide: !verboseHelp);
|
addEnableExperimentation(hide: !verboseHelp);
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
addNativeNullAssertions();
|
addNativeNullAssertions();
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -164,6 +166,7 @@ class BuildWebCommand extends BuildSubCommand {
|
|||||||
// valid approaches for setting output directory of build artifacts
|
// valid approaches for setting output directory of build artifacts
|
||||||
final String? outputDirectoryPath = stringArg('output');
|
final String? outputDirectoryPath = stringArg('output');
|
||||||
|
|
||||||
|
displayNullSafetyMode(buildInfo);
|
||||||
await buildWeb(
|
await buildWeb(
|
||||||
flutterProject,
|
flutterProject,
|
||||||
target,
|
target,
|
||||||
|
@ -19,6 +19,7 @@ import 'build.dart';
|
|||||||
/// A command to build a windows desktop target through a build shell script.
|
/// A command to build a windows desktop target through a build shell script.
|
||||||
class BuildWindowsCommand extends BuildSubCommand {
|
class BuildWindowsCommand extends BuildSubCommand {
|
||||||
BuildWindowsCommand({
|
BuildWindowsCommand({
|
||||||
|
required super.logger,
|
||||||
bool verboseHelp = false,
|
bool verboseHelp = false,
|
||||||
}) : super(verboseHelp: verboseHelp) {
|
}) : super(verboseHelp: verboseHelp) {
|
||||||
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
|
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
|
||||||
@ -51,6 +52,7 @@ class BuildWindowsCommand extends BuildSubCommand {
|
|||||||
if (!globals.platform.isWindows) {
|
if (!globals.platform.isWindows) {
|
||||||
throwToolExit('"build windows" only supported on Windows hosts.');
|
throwToolExit('"build windows" only supported on Windows hosts.');
|
||||||
}
|
}
|
||||||
|
displayNullSafetyMode(buildInfo);
|
||||||
await buildWindows(
|
await buildWindows(
|
||||||
flutterProject.windows,
|
flutterProject.windows,
|
||||||
buildInfo,
|
buildInfo,
|
||||||
|
@ -173,6 +173,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
usesIpv6Flag(verboseHelp: verboseHelp);
|
usesIpv6Flag(verboseHelp: verboseHelp);
|
||||||
usesPubOption();
|
usesPubOption();
|
||||||
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
usesDeviceUserOption();
|
usesDeviceUserOption();
|
||||||
usesDeviceTimeoutOption();
|
usesDeviceTimeoutOption();
|
||||||
addDdsOptions(verboseHelp: verboseHelp);
|
addDdsOptions(verboseHelp: verboseHelp);
|
||||||
@ -197,6 +198,9 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
bool get uninstallFirst => boolArg('uninstall-first');
|
bool get uninstallFirst => boolArg('uninstall-first');
|
||||||
bool get enableEmbedderApi => boolArg('enable-embedder-api');
|
bool get enableEmbedderApi => boolArg('enable-embedder-api');
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get reportNullSafety => true;
|
||||||
|
|
||||||
/// Whether to start the application paused by default.
|
/// Whether to start the application paused by default.
|
||||||
bool get startPausedDefault;
|
bool get startPausedDefault;
|
||||||
|
|
||||||
@ -274,6 +278,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
fastStart: argParser.options.containsKey('fast-start')
|
fastStart: argParser.options.containsKey('fast-start')
|
||||||
&& boolArg('fast-start')
|
&& boolArg('fast-start')
|
||||||
&& !runningWithPrebuiltApplication,
|
&& !runningWithPrebuiltApplication,
|
||||||
|
nullAssertions: boolArg('null-assertions'),
|
||||||
nativeNullAssertions: boolArg('native-null-assertions'),
|
nativeNullAssertions: boolArg('native-null-assertions'),
|
||||||
enableImpeller: enableImpeller,
|
enableImpeller: enableImpeller,
|
||||||
uninstallFirst: uninstallFirst,
|
uninstallFirst: uninstallFirst,
|
||||||
|
@ -67,6 +67,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||||||
}) {
|
}) {
|
||||||
requiresPubspecYaml();
|
requiresPubspecYaml();
|
||||||
usesPubOption();
|
usesPubOption();
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
||||||
addEnableExperimentation(hide: !verboseHelp);
|
addEnableExperimentation(hide: !verboseHelp);
|
||||||
usesDartDefineOption();
|
usesDartDefineOption();
|
||||||
@ -419,6 +420,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||||||
// On iOS >=14, keeping this enabled will leave a prompt on the screen.
|
// On iOS >=14, keeping this enabled will leave a prompt on the screen.
|
||||||
disablePortPublication: true,
|
disablePortPublication: true,
|
||||||
enableDds: enableDds,
|
enableDds: enableDds,
|
||||||
|
nullAssertions: boolArg(FlutterOptions.kNullAssertions),
|
||||||
);
|
);
|
||||||
|
|
||||||
Device? integrationTestDevice;
|
Device? integrationTestDevice;
|
||||||
|
@ -916,6 +916,7 @@ class DebuggingOptions {
|
|||||||
this.webLaunchUrl,
|
this.webLaunchUrl,
|
||||||
this.vmserviceOutFile,
|
this.vmserviceOutFile,
|
||||||
this.fastStart = false,
|
this.fastStart = false,
|
||||||
|
this.nullAssertions = false,
|
||||||
this.nativeNullAssertions = false,
|
this.nativeNullAssertions = false,
|
||||||
this.enableImpeller = false,
|
this.enableImpeller = false,
|
||||||
this.uninstallFirst = false,
|
this.uninstallFirst = false,
|
||||||
@ -966,6 +967,7 @@ class DebuggingOptions {
|
|||||||
vmserviceOutFile = null,
|
vmserviceOutFile = null,
|
||||||
fastStart = false,
|
fastStart = false,
|
||||||
webEnableExpressionEvaluation = false,
|
webEnableExpressionEvaluation = false,
|
||||||
|
nullAssertions = false,
|
||||||
nativeNullAssertions = false,
|
nativeNullAssertions = false,
|
||||||
serveObservatory = false;
|
serveObservatory = false;
|
||||||
|
|
||||||
@ -1008,6 +1010,7 @@ class DebuggingOptions {
|
|||||||
required this.webLaunchUrl,
|
required this.webLaunchUrl,
|
||||||
required this.vmserviceOutFile,
|
required this.vmserviceOutFile,
|
||||||
required this.fastStart,
|
required this.fastStart,
|
||||||
|
required this.nullAssertions,
|
||||||
required this.nativeNullAssertions,
|
required this.nativeNullAssertions,
|
||||||
required this.enableImpeller,
|
required this.enableImpeller,
|
||||||
required this.uninstallFirst,
|
required this.uninstallFirst,
|
||||||
@ -1081,6 +1084,8 @@ class DebuggingOptions {
|
|||||||
final String? vmserviceOutFile;
|
final String? vmserviceOutFile;
|
||||||
final bool fastStart;
|
final bool fastStart;
|
||||||
|
|
||||||
|
final bool nullAssertions;
|
||||||
|
|
||||||
/// Additional null runtime checks inserted for web applications.
|
/// Additional null runtime checks inserted for web applications.
|
||||||
///
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
@ -1175,6 +1180,7 @@ class DebuggingOptions {
|
|||||||
'webLaunchUrl': webLaunchUrl,
|
'webLaunchUrl': webLaunchUrl,
|
||||||
'vmserviceOutFile': vmserviceOutFile,
|
'vmserviceOutFile': vmserviceOutFile,
|
||||||
'fastStart': fastStart,
|
'fastStart': fastStart,
|
||||||
|
'nullAssertions': nullAssertions,
|
||||||
'nativeNullAssertions': nativeNullAssertions,
|
'nativeNullAssertions': nativeNullAssertions,
|
||||||
'enableImpeller': enableImpeller,
|
'enableImpeller': enableImpeller,
|
||||||
'serveObservatory': serveObservatory,
|
'serveObservatory': serveObservatory,
|
||||||
@ -1222,6 +1228,7 @@ class DebuggingOptions {
|
|||||||
webLaunchUrl: json['webLaunchUrl'] as String?,
|
webLaunchUrl: json['webLaunchUrl'] as String?,
|
||||||
vmserviceOutFile: json['vmserviceOutFile'] as String?,
|
vmserviceOutFile: json['vmserviceOutFile'] as String?,
|
||||||
fastStart: json['fastStart']! as bool,
|
fastStart: json['fastStart']! as bool,
|
||||||
|
nullAssertions: json['nullAssertions']! as bool,
|
||||||
nativeNullAssertions: json['nativeNullAssertions']! as bool,
|
nativeNullAssertions: json['nativeNullAssertions']! as bool,
|
||||||
enableImpeller: (json['enableImpeller'] as bool?) ?? false,
|
enableImpeller: (json['enableImpeller'] as bool?) ?? false,
|
||||||
uninstallFirst: (json['uninstallFirst'] as bool?) ?? false,
|
uninstallFirst: (json['uninstallFirst'] as bool?) ?? false,
|
||||||
@ -1303,9 +1310,13 @@ class NoOpDeviceLogReader implements DeviceLogReader {
|
|||||||
void dispose() { }
|
void dispose() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Append --null_assertions to any existing Dart VM flags if
|
||||||
|
/// [debuggingOptions.nullAssertions] is true.
|
||||||
String computeDartVmFlags(DebuggingOptions debuggingOptions) {
|
String computeDartVmFlags(DebuggingOptions debuggingOptions) {
|
||||||
if (debuggingOptions.dartFlags.isNotEmpty) {
|
return <String>[
|
||||||
return debuggingOptions.dartFlags;
|
if (debuggingOptions.dartFlags.isNotEmpty)
|
||||||
}
|
debuggingOptions.dartFlags,
|
||||||
return '';
|
if (debuggingOptions.nullAssertions)
|
||||||
|
'--null_assertions',
|
||||||
|
].join(',');
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ class FuchsiaKernelCompiler {
|
|||||||
throwToolExit('Fuchsia platform file not found at "$platformDill"');
|
throwToolExit('Fuchsia platform file not found at "$platformDill"');
|
||||||
}
|
}
|
||||||
List<String> flags = <String>[
|
List<String> flags = <String>[
|
||||||
|
'--no-sound-null-safety',
|
||||||
'--target',
|
'--target',
|
||||||
'flutter_runner',
|
'flutter_runner',
|
||||||
'--platform',
|
'--platform',
|
||||||
|
@ -133,6 +133,7 @@ class WebAssetServer implements AssetReader {
|
|||||||
this.internetAddress,
|
this.internetAddress,
|
||||||
this._modules,
|
this._modules,
|
||||||
this._digests,
|
this._digests,
|
||||||
|
this._nullSafetyMode,
|
||||||
) : basePath = _getIndexHtml().getBaseHref();
|
) : basePath = _getIndexHtml().getBaseHref();
|
||||||
|
|
||||||
// Fallback to "application/octet-stream" on null which
|
// Fallback to "application/octet-stream" on null which
|
||||||
@ -187,7 +188,8 @@ class WebAssetServer implements AssetReader {
|
|||||||
bool enableDwds,
|
bool enableDwds,
|
||||||
bool enableDds,
|
bool enableDds,
|
||||||
Uri entrypoint,
|
Uri entrypoint,
|
||||||
ExpressionCompiler? expressionCompiler, {
|
ExpressionCompiler? expressionCompiler,
|
||||||
|
NullSafetyMode nullSafetyMode, {
|
||||||
bool testMode = false,
|
bool testMode = false,
|
||||||
DwdsLauncher dwdsLauncher = Dwds.start,
|
DwdsLauncher dwdsLauncher = Dwds.start,
|
||||||
}) async {
|
}) async {
|
||||||
@ -224,6 +226,7 @@ class WebAssetServer implements AssetReader {
|
|||||||
address,
|
address,
|
||||||
modules,
|
modules,
|
||||||
digests,
|
digests,
|
||||||
|
nullSafetyMode,
|
||||||
);
|
);
|
||||||
if (testMode) {
|
if (testMode) {
|
||||||
return server;
|
return server;
|
||||||
@ -316,6 +319,7 @@ class WebAssetServer implements AssetReader {
|
|||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final NullSafetyMode _nullSafetyMode;
|
||||||
final HttpServer _httpServer;
|
final HttpServer _httpServer;
|
||||||
final WebMemoryFS _webMemoryFS = WebMemoryFS();
|
final WebMemoryFS _webMemoryFS = WebMemoryFS();
|
||||||
final PackageConfig _packages;
|
final PackageConfig _packages;
|
||||||
@ -572,12 +576,12 @@ class WebAssetServer implements AssetReader {
|
|||||||
|
|
||||||
File get _resolveDartSdkJsFile =>
|
File get _resolveDartSdkJsFile =>
|
||||||
globals.fs.file(globals.artifacts!.getHostArtifact(
|
globals.fs.file(globals.artifacts!.getHostArtifact(
|
||||||
kDartSdkJsArtifactMap[webRenderer]!
|
kDartSdkJsArtifactMap[webRenderer]![_nullSafetyMode]!
|
||||||
));
|
));
|
||||||
|
|
||||||
File get _resolveDartSdkJsMapFile =>
|
File get _resolveDartSdkJsMapFile =>
|
||||||
globals.fs.file(globals.artifacts!.getHostArtifact(
|
globals.fs.file(globals.artifacts!.getHostArtifact(
|
||||||
kDartSdkJsMapArtifactMap[webRenderer]!
|
kDartSdkJsMapArtifactMap[webRenderer]![_nullSafetyMode]!
|
||||||
));
|
));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -646,7 +650,9 @@ class WebDevFS implements DevFS {
|
|||||||
required this.entrypoint,
|
required this.entrypoint,
|
||||||
required this.expressionCompiler,
|
required this.expressionCompiler,
|
||||||
required this.chromiumLauncher,
|
required this.chromiumLauncher,
|
||||||
|
required this.nullAssertions,
|
||||||
required this.nativeNullAssertions,
|
required this.nativeNullAssertions,
|
||||||
|
required this.nullSafetyMode,
|
||||||
this.testMode = false,
|
this.testMode = false,
|
||||||
}) : _port = port;
|
}) : _port = port;
|
||||||
|
|
||||||
@ -663,8 +669,10 @@ class WebDevFS implements DevFS {
|
|||||||
final bool testMode;
|
final bool testMode;
|
||||||
final ExpressionCompiler? expressionCompiler;
|
final ExpressionCompiler? expressionCompiler;
|
||||||
final ChromiumLauncher? chromiumLauncher;
|
final ChromiumLauncher? chromiumLauncher;
|
||||||
|
final bool nullAssertions;
|
||||||
final bool nativeNullAssertions;
|
final bool nativeNullAssertions;
|
||||||
final int? _port;
|
final int? _port;
|
||||||
|
final NullSafetyMode nullSafetyMode;
|
||||||
|
|
||||||
late WebAssetServer webAssetServer;
|
late WebAssetServer webAssetServer;
|
||||||
|
|
||||||
@ -760,6 +768,7 @@ class WebDevFS implements DevFS {
|
|||||||
enableDds,
|
enableDds,
|
||||||
entrypoint,
|
entrypoint,
|
||||||
expressionCompiler,
|
expressionCompiler,
|
||||||
|
nullSafetyMode,
|
||||||
testMode: testMode,
|
testMode: testMode,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -848,6 +857,7 @@ class WebDevFS implements DevFS {
|
|||||||
'main_module.bootstrap.js',
|
'main_module.bootstrap.js',
|
||||||
generateMainModule(
|
generateMainModule(
|
||||||
entrypoint: entrypoint,
|
entrypoint: entrypoint,
|
||||||
|
nullAssertions: nullAssertions,
|
||||||
nativeNullAssertions: nativeNullAssertions,
|
nativeNullAssertions: nativeNullAssertions,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -274,6 +274,8 @@ class ResidentWebRunner extends ResidentRunner {
|
|||||||
entrypoint: _fileSystem.file(target).uri,
|
entrypoint: _fileSystem.file(target).uri,
|
||||||
expressionCompiler: expressionCompiler,
|
expressionCompiler: expressionCompiler,
|
||||||
chromiumLauncher: _chromiumLauncher,
|
chromiumLauncher: _chromiumLauncher,
|
||||||
|
nullAssertions: debuggingOptions.nullAssertions,
|
||||||
|
nullSafetyMode: debuggingOptions.buildInfo.nullSafetyMode,
|
||||||
nativeNullAssertions: debuggingOptions.nativeNullAssertions,
|
nativeNullAssertions: debuggingOptions.nativeNullAssertions,
|
||||||
);
|
);
|
||||||
final Uri url = await device!.devFS!.create();
|
final Uri url = await device!.devFS!.create();
|
||||||
@ -601,6 +603,16 @@ class ResidentWebRunner extends ResidentRunner {
|
|||||||
..writeAsStringSync(websocketUri.toString());
|
..writeAsStringSync(websocketUri.toString());
|
||||||
}
|
}
|
||||||
_logger.printStatus('Debug service listening on $websocketUri');
|
_logger.printStatus('Debug service listening on $websocketUri');
|
||||||
|
if (debuggingOptions.buildInfo.nullSafetyMode != NullSafetyMode.sound) {
|
||||||
|
_logger.printStatus('');
|
||||||
|
_logger.printStatus(
|
||||||
|
'Running without sound null safety ⚠️',
|
||||||
|
emphasis: true,
|
||||||
|
);
|
||||||
|
_logger.printStatus(
|
||||||
|
'Dart 3 will only support sound null safety, see https://dart.dev/null-safety',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
appStartedCompleter?.complete();
|
appStartedCompleter?.complete();
|
||||||
connectionInfoCompleter?.complete(DebugConnectionInfo(wsUri: websocketUri));
|
connectionInfoCompleter?.complete(DebugConnectionInfo(wsUri: websocketUri));
|
||||||
|
@ -59,6 +59,8 @@ class CustomDimensions {
|
|||||||
this.commandPackagesAndroidEmbeddingVersion,
|
this.commandPackagesAndroidEmbeddingVersion,
|
||||||
this.nullSafety,
|
this.nullSafety,
|
||||||
this.fastReassemble,
|
this.fastReassemble,
|
||||||
|
this.nullSafeMigratedLibraries,
|
||||||
|
this.nullSafeTotalLibraries,
|
||||||
this.hotEventCompileTimeInMs,
|
this.hotEventCompileTimeInMs,
|
||||||
this.hotEventFindInvalidatedTimeInMs,
|
this.hotEventFindInvalidatedTimeInMs,
|
||||||
this.hotEventScannedSourcesCount,
|
this.hotEventScannedSourcesCount,
|
||||||
@ -116,8 +118,8 @@ class CustomDimensions {
|
|||||||
final String? commandPackagesAndroidEmbeddingVersion; // cd46
|
final String? commandPackagesAndroidEmbeddingVersion; // cd46
|
||||||
final bool? nullSafety; // cd47
|
final bool? nullSafety; // cd47
|
||||||
final bool? fastReassemble; // cd48
|
final bool? fastReassemble; // cd48
|
||||||
// final int? nullSafeMigratedLibraries; // cd49 - deprecated
|
final int? nullSafeMigratedLibraries; // cd49
|
||||||
// final int? nullSafeTotalLibraries; // cd50 - deprecated
|
final int? nullSafeTotalLibraries; // cd50
|
||||||
final int? hotEventCompileTimeInMs; // cd 51
|
final int? hotEventCompileTimeInMs; // cd 51
|
||||||
final int? hotEventFindInvalidatedTimeInMs; // cd 52
|
final int? hotEventFindInvalidatedTimeInMs; // cd 52
|
||||||
final int? hotEventScannedSourcesCount; // cd 53
|
final int? hotEventScannedSourcesCount; // cd 53
|
||||||
@ -176,6 +178,8 @@ class CustomDimensions {
|
|||||||
if (commandPackagesAndroidEmbeddingVersion != null) cdKey(CustomDimensionsEnum.commandPackagesAndroidEmbeddingVersion): commandPackagesAndroidEmbeddingVersion.toString(),
|
if (commandPackagesAndroidEmbeddingVersion != null) cdKey(CustomDimensionsEnum.commandPackagesAndroidEmbeddingVersion): commandPackagesAndroidEmbeddingVersion.toString(),
|
||||||
if (nullSafety != null) cdKey(CustomDimensionsEnum.nullSafety): nullSafety.toString(),
|
if (nullSafety != null) cdKey(CustomDimensionsEnum.nullSafety): nullSafety.toString(),
|
||||||
if (fastReassemble != null) cdKey(CustomDimensionsEnum.fastReassemble): fastReassemble.toString(),
|
if (fastReassemble != null) cdKey(CustomDimensionsEnum.fastReassemble): fastReassemble.toString(),
|
||||||
|
if (nullSafeMigratedLibraries != null) cdKey(CustomDimensionsEnum.nullSafeMigratedLibraries): nullSafeMigratedLibraries.toString(),
|
||||||
|
if (nullSafeTotalLibraries != null) cdKey(CustomDimensionsEnum.nullSafeTotalLibraries): nullSafeTotalLibraries.toString(),
|
||||||
if (hotEventCompileTimeInMs != null) cdKey(CustomDimensionsEnum.hotEventCompileTimeInMs): hotEventCompileTimeInMs.toString(),
|
if (hotEventCompileTimeInMs != null) cdKey(CustomDimensionsEnum.hotEventCompileTimeInMs): hotEventCompileTimeInMs.toString(),
|
||||||
if (hotEventFindInvalidatedTimeInMs != null) cdKey(CustomDimensionsEnum.hotEventFindInvalidatedTimeInMs): hotEventFindInvalidatedTimeInMs.toString(),
|
if (hotEventFindInvalidatedTimeInMs != null) cdKey(CustomDimensionsEnum.hotEventFindInvalidatedTimeInMs): hotEventFindInvalidatedTimeInMs.toString(),
|
||||||
if (hotEventScannedSourcesCount != null) cdKey(CustomDimensionsEnum.hotEventScannedSourcesCount): hotEventScannedSourcesCount.toString(),
|
if (hotEventScannedSourcesCount != null) cdKey(CustomDimensionsEnum.hotEventScannedSourcesCount): hotEventScannedSourcesCount.toString(),
|
||||||
@ -241,6 +245,8 @@ class CustomDimensions {
|
|||||||
commandPackagesAndroidEmbeddingVersion: other.commandPackagesAndroidEmbeddingVersion ?? commandPackagesAndroidEmbeddingVersion,
|
commandPackagesAndroidEmbeddingVersion: other.commandPackagesAndroidEmbeddingVersion ?? commandPackagesAndroidEmbeddingVersion,
|
||||||
nullSafety: other.nullSafety ?? nullSafety,
|
nullSafety: other.nullSafety ?? nullSafety,
|
||||||
fastReassemble: other.fastReassemble ?? fastReassemble,
|
fastReassemble: other.fastReassemble ?? fastReassemble,
|
||||||
|
nullSafeMigratedLibraries: other.nullSafeMigratedLibraries ?? nullSafeMigratedLibraries,
|
||||||
|
nullSafeTotalLibraries: other.nullSafeTotalLibraries ?? nullSafeTotalLibraries,
|
||||||
hotEventCompileTimeInMs: other.hotEventCompileTimeInMs ?? hotEventCompileTimeInMs,
|
hotEventCompileTimeInMs: other.hotEventCompileTimeInMs ?? hotEventCompileTimeInMs,
|
||||||
hotEventFindInvalidatedTimeInMs: other.hotEventFindInvalidatedTimeInMs ?? hotEventFindInvalidatedTimeInMs,
|
hotEventFindInvalidatedTimeInMs: other.hotEventFindInvalidatedTimeInMs ?? hotEventFindInvalidatedTimeInMs,
|
||||||
hotEventScannedSourcesCount: other.hotEventScannedSourcesCount ?? hotEventScannedSourcesCount,
|
hotEventScannedSourcesCount: other.hotEventScannedSourcesCount ?? hotEventScannedSourcesCount,
|
||||||
@ -300,6 +306,8 @@ class CustomDimensions {
|
|||||||
commandPackagesAndroidEmbeddingVersion: _extractString(map, CustomDimensionsEnum.commandPackagesAndroidEmbeddingVersion),
|
commandPackagesAndroidEmbeddingVersion: _extractString(map, CustomDimensionsEnum.commandPackagesAndroidEmbeddingVersion),
|
||||||
nullSafety: _extractBool(map, CustomDimensionsEnum.nullSafety),
|
nullSafety: _extractBool(map, CustomDimensionsEnum.nullSafety),
|
||||||
fastReassemble: _extractBool(map, CustomDimensionsEnum.fastReassemble),
|
fastReassemble: _extractBool(map, CustomDimensionsEnum.fastReassemble),
|
||||||
|
nullSafeMigratedLibraries: _extractInt(map, CustomDimensionsEnum.nullSafeMigratedLibraries),
|
||||||
|
nullSafeTotalLibraries: _extractInt(map, CustomDimensionsEnum.nullSafeTotalLibraries),
|
||||||
hotEventCompileTimeInMs: _extractInt(map, CustomDimensionsEnum.hotEventCompileTimeInMs),
|
hotEventCompileTimeInMs: _extractInt(map, CustomDimensionsEnum.hotEventCompileTimeInMs),
|
||||||
hotEventFindInvalidatedTimeInMs: _extractInt(map, CustomDimensionsEnum.hotEventFindInvalidatedTimeInMs),
|
hotEventFindInvalidatedTimeInMs: _extractInt(map, CustomDimensionsEnum.hotEventFindInvalidatedTimeInMs),
|
||||||
hotEventScannedSourcesCount: _extractInt(map, CustomDimensionsEnum.hotEventScannedSourcesCount),
|
hotEventScannedSourcesCount: _extractInt(map, CustomDimensionsEnum.hotEventScannedSourcesCount),
|
||||||
@ -385,8 +393,8 @@ enum CustomDimensionsEnum {
|
|||||||
commandPackagesAndroidEmbeddingVersion, // cd46
|
commandPackagesAndroidEmbeddingVersion, // cd46
|
||||||
nullSafety, // cd47
|
nullSafety, // cd47
|
||||||
fastReassemble, // cd48
|
fastReassemble, // cd48
|
||||||
nullSafeMigratedLibraries, // cd49 - deprecated
|
nullSafeMigratedLibraries, // cd49
|
||||||
nullSafeTotalLibraries, // cd50 - deprecated
|
nullSafeTotalLibraries, // cd50
|
||||||
hotEventCompileTimeInMs, // cd51
|
hotEventCompileTimeInMs, // cd51
|
||||||
hotEventFindInvalidatedTimeInMs, // cd52
|
hotEventFindInvalidatedTimeInMs, // cd52
|
||||||
hotEventScannedSourcesCount, // cd53
|
hotEventScannedSourcesCount, // cd53
|
||||||
|
@ -248,3 +248,67 @@ class CodeSizeEvent extends UsageEvent {
|
|||||||
class ErrorHandlingEvent extends UsageEvent {
|
class ErrorHandlingEvent extends UsageEvent {
|
||||||
ErrorHandlingEvent(String parameter) : super('error-handling', parameter, flutterUsage: globals.flutterUsage);
|
ErrorHandlingEvent(String parameter) : super('error-handling', parameter, flutterUsage: globals.flutterUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Emit various null safety analytic events.
|
||||||
|
///
|
||||||
|
/// 1. The current null safety runtime mode.
|
||||||
|
/// 2. The number of packages that are migrated, along with the total number of packages
|
||||||
|
/// 3. The main packages language version.
|
||||||
|
class NullSafetyAnalysisEvent implements UsageEvent {
|
||||||
|
NullSafetyAnalysisEvent(
|
||||||
|
this.packageConfig,
|
||||||
|
this.nullSafetyMode,
|
||||||
|
this.currentPackage,
|
||||||
|
this.flutterUsage,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// The category for analytics events related to null safety.
|
||||||
|
static const String kNullSafetyCategory = 'null-safety';
|
||||||
|
|
||||||
|
final PackageConfig packageConfig;
|
||||||
|
final NullSafetyMode nullSafetyMode;
|
||||||
|
final String currentPackage;
|
||||||
|
@override
|
||||||
|
final Usage flutterUsage;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void send() {
|
||||||
|
if (packageConfig.packages.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int migrated = 0;
|
||||||
|
LanguageVersion? languageVersion;
|
||||||
|
for (final Package package in packageConfig.packages) {
|
||||||
|
final LanguageVersion? packageLanguageVersion = package.languageVersion;
|
||||||
|
if (package.name == currentPackage) {
|
||||||
|
languageVersion = packageLanguageVersion;
|
||||||
|
}
|
||||||
|
if (packageLanguageVersion != null &&
|
||||||
|
packageLanguageVersion.major >= nullSafeVersion.major &&
|
||||||
|
packageLanguageVersion.minor >= nullSafeVersion.minor) {
|
||||||
|
migrated += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flutterUsage.sendEvent(kNullSafetyCategory, 'runtime-mode', label: nullSafetyMode.toString());
|
||||||
|
flutterUsage.sendEvent(kNullSafetyCategory, 'stats', parameters: CustomDimensions(
|
||||||
|
nullSafeMigratedLibraries: migrated,
|
||||||
|
nullSafeTotalLibraries: packageConfig.packages.length,
|
||||||
|
));
|
||||||
|
if (languageVersion != null) {
|
||||||
|
final String formattedVersion = '${languageVersion.major}.${languageVersion.minor}';
|
||||||
|
flutterUsage.sendEvent(kNullSafetyCategory, 'language-version', label: formattedVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get category => kNullSafetyCategory;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get label => throw UnsupportedError('');
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get parameter => throw UnsupportedError('');
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get value => throw UnsupportedError('');
|
||||||
|
}
|
||||||
|
@ -8,11 +8,14 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
import 'package:package_config/package_config.dart';
|
||||||
import 'package:usage/usage_io.dart';
|
import 'package:usage/usage_io.dart';
|
||||||
|
|
||||||
import '../base/error_handling_io.dart';
|
import '../base/error_handling_io.dart';
|
||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../base/time.dart';
|
import '../base/time.dart';
|
||||||
|
import '../build_info.dart';
|
||||||
|
import '../dart/language_version.dart';
|
||||||
import '../doctor_validator.dart';
|
import '../doctor_validator.dart';
|
||||||
import '../features.dart';
|
import '../features.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals.dart' as globals;
|
||||||
|
@ -118,8 +118,21 @@ class FlutterDevice {
|
|||||||
// used to file a bug, but the compiler will still start up correctly.
|
// used to file a bug, but the compiler will still start up correctly.
|
||||||
if (targetPlatform == TargetPlatform.web_javascript) {
|
if (targetPlatform == TargetPlatform.web_javascript) {
|
||||||
// TODO(zanderso): consistently provide these flags across platforms.
|
// TODO(zanderso): consistently provide these flags across platforms.
|
||||||
const String platformDillName = 'ddc_outline_sound.dill';
|
final String platformDillName;
|
||||||
final List<String> extraFrontEndOptions = List<String>.of(buildInfo.extraFrontEndOptions);
|
final List<String> extraFrontEndOptions = List<String>.of(buildInfo.extraFrontEndOptions);
|
||||||
|
if (buildInfo.nullSafetyMode == NullSafetyMode.unsound) {
|
||||||
|
platformDillName = 'ddc_outline.dill';
|
||||||
|
if (!extraFrontEndOptions.contains('--no-sound-null-safety')) {
|
||||||
|
extraFrontEndOptions.add('--no-sound-null-safety');
|
||||||
|
}
|
||||||
|
} else if (buildInfo.nullSafetyMode == NullSafetyMode.sound) {
|
||||||
|
platformDillName = 'ddc_outline_sound.dill';
|
||||||
|
if (!extraFrontEndOptions.contains('--sound-null-safety')) {
|
||||||
|
extraFrontEndOptions.add('--sound-null-safety');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw StateError('Expected buildInfo.nullSafetyMode to be one of unsound or sound, got ${buildInfo.nullSafetyMode}');
|
||||||
|
}
|
||||||
|
|
||||||
final String platformDillPath = globals.fs.path.join(
|
final String platformDillPath = globals.fs.path.join(
|
||||||
getWebPlatformBinariesDirectory(globals.artifacts!, buildInfo.webRenderer).path,
|
getWebPlatformBinariesDirectory(globals.artifacts!, buildInfo.webRenderer).path,
|
||||||
|
@ -1039,6 +1039,16 @@ class HotRunner extends ResidentRunner {
|
|||||||
}
|
}
|
||||||
commandHelp.c.print();
|
commandHelp.c.print();
|
||||||
commandHelp.q.print();
|
commandHelp.q.print();
|
||||||
|
if (debuggingOptions.buildInfo.nullSafetyMode != NullSafetyMode.sound) {
|
||||||
|
globals.printStatus('');
|
||||||
|
globals.printStatus(
|
||||||
|
'Running without sound null safety ⚠️',
|
||||||
|
emphasis: true,
|
||||||
|
);
|
||||||
|
globals.printStatus(
|
||||||
|
'Dart 3 will only support sound null safety, see https://dart.dev/null-safety',
|
||||||
|
);
|
||||||
|
}
|
||||||
globals.printStatus('');
|
globals.printStatus('');
|
||||||
printDebuggerList();
|
printDebuggerList();
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import '../bundle.dart' as bundle;
|
|||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../convert.dart';
|
import '../convert.dart';
|
||||||
import '../dart/generate_synthetic_packages.dart';
|
import '../dart/generate_synthetic_packages.dart';
|
||||||
|
import '../dart/language_version.dart';
|
||||||
import '../dart/package_map.dart';
|
import '../dart/package_map.dart';
|
||||||
import '../dart/pub.dart';
|
import '../dart/pub.dart';
|
||||||
import '../device.dart';
|
import '../device.dart';
|
||||||
@ -109,10 +110,12 @@ class FlutterOptions {
|
|||||||
static const String kDartDefineFromFileOption = 'dart-define-from-file';
|
static const String kDartDefineFromFileOption = 'dart-define-from-file';
|
||||||
static const String kBundleSkSLPathOption = 'bundle-sksl-path';
|
static const String kBundleSkSLPathOption = 'bundle-sksl-path';
|
||||||
static const String kPerformanceMeasurementFile = 'performance-measurement-file';
|
static const String kPerformanceMeasurementFile = 'performance-measurement-file';
|
||||||
|
static const String kNullSafety = 'sound-null-safety';
|
||||||
static const String kDeviceUser = 'device-user';
|
static const String kDeviceUser = 'device-user';
|
||||||
static const String kDeviceTimeout = 'device-timeout';
|
static const String kDeviceTimeout = 'device-timeout';
|
||||||
static const String kAnalyzeSize = 'analyze-size';
|
static const String kAnalyzeSize = 'analyze-size';
|
||||||
static const String kCodeSizeDirectory = 'code-size-directory';
|
static const String kCodeSizeDirectory = 'code-size-directory';
|
||||||
|
static const String kNullAssertions = 'null-assertions';
|
||||||
static const String kAndroidGradleDaemon = 'android-gradle-daemon';
|
static const String kAndroidGradleDaemon = 'android-gradle-daemon';
|
||||||
static const String kDeferredComponents = 'deferred-components';
|
static const String kDeferredComponents = 'deferred-components';
|
||||||
static const String kAndroidProjectArgs = 'android-project-arg';
|
static const String kAndroidProjectArgs = 'android-project-arg';
|
||||||
@ -692,6 +695,9 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
/// Whether it is safe for this command to use a cached pub invocation.
|
/// Whether it is safe for this command to use a cached pub invocation.
|
||||||
bool get cachePubGet => true;
|
bool get cachePubGet => true;
|
||||||
|
|
||||||
|
/// Whether this command should report null safety analytics.
|
||||||
|
bool get reportNullSafety => false;
|
||||||
|
|
||||||
late final Duration? deviceDiscoveryTimeout = () {
|
late final Duration? deviceDiscoveryTimeout = () {
|
||||||
if ((argResults?.options.contains(FlutterOptions.kDeviceTimeout) ?? false)
|
if ((argResults?.options.contains(FlutterOptions.kDeviceTimeout) ?? false)
|
||||||
&& (argResults?.wasParsed(FlutterOptions.kDeviceTimeout) ?? false)) {
|
&& (argResults?.wasParsed(FlutterOptions.kDeviceTimeout) ?? false)) {
|
||||||
@ -800,6 +806,25 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addNullSafetyModeOptions({ required bool hide }) {
|
||||||
|
argParser.addFlag(FlutterOptions.kNullSafety,
|
||||||
|
help:
|
||||||
|
'Whether to override the inferred null safety mode. This allows null-safe '
|
||||||
|
'libraries to depend on un-migrated (non-null safe) libraries. By default, '
|
||||||
|
'Flutter mobile & desktop applications will attempt to run at the null safety '
|
||||||
|
'level of their entrypoint library (usually lib/main.dart). Flutter web '
|
||||||
|
'applications will default to sound null-safety, unless specifically configured.',
|
||||||
|
defaultsTo: true,
|
||||||
|
hide: hide,
|
||||||
|
);
|
||||||
|
argParser.addFlag(FlutterOptions.kNullAssertions,
|
||||||
|
help:
|
||||||
|
'Perform additional null assertions on the boundaries of migrated and '
|
||||||
|
'un-migrated code. This setting is not currently supported on desktop '
|
||||||
|
'devices.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Enables support for the hidden options --extra-front-end-options and
|
/// Enables support for the hidden options --extra-front-end-options and
|
||||||
/// --extra-gen-snapshot-options.
|
/// --extra-gen-snapshot-options.
|
||||||
void usesExtraDartFlagOptions({ required bool verboseHelp }) {
|
void usesExtraDartFlagOptions({ required bool verboseHelp }) {
|
||||||
@ -928,6 +953,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||||
addDartObfuscationOption();
|
addDartObfuscationOption();
|
||||||
addEnableExperimentation(hide: !verboseHelp);
|
addEnableExperimentation(hide: !verboseHelp);
|
||||||
|
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||||
addSplitDebugInfoOption();
|
addSplitDebugInfoOption();
|
||||||
addTreeShakeIconsFlag();
|
addTreeShakeIconsFlag();
|
||||||
usesAnalyzeSizeFlag();
|
usesAnalyzeSizeFlag();
|
||||||
@ -1085,6 +1111,44 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
codeSizeDirectory = directory.path;
|
codeSizeDirectory = directory.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NullSafetyMode nullSafetyMode = NullSafetyMode.sound;
|
||||||
|
if (argParser.options.containsKey(FlutterOptions.kNullSafety)) {
|
||||||
|
// Explicitly check for `true` and `false` so that `null` results in not
|
||||||
|
// passing a flag. Examine the entrypoint file to determine if it
|
||||||
|
// is opted in or out.
|
||||||
|
final bool wasNullSafetyFlagParsed = argResults?.wasParsed(FlutterOptions.kNullSafety) ?? false;
|
||||||
|
if (!wasNullSafetyFlagParsed && (argParser.options.containsKey('target') || forcedTargetFile != null)) {
|
||||||
|
final File entrypointFile = forcedTargetFile ?? globals.fs.file(targetFile);
|
||||||
|
final LanguageVersion languageVersion = determineLanguageVersion(
|
||||||
|
entrypointFile,
|
||||||
|
packageConfig.packageOf(entrypointFile.absolute.uri),
|
||||||
|
Cache.flutterRoot!,
|
||||||
|
);
|
||||||
|
// Extra frontend options are only provided if explicitly
|
||||||
|
// requested.
|
||||||
|
if ((languageVersion.major > nullSafeVersion.major) ||
|
||||||
|
(languageVersion.major == nullSafeVersion.major && languageVersion.minor >= nullSafeVersion.minor)) {
|
||||||
|
nullSafetyMode = NullSafetyMode.sound;
|
||||||
|
} else {
|
||||||
|
throwToolExit(
|
||||||
|
'This application does not support sound null-safety (its language version is $languageVersion).\n'
|
||||||
|
'To build this application, you must provide the CLI flag --no-sound-null-safety. Dart 3 will only '
|
||||||
|
'support sound null safety, see https://dart.dev/null-safety.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (!wasNullSafetyFlagParsed) {
|
||||||
|
// This mode is only used for commands which do not build a single target like
|
||||||
|
// 'flutter test'.
|
||||||
|
nullSafetyMode = NullSafetyMode.autodetect;
|
||||||
|
} else if (boolArg(FlutterOptions.kNullSafety)) {
|
||||||
|
nullSafetyMode = NullSafetyMode.sound;
|
||||||
|
extraFrontEndOptions.add('--sound-null-safety');
|
||||||
|
} else {
|
||||||
|
nullSafetyMode = NullSafetyMode.unsound;
|
||||||
|
extraFrontEndOptions.add('--no-sound-null-safety');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final bool dartObfuscation = argParser.options.containsKey(FlutterOptions.kDartObfuscationOption)
|
final bool dartObfuscation = argParser.options.containsKey(FlutterOptions.kDartObfuscationOption)
|
||||||
&& boolArg(FlutterOptions.kDartObfuscationOption);
|
&& boolArg(FlutterOptions.kDartObfuscationOption);
|
||||||
|
|
||||||
@ -1168,6 +1232,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
performanceMeasurementFile: performanceMeasurementFile,
|
performanceMeasurementFile: performanceMeasurementFile,
|
||||||
dartDefineConfigJsonMap: defineConfigJsonMap,
|
dartDefineConfigJsonMap: defineConfigJsonMap,
|
||||||
packagesPath: packagesPath ?? globals.fs.path.absolute('.dart_tool', 'package_config.json'),
|
packagesPath: packagesPath ?? globals.fs.path.absolute('.dart_tool', 'package_config.json'),
|
||||||
|
nullSafetyMode: nullSafetyMode,
|
||||||
codeSizeDirectory: codeSizeDirectory,
|
codeSizeDirectory: codeSizeDirectory,
|
||||||
androidGradleDaemon: androidGradleDaemon,
|
androidGradleDaemon: androidGradleDaemon,
|
||||||
packageConfig: packageConfig,
|
packageConfig: packageConfig,
|
||||||
@ -1427,6 +1492,9 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
checkUpToDate: cachePubGet,
|
checkUpToDate: cachePubGet,
|
||||||
);
|
);
|
||||||
await project.regeneratePlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
|
if (reportNullSafety) {
|
||||||
|
await _sendNullSafetyAnalyticsEvents(project);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setupApplicationPackages();
|
setupApplicationPackages();
|
||||||
@ -1440,6 +1508,16 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
return runCommand();
|
return runCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _sendNullSafetyAnalyticsEvents(FlutterProject project) async {
|
||||||
|
final BuildInfo buildInfo = await getBuildInfo();
|
||||||
|
NullSafetyAnalysisEvent(
|
||||||
|
buildInfo.packageConfig,
|
||||||
|
buildInfo.nullSafetyMode,
|
||||||
|
project.manifest.appName,
|
||||||
|
globals.flutterUsage,
|
||||||
|
).send();
|
||||||
|
}
|
||||||
|
|
||||||
/// The set of development artifacts required for this command.
|
/// The set of development artifacts required for this command.
|
||||||
///
|
///
|
||||||
/// Defaults to an empty set. Including [DevelopmentArtifact.universal] is
|
/// Defaults to an empty set. Including [DevelopmentArtifact.universal] is
|
||||||
|
@ -119,6 +119,8 @@ class FlutterTesterTestDevice extends TestDevice {
|
|||||||
'--packages=${debuggingOptions.buildInfo.packagesPath}',
|
'--packages=${debuggingOptions.buildInfo.packagesPath}',
|
||||||
if (testAssetDirectory != null)
|
if (testAssetDirectory != null)
|
||||||
'--flutter-assets-dir=$testAssetDirectory',
|
'--flutter-assets-dir=$testAssetDirectory',
|
||||||
|
if (debuggingOptions.nullAssertions)
|
||||||
|
'--dart-flags=--null_assertions',
|
||||||
...debuggingOptions.dartEntrypointArgs,
|
...debuggingOptions.dartEntrypointArgs,
|
||||||
entrypointPath,
|
entrypointPath,
|
||||||
];
|
];
|
||||||
|
@ -42,6 +42,7 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
FlutterProject? flutterProject,
|
FlutterProject? flutterProject,
|
||||||
String? shellPath,
|
String? shellPath,
|
||||||
this.updateGoldens,
|
this.updateGoldens,
|
||||||
|
this.nullAssertions,
|
||||||
required this.buildInfo,
|
required this.buildInfo,
|
||||||
required this.webMemoryFS,
|
required this.webMemoryFS,
|
||||||
required FileSystem fileSystem,
|
required FileSystem fileSystem,
|
||||||
@ -91,6 +92,7 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
final Logger _logger;
|
final Logger _logger;
|
||||||
final Artifacts? _artifacts;
|
final Artifacts? _artifacts;
|
||||||
final bool? updateGoldens;
|
final bool? updateGoldens;
|
||||||
|
final bool? nullAssertions;
|
||||||
final OneOffHandler _webSocketHandler = OneOffHandler();
|
final OneOffHandler _webSocketHandler = OneOffHandler();
|
||||||
final AsyncMemoizer<void> _closeMemo = AsyncMemoizer<void>();
|
final AsyncMemoizer<void> _closeMemo = AsyncMemoizer<void>();
|
||||||
final String _root;
|
final String _root;
|
||||||
@ -108,6 +110,7 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
String? shellPath,
|
String? shellPath,
|
||||||
bool updateGoldens = false,
|
bool updateGoldens = false,
|
||||||
bool pauseAfterLoad = false,
|
bool pauseAfterLoad = false,
|
||||||
|
bool nullAssertions = false,
|
||||||
required BuildInfo buildInfo,
|
required BuildInfo buildInfo,
|
||||||
required WebMemoryFS webMemoryFS,
|
required WebMemoryFS webMemoryFS,
|
||||||
required FileSystem fileSystem,
|
required FileSystem fileSystem,
|
||||||
@ -142,6 +145,7 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
chromiumLauncher: chromiumLauncher,
|
chromiumLauncher: chromiumLauncher,
|
||||||
artifacts: artifacts,
|
artifacts: artifacts,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
nullAssertions: nullAssertions,
|
||||||
processManager: processManager,
|
processManager: processManager,
|
||||||
testTimeRecorder: testTimeRecorder,
|
testTimeRecorder: testTimeRecorder,
|
||||||
);
|
);
|
||||||
@ -158,6 +162,12 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
: WebRendererMode.html;
|
: WebRendererMode.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NullSafetyMode get _nullSafetyMode {
|
||||||
|
return buildInfo.nullSafetyMode == NullSafetyMode.sound
|
||||||
|
? NullSafetyMode.sound
|
||||||
|
: NullSafetyMode.unsound;
|
||||||
|
}
|
||||||
|
|
||||||
final Configuration _config;
|
final Configuration _config;
|
||||||
final shelf.Server _server;
|
final shelf.Server _server;
|
||||||
Uri get url => _server.url;
|
Uri get url => _server.url;
|
||||||
@ -190,10 +200,10 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
));
|
));
|
||||||
|
|
||||||
File get _dartSdk => _fileSystem.file(
|
File get _dartSdk => _fileSystem.file(
|
||||||
_artifacts!.getHostArtifact(kDartSdkJsArtifactMap[_rendererMode]!));
|
_artifacts!.getHostArtifact(kDartSdkJsArtifactMap[_rendererMode]![_nullSafetyMode]!));
|
||||||
|
|
||||||
File get _dartSdkSourcemaps => _fileSystem.file(
|
File get _dartSdkSourcemaps => _fileSystem.file(
|
||||||
_artifacts!.getHostArtifact(kDartSdkJsMapArtifactMap[_rendererMode]!));
|
_artifacts!.getHostArtifact(kDartSdkJsMapArtifactMap[_rendererMode]![_nullSafetyMode]!));
|
||||||
|
|
||||||
/// The precompiled test javascript.
|
/// The precompiled test javascript.
|
||||||
File get _testDartJs => _fileSystem.file(_fileSystem.path.join(
|
File get _testDartJs => _fileSystem.file(_fileSystem.path.join(
|
||||||
@ -234,6 +244,7 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
final String leadingPath = request.url.path.split('.dart.bootstrap.js')[0];
|
final String leadingPath = request.url.path.split('.dart.bootstrap.js')[0];
|
||||||
final String generatedFile = '${_fileSystem.path.split(leadingPath).join('_')}.dart.test.dart.js';
|
final String generatedFile = '${_fileSystem.path.split(leadingPath).join('_')}.dart.test.dart.js';
|
||||||
return shelf.Response.ok(generateMainModule(
|
return shelf.Response.ok(generateMainModule(
|
||||||
|
nullAssertions: nullAssertions!,
|
||||||
nativeNullAssertions: true,
|
nativeNullAssertions: true,
|
||||||
bootstrapModule: '${_fileSystem.path.basename(leadingPath)}.dart.bootstrap',
|
bootstrapModule: '${_fileSystem.path.basename(leadingPath)}.dart.bootstrap',
|
||||||
entrypoint: '/$generatedFile'
|
entrypoint: '/$generatedFile'
|
||||||
|
@ -161,6 +161,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
|
|||||||
shellPath: shellPath,
|
shellPath: shellPath,
|
||||||
flutterProject: flutterProject,
|
flutterProject: flutterProject,
|
||||||
pauseAfterLoad: debuggingOptions.startPaused,
|
pauseAfterLoad: debuggingOptions.startPaused,
|
||||||
|
nullAssertions: debuggingOptions.nullAssertions,
|
||||||
buildInfo: debuggingOptions.buildInfo,
|
buildInfo: debuggingOptions.buildInfo,
|
||||||
webMemoryFS: result,
|
webMemoryFS: result,
|
||||||
logger: globals.logger,
|
logger: globals.logger,
|
||||||
|
@ -49,9 +49,24 @@ class WebTestCompiler {
|
|||||||
required List<String> testFiles,
|
required List<String> testFiles,
|
||||||
required BuildInfo buildInfo,
|
required BuildInfo buildInfo,
|
||||||
}) async {
|
}) async {
|
||||||
|
LanguageVersion languageVersion = LanguageVersion(2, 8);
|
||||||
|
late final String platformDillName;
|
||||||
|
|
||||||
|
// TODO(zanderso): to support autodetect this would need to partition the source code into
|
||||||
|
// a sound and unsound set and perform separate compilations
|
||||||
final List<String> extraFrontEndOptions = List<String>.of(buildInfo.extraFrontEndOptions);
|
final List<String> extraFrontEndOptions = List<String>.of(buildInfo.extraFrontEndOptions);
|
||||||
final LanguageVersion languageVersion = currentLanguageVersion(_fileSystem, Cache.flutterRoot!);
|
if (buildInfo.nullSafetyMode == NullSafetyMode.unsound || buildInfo.nullSafetyMode == NullSafetyMode.autodetect) {
|
||||||
const String platformDillName = 'ddc_outline_sound.dill';
|
platformDillName = 'ddc_outline.dill';
|
||||||
|
if (!extraFrontEndOptions.contains('--no-sound-null-safety')) {
|
||||||
|
extraFrontEndOptions.add('--no-sound-null-safety');
|
||||||
|
}
|
||||||
|
} else if (buildInfo.nullSafetyMode == NullSafetyMode.sound) {
|
||||||
|
languageVersion = currentLanguageVersion(_fileSystem, Cache.flutterRoot!);
|
||||||
|
platformDillName = 'ddc_outline_sound.dill';
|
||||||
|
if (!extraFrontEndOptions.contains('--sound-null-safety')) {
|
||||||
|
extraFrontEndOptions.add('--sound-null-safety');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final String platformDillPath = _fileSystem.path.join(
|
final String platformDillPath = _fileSystem.path.join(
|
||||||
getWebPlatformBinariesDirectory(_artifacts, buildInfo.webRenderer).path,
|
getWebPlatformBinariesDirectory(_artifacts, buildInfo.webRenderer).path,
|
||||||
|
@ -153,6 +153,7 @@ document.head.appendChild(requireEl);
|
|||||||
/// this object is the module.
|
/// this object is the module.
|
||||||
String generateMainModule({
|
String generateMainModule({
|
||||||
required String entrypoint,
|
required String entrypoint,
|
||||||
|
required bool nullAssertions,
|
||||||
required bool nativeNullAssertions,
|
required bool nativeNullAssertions,
|
||||||
String bootstrapModule = 'main_module.bootstrap',
|
String bootstrapModule = 'main_module.bootstrap',
|
||||||
}) {
|
}) {
|
||||||
@ -167,6 +168,7 @@ require.config({
|
|||||||
define("$bootstrapModule", ["$entrypoint", "dart_sdk"], function(app, dart_sdk) {
|
define("$bootstrapModule", ["$entrypoint", "dart_sdk"], function(app, dart_sdk) {
|
||||||
dart_sdk.dart.setStartAsyncSynchronously(true);
|
dart_sdk.dart.setStartAsyncSynchronously(true);
|
||||||
dart_sdk._debugger.registerDevtoolsFormatter();
|
dart_sdk._debugger.registerDevtoolsFormatter();
|
||||||
|
dart_sdk.dart.nonNullAsserts($nullAssertions);
|
||||||
dart_sdk.dart.nativeNonNullAsserts($nativeNullAssertions);
|
dart_sdk.dart.nativeNonNullAsserts($nativeNullAssertions);
|
||||||
|
|
||||||
// See the generateMainModule doc comment.
|
// See the generateMainModule doc comment.
|
||||||
|
@ -119,15 +119,33 @@ enum WebRendererMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The correct precompiled artifact to use for each build and render mode.
|
/// The correct precompiled artifact to use for each build and render mode.
|
||||||
const Map<WebRendererMode, HostArtifact> kDartSdkJsArtifactMap = <WebRendererMode, HostArtifact>{
|
const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsArtifactMap = <WebRendererMode, Map<NullSafetyMode, HostArtifact>>{
|
||||||
WebRendererMode.autoDetect: HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk,
|
WebRendererMode.autoDetect: <NullSafetyMode, HostArtifact> {
|
||||||
WebRendererMode.canvaskit: HostArtifact.webPrecompiledCanvaskitSoundSdk,
|
NullSafetyMode.sound: HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk,
|
||||||
WebRendererMode.html: HostArtifact.webPrecompiledSoundSdk,
|
NullSafetyMode.unsound: HostArtifact.webPrecompiledCanvaskitAndHtmlSdk,
|
||||||
|
},
|
||||||
|
WebRendererMode.canvaskit: <NullSafetyMode, HostArtifact> {
|
||||||
|
NullSafetyMode.sound: HostArtifact.webPrecompiledCanvaskitSoundSdk,
|
||||||
|
NullSafetyMode.unsound: HostArtifact.webPrecompiledCanvaskitSdk,
|
||||||
|
},
|
||||||
|
WebRendererMode.html: <NullSafetyMode, HostArtifact> {
|
||||||
|
NullSafetyMode.sound: HostArtifact.webPrecompiledSoundSdk,
|
||||||
|
NullSafetyMode.unsound: HostArtifact.webPrecompiledSdk,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The correct source map artifact to use for each build and render mode.
|
/// The correct source map artifact to use for each build and render mode.
|
||||||
const Map<WebRendererMode, HostArtifact> kDartSdkJsMapArtifactMap = <WebRendererMode, HostArtifact>{
|
const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsMapArtifactMap = <WebRendererMode, Map<NullSafetyMode, HostArtifact>>{
|
||||||
WebRendererMode.autoDetect: HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps,
|
WebRendererMode.autoDetect: <NullSafetyMode, HostArtifact> {
|
||||||
WebRendererMode.canvaskit: HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps,
|
NullSafetyMode.sound: HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps,
|
||||||
WebRendererMode.html: HostArtifact.webPrecompiledSoundSdkSourcemaps,
|
NullSafetyMode.unsound: HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps,
|
||||||
|
},
|
||||||
|
WebRendererMode.canvaskit: <NullSafetyMode, HostArtifact> {
|
||||||
|
NullSafetyMode.sound: HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps,
|
||||||
|
NullSafetyMode.unsound: HostArtifact.webPrecompiledCanvaskitSdkSourcemaps,
|
||||||
|
},
|
||||||
|
WebRendererMode.html: <NullSafetyMode, HostArtifact> {
|
||||||
|
NullSafetyMode.sound: HostArtifact.webPrecompiledSoundSdkSourcemaps,
|
||||||
|
NullSafetyMode.unsound: HostArtifact.webPrecompiledSdkSourcemaps,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
@ -66,6 +67,7 @@ void main() {
|
|||||||
final FakeFlutterVersion fakeFlutterVersion = FakeFlutterVersion(frameworkVersion: frameworkVersion);
|
final FakeFlutterVersion fakeFlutterVersion = FakeFlutterVersion(frameworkVersion: frameworkVersion);
|
||||||
|
|
||||||
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -95,6 +97,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -121,6 +124,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -162,6 +166,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -196,6 +201,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('contains license and version', () async {
|
testUsingContext('contains license and version', () async {
|
||||||
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -216,6 +222,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('debug URL', () async {
|
testUsingContext('debug URL', () async {
|
||||||
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -234,6 +241,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('profile URL', () async {
|
testUsingContext('profile URL', () async {
|
||||||
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -252,6 +260,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('release URL', () async {
|
testUsingContext('release URL', () async {
|
||||||
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
final BuildIOSFrameworkCommand command = BuildIOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -295,6 +304,7 @@ void main() {
|
|||||||
final FakeFlutterVersion fakeFlutterVersion = FakeFlutterVersion(frameworkVersion: frameworkVersion);
|
final FakeFlutterVersion fakeFlutterVersion = FakeFlutterVersion(frameworkVersion: frameworkVersion);
|
||||||
|
|
||||||
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -324,6 +334,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -350,6 +361,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -391,6 +403,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -425,6 +438,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('contains license and version', () async {
|
testUsingContext('contains license and version', () async {
|
||||||
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -445,6 +459,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('debug URL', () async {
|
testUsingContext('debug URL', () async {
|
||||||
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -463,6 +478,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('profile URL', () async {
|
testUsingContext('profile URL', () async {
|
||||||
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
@ -481,6 +497,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('release URL', () async {
|
testUsingContext('release URL', () async {
|
||||||
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
final BuildMacOSFrameworkCommand command = BuildMacOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
platform: fakePlatform,
|
platform: fakePlatform,
|
||||||
flutterVersion: fakeFlutterVersion,
|
flutterVersion: fakeFlutterVersion,
|
||||||
|
@ -6,6 +6,7 @@ import 'package:args/command_runner.dart';
|
|||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/android/android_sdk.dart';
|
import 'package:flutter_tools/src/android/android_sdk.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/os.dart';
|
import 'package:flutter_tools/src/base/os.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
@ -185,6 +186,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createCoreMockProjectFiles();
|
createCoreMockProjectFiles();
|
||||||
@ -204,6 +206,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createCoreMockProjectFiles();
|
createCoreMockProjectFiles();
|
||||||
@ -223,6 +226,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
@ -230,7 +234,7 @@ void main() {
|
|||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
final bool supported = BuildIOSCommand(verboseHelp: false).supported;
|
final bool supported = BuildIOSCommand(logger: BufferLogger.test(), verboseHelp: false).supported;
|
||||||
expect(createTestCommandRunner(command).run(
|
expect(createTestCommandRunner(command).run(
|
||||||
const <String>['build', 'ios', '--no-pub']
|
const <String>['build', 'ios', '--no-pub']
|
||||||
), supported ? throwsToolExit() : throwsA(isA<UsageException>()));
|
), supported ? throwsToolExit() : throwsA(isA<UsageException>()));
|
||||||
@ -246,6 +250,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -272,6 +277,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -298,6 +304,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -323,6 +330,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -348,6 +356,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -397,6 +406,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -427,6 +437,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -461,6 +472,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -494,6 +506,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -522,6 +535,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -556,6 +570,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -590,6 +605,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -626,6 +642,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -659,6 +676,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -696,6 +714,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -729,6 +748,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -763,6 +783,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -799,6 +820,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -833,6 +855,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -868,6 +891,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -905,6 +929,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import 'dart:typed_data';
|
|||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
@ -197,6 +198,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createCoreMockProjectFiles();
|
createCoreMockProjectFiles();
|
||||||
@ -216,6 +218,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createCoreMockProjectFiles();
|
createCoreMockProjectFiles();
|
||||||
@ -235,6 +238,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
@ -242,7 +246,7 @@ void main() {
|
|||||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
final bool supported = BuildIOSArchiveCommand(verboseHelp: false).supported;
|
final bool supported = BuildIOSArchiveCommand(logger: BufferLogger.test(), verboseHelp: false).supported;
|
||||||
expect(createTestCommandRunner(command).run(
|
expect(createTestCommandRunner(command).run(
|
||||||
const <String>['build', 'ipa', '--no-pub']
|
const <String>['build', 'ipa', '--no-pub']
|
||||||
), supported ? throwsToolExit() : throwsA(isA<UsageException>()));
|
), supported ? throwsToolExit() : throwsA(isA<UsageException>()));
|
||||||
@ -259,6 +263,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -287,6 +292,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -313,6 +319,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -341,6 +348,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -388,6 +396,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -436,6 +445,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -484,6 +494,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -531,6 +542,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -556,6 +568,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -604,6 +617,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -626,6 +640,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -682,6 +697,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -715,6 +731,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -745,6 +762,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -776,6 +794,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -809,6 +828,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -837,6 +857,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fakeProcessManager.addCommands(<FakeCommand>[
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
@ -888,6 +909,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -941,6 +963,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -990,6 +1013,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1028,6 +1052,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1108,6 +1133,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1186,6 +1212,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1244,6 +1271,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1302,6 +1330,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1360,6 +1389,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1419,6 +1449,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1522,6 +1553,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1601,6 +1633,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
@ -1678,6 +1711,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
|
@ -6,6 +6,7 @@ import 'package:args/command_runner.dart';
|
|||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/os.dart';
|
import 'package:flutter_tools/src/base/os.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/base/utils.dart';
|
import 'package:flutter_tools/src/base/utils.dart';
|
||||||
@ -112,6 +113,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockCoreProjectFiles();
|
setUpMockCoreProjectFiles();
|
||||||
@ -133,6 +135,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -152,6 +155,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -171,6 +175,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||||
@ -197,6 +202,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -219,6 +225,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -245,6 +252,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -275,6 +283,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -334,6 +343,7 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -367,6 +377,7 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -391,6 +402,7 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
|
osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -414,6 +426,7 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -438,6 +451,7 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
|
osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -461,6 +475,7 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
|
osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -477,6 +492,7 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -569,6 +585,7 @@ set(BINARY_NAME "fizz_bar")
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -579,14 +596,14 @@ set(BINARY_NAME "fizz_bar")
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('hidden when not enabled on Linux host', () {
|
testUsingContext('hidden when not enabled on Linux host', () {
|
||||||
expect(BuildLinuxCommand(operatingSystemUtils: FakeOperatingSystemUtils()).hidden, true);
|
expect(BuildLinuxCommand(logger: BufferLogger.test(), operatingSystemUtils: FakeOperatingSystemUtils()).hidden, true);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(),
|
FeatureFlags: () => TestFeatureFlags(),
|
||||||
Platform: () => notLinuxPlatform,
|
Platform: () => notLinuxPlatform,
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Not hidden when enabled and on Linux host', () {
|
testUsingContext('Not hidden when enabled and on Linux host', () {
|
||||||
expect(BuildLinuxCommand(operatingSystemUtils: FakeOperatingSystemUtils()).hidden, false);
|
expect(BuildLinuxCommand(logger: BufferLogger.test(), operatingSystemUtils: FakeOperatingSystemUtils()).hidden, false);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||||
Platform: () => linuxPlatform,
|
Platform: () => linuxPlatform,
|
||||||
@ -597,6 +614,7 @@ set(BINARY_NAME "fizz_bar")
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -647,6 +665,7 @@ set(BINARY_NAME "fizz_bar")
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
|
osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
|
||||||
);
|
);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
@ -142,6 +142,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createCoreMockProjectFiles();
|
createCoreMockProjectFiles();
|
||||||
@ -163,6 +164,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
@ -184,6 +186,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
@ -205,6 +208,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -234,6 +238,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -255,6 +260,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -277,6 +283,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -299,6 +306,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -320,6 +328,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -410,6 +419,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -431,6 +441,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -465,10 +476,11 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
));
|
));
|
||||||
|
|
||||||
final bool supported = BuildMacosCommand(verboseHelp: false).supported;
|
final bool supported = BuildMacosCommand(logger: BufferLogger.test(), verboseHelp: false).supported;
|
||||||
expect(() => runner.run(<String>['build', 'macos', '--no-pub']),
|
expect(() => runner.run(<String>['build', 'macos', '--no-pub']),
|
||||||
supported ? throwsToolExit() : throwsA(isA<UsageException>()));
|
supported ? throwsToolExit() : throwsA(isA<UsageException>()));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
@ -476,14 +488,14 @@ STDERR STUFF
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('hidden when not enabled on macOS host', () {
|
testUsingContext('hidden when not enabled on macOS host', () {
|
||||||
expect(BuildMacosCommand(verboseHelp: false).hidden, true);
|
expect(BuildMacosCommand(logger: BufferLogger.test(), verboseHelp: false).hidden, true);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(),
|
FeatureFlags: () => TestFeatureFlags(),
|
||||||
Platform: () => macosPlatform,
|
Platform: () => macosPlatform,
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Not hidden when enabled and on macOS host', () {
|
testUsingContext('Not hidden when enabled and on macOS host', () {
|
||||||
expect(BuildMacosCommand(verboseHelp: false).hidden, false);
|
expect(BuildMacosCommand(logger: BufferLogger.test(), verboseHelp: false).hidden, false);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||||
Platform: () => macosPlatform,
|
Platform: () => macosPlatform,
|
||||||
@ -494,6 +506,7 @@ STDERR STUFF
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build.dart';
|
import 'package:flutter_tools/src/commands/build.dart';
|
||||||
@ -43,6 +44,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
@ -64,6 +66,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
testLogger.printWarning('Warning: Mild annoyance Will Robinson!');
|
testLogger.printWarning('Warning: Mild annoyance Will Robinson!');
|
||||||
@ -85,6 +88,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
testLogger.printWarning('Warning: Mild annoyance Will Robinson!');
|
testLogger.printWarning('Warning: Mild annoyance Will Robinson!');
|
||||||
@ -103,6 +107,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
testLogger.printError('Error: Danger Will Robinson!');
|
testLogger.printError('Error: Danger Will Robinson!');
|
||||||
@ -142,10 +147,11 @@ class FakeBuildCommand extends BuildCommand {
|
|||||||
required super.fileSystem,
|
required super.fileSystem,
|
||||||
required super.buildSystem,
|
required super.buildSystem,
|
||||||
required super.osUtils,
|
required super.osUtils,
|
||||||
|
required Logger logger,
|
||||||
required super.androidSdk,
|
required super.androidSdk,
|
||||||
bool verboseHelp = false,
|
bool verboseHelp = false,
|
||||||
}) : super(verboseHelp: verboseHelp,) {
|
}) : super(logger: logger, verboseHelp: verboseHelp,) {
|
||||||
addSubcommand(FakeBuildSubcommand(verboseHelp: verboseHelp));
|
addSubcommand(FakeBuildSubcommand(logger: logger, verboseHelp: verboseHelp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -161,7 +167,7 @@ class FakeBuildCommand extends BuildCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FakeBuildSubcommand extends BuildSubCommand {
|
class FakeBuildSubcommand extends BuildSubCommand {
|
||||||
FakeBuildSubcommand({required super.verboseHelp});
|
FakeBuildSubcommand({required super.logger, required super.verboseHelp});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description => '';
|
String get description => '';
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
@ -49,6 +50,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -68,6 +70,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -84,6 +87,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -103,6 +107,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(buildCommand);
|
final CommandRunner<void> runner = createTestCommandRunner(buildCommand);
|
||||||
@ -143,6 +148,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(buildCommand);
|
final CommandRunner<void> runner = createTestCommandRunner(buildCommand);
|
||||||
@ -188,7 +194,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('hidden if feature flag is not enabled', () async {
|
testUsingContext('hidden if feature flag is not enabled', () async {
|
||||||
expect(BuildWebCommand(fileSystem: fileSystem, verboseHelp: false).hidden, true);
|
expect(BuildWebCommand(fileSystem: fileSystem, logger: BufferLogger.test(), verboseHelp: false).hidden, true);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Platform: () => fakePlatform,
|
Platform: () => fakePlatform,
|
||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
@ -197,7 +203,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('not hidden if feature flag is enabled', () async {
|
testUsingContext('not hidden if feature flag is enabled', () async {
|
||||||
expect(BuildWebCommand(fileSystem: fileSystem, verboseHelp: false).hidden, false);
|
expect(BuildWebCommand(fileSystem: fileSystem, logger: BufferLogger.test(), verboseHelp: false).hidden, false);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Platform: () => fakePlatform,
|
Platform: () => fakePlatform,
|
||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
@ -301,6 +307,7 @@ class TestWebBuildCommand extends FlutterCommand {
|
|||||||
TestWebBuildCommand({ required FileSystem fileSystem, bool verboseHelp = false }) :
|
TestWebBuildCommand({ required FileSystem fileSystem, bool verboseHelp = false }) :
|
||||||
webCommand = BuildWebCommand(
|
webCommand = BuildWebCommand(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
verboseHelp: verboseHelp) {
|
verboseHelp: verboseHelp) {
|
||||||
addSubcommand(webCommand);
|
addSubcommand(webCommand);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build_windows.dart';
|
import 'package:flutter_tools/src/commands/build_windows.dart';
|
||||||
@ -116,7 +117,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testUsingContext('Windows build fails when there is no cmake path', () async {
|
testUsingContext('Windows build fails when there is no cmake path', () async {
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = FakeVisualStudio(cmakePath: null);
|
..visualStudioOverride = FakeVisualStudio(cmakePath: null);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('Windows build fails when there is no windows project', () async {
|
testUsingContext('Windows build fails when there is no windows project', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockCoreProjectFiles();
|
setUpMockCoreProjectFiles();
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('Windows build fails on non windows platform', () async {
|
testUsingContext('Windows build fails on non windows platform', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -166,7 +167,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('Windows build fails when feature is disabled', () async {
|
testUsingContext('Windows build fails when feature is disabled', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -182,7 +183,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('Windows build does not spew stdout to status logger', () async {
|
testUsingContext('Windows build does not spew stdout to status logger', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -207,7 +208,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('Windows build extracts errors from stdout', () async {
|
testUsingContext('Windows build extracts errors from stdout', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -265,7 +266,7 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
|
|||||||
|
|
||||||
testUsingContext('Windows verbose build sets VERBOSE_SCRIPT_LOGGING', () async {
|
testUsingContext('Windows verbose build sets VERBOSE_SCRIPT_LOGGING', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -291,7 +292,7 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
|
|||||||
|
|
||||||
testUsingContext('Windows build works around CMake generation bug', () async {
|
testUsingContext('Windows build works around CMake generation bug', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio(displayVersion: '17.1.0');
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio(displayVersion: '17.1.0');
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -427,7 +428,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext('Windows build invokes build and writes generated files', () async {
|
testUsingContext('Windows build invokes build and writes generated files', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -497,7 +498,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext('Windows profile build passes Profile configuration', () async {
|
testUsingContext('Windows profile build passes Profile configuration', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -520,7 +521,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
const String generator = 'A different generator';
|
const String generator = 'A different generator';
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio(
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio(
|
||||||
cmakeGenerator: generator);
|
cmakeGenerator: generator);
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -541,7 +542,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext("Windows build uses pubspec's version", () async {
|
testUsingContext("Windows build uses pubspec's version", () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -587,7 +588,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext('Windows build uses build-name and build-number', () async {
|
testUsingContext('Windows build uses build-name and build-number', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -631,7 +632,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext('Windows build build-name overrides pubspec', () async {
|
testUsingContext('Windows build build-name overrides pubspec', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -678,7 +679,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext('Windows build build-number overrides pubspec', () async {
|
testUsingContext('Windows build build-number overrides pubspec', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -725,7 +726,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext('Windows build build-name and build-number override pubspec', () async {
|
testUsingContext('Windows build build-name and build-number override pubspec', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -773,7 +774,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext('Windows build warns on non-numeric build-number', () async {
|
testUsingContext('Windows build warns on non-numeric build-number', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -823,7 +824,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext('Windows build warns on complex build-number', () async {
|
testUsingContext('Windows build warns on complex build-number', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -872,14 +873,14 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('hidden when not enabled on Windows host', () {
|
testUsingContext('hidden when not enabled on Windows host', () {
|
||||||
expect(BuildWindowsCommand().hidden, true);
|
expect(BuildWindowsCommand(logger: BufferLogger.test()).hidden, true);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(),
|
FeatureFlags: () => TestFeatureFlags(),
|
||||||
Platform: () => windowsPlatform,
|
Platform: () => windowsPlatform,
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Not hidden when enabled and on Windows host', () {
|
testUsingContext('Not hidden when enabled and on Windows host', () {
|
||||||
expect(BuildWindowsCommand().hidden, false);
|
expect(BuildWindowsCommand(logger: BufferLogger.test()).hidden, false);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||||
Platform: () => windowsPlatform,
|
Platform: () => windowsPlatform,
|
||||||
@ -887,7 +888,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
|
|
||||||
testUsingContext('Performs code size analysis and sends analytics', () async {
|
testUsingContext('Performs code size analysis and sends analytics', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
|
|
||||||
@ -939,7 +940,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
|||||||
// is resolved on the VS side, we can allow these paths again
|
// is resolved on the VS side, we can allow these paths again
|
||||||
testUsingContext('Test bad path characters', () async {
|
testUsingContext('Test bad path characters', () async {
|
||||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||||
final BuildWindowsCommand command = BuildWindowsCommand()
|
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||||
..visualStudioOverride = fakeVisualStudio;
|
..visualStudioOverride = fakeVisualStudio;
|
||||||
fileSystem.currentDirectory = fileSystem.directory("test_'path")
|
fileSystem.currentDirectory = fileSystem.directory("test_'path")
|
||||||
..createSync();
|
..createSync();
|
||||||
|
@ -381,6 +381,7 @@ void main() {
|
|||||||
'--trace-skia',
|
'--trace-skia',
|
||||||
'--trace-systrace',
|
'--trace-systrace',
|
||||||
'--verbose-system-logs',
|
'--verbose-system-logs',
|
||||||
|
'--null-assertions',
|
||||||
'--native-null-assertions',
|
'--native-null-assertions',
|
||||||
'--enable-impeller',
|
'--enable-impeller',
|
||||||
'--trace-systrace',
|
'--trace-systrace',
|
||||||
@ -396,6 +397,7 @@ void main() {
|
|||||||
expect(options.traceSkia, true);
|
expect(options.traceSkia, true);
|
||||||
expect(options.traceSystrace, true);
|
expect(options.traceSystrace, true);
|
||||||
expect(options.verboseSystemLogs, true);
|
expect(options.verboseSystemLogs, true);
|
||||||
|
expect(options.nullAssertions, true);
|
||||||
expect(options.nativeNullAssertions, true);
|
expect(options.nativeNullAssertions, true);
|
||||||
expect(options.enableImpeller, true);
|
expect(options.enableImpeller, true);
|
||||||
expect(options.traceSystrace, true);
|
expect(options.traceSystrace, true);
|
||||||
|
@ -1005,6 +1005,7 @@ void main() {
|
|||||||
'--trace-skia',
|
'--trace-skia',
|
||||||
'--trace-systrace',
|
'--trace-systrace',
|
||||||
'--verbose-system-logs',
|
'--verbose-system-logs',
|
||||||
|
'--null-assertions',
|
||||||
'--native-null-assertions',
|
'--native-null-assertions',
|
||||||
'--enable-impeller',
|
'--enable-impeller',
|
||||||
'--trace-systrace',
|
'--trace-systrace',
|
||||||
@ -1021,6 +1022,7 @@ void main() {
|
|||||||
expect(options.traceSkia, true);
|
expect(options.traceSkia, true);
|
||||||
expect(options.traceSystrace, true);
|
expect(options.traceSystrace, true);
|
||||||
expect(options.verboseSystemLogs, true);
|
expect(options.verboseSystemLogs, true);
|
||||||
|
expect(options.nullAssertions, true);
|
||||||
expect(options.nativeNullAssertions, true);
|
expect(options.nativeNullAssertions, true);
|
||||||
expect(options.traceSystrace, true);
|
expect(options.traceSystrace, true);
|
||||||
expect(options.enableImpeller, true);
|
expect(options.enableImpeller, true);
|
||||||
|
@ -7,6 +7,7 @@ import 'package:flutter_tools/src/android/android_builder.dart';
|
|||||||
import 'package:flutter_tools/src/android/android_sdk.dart';
|
import 'package:flutter_tools/src/android/android_sdk.dart';
|
||||||
import 'package:flutter_tools/src/android/android_studio.dart';
|
import 'package:flutter_tools/src/android/android_studio.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build_aar.dart';
|
import 'package:flutter_tools/src/commands/build_aar.dart';
|
||||||
@ -30,6 +31,7 @@ void main() {
|
|||||||
final BuildAarCommand command = BuildAarCommand(
|
final BuildAarCommand command = BuildAarCommand(
|
||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
fileSystem: globals.fs,
|
fileSystem: globals.fs,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
verboseHelp: false,
|
verboseHelp: false,
|
||||||
);
|
);
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
@ -187,6 +189,7 @@ void main() {
|
|||||||
expect(buildInfo.splitDebugInfoPath, '/project-name/v1.2.3/');
|
expect(buildInfo.splitDebugInfoPath, '/project-name/v1.2.3/');
|
||||||
expect(buildInfo.dartObfuscation, isTrue);
|
expect(buildInfo.dartObfuscation, isTrue);
|
||||||
expect(buildInfo.dartDefines.contains('foo=bar'), isTrue);
|
expect(buildInfo.dartDefines.contains('foo=bar'), isTrue);
|
||||||
|
expect(buildInfo.nullSafetyMode, NullSafetyMode.sound);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
AndroidBuilder: () => fakeAndroidBuilder,
|
AndroidBuilder: () => fakeAndroidBuilder,
|
||||||
});
|
});
|
||||||
@ -306,6 +309,7 @@ Future<BuildAarCommand> runBuildAarCommand(
|
|||||||
final BuildAarCommand command = BuildAarCommand(
|
final BuildAarCommand command = BuildAarCommand(
|
||||||
androidSdk: androidSdk,
|
androidSdk: androidSdk,
|
||||||
fileSystem: globals.fs,
|
fileSystem: globals.fs,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
verboseHelp: false,
|
verboseHelp: false,
|
||||||
);
|
);
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
@ -7,6 +7,7 @@ import 'package:flutter_tools/src/android/android_builder.dart';
|
|||||||
import 'package:flutter_tools/src/android/android_sdk.dart';
|
import 'package:flutter_tools/src/android/android_sdk.dart';
|
||||||
import 'package:flutter_tools/src/android/android_studio.dart';
|
import 'package:flutter_tools/src/android/android_studio.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build_apk.dart';
|
import 'package:flutter_tools/src/commands/build_apk.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||||
@ -429,7 +430,7 @@ Future<BuildApkCommand> runBuildApkCommand(
|
|||||||
String target, {
|
String target, {
|
||||||
List<String>? arguments,
|
List<String>? arguments,
|
||||||
}) async {
|
}) async {
|
||||||
final BuildApkCommand command = BuildApkCommand();
|
final BuildApkCommand command = BuildApkCommand(logger: BufferLogger.test());
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'apk',
|
'apk',
|
||||||
|
@ -6,6 +6,7 @@ import 'package:args/command_runner.dart';
|
|||||||
import 'package:flutter_tools/src/android/android_builder.dart';
|
import 'package:flutter_tools/src/android/android_builder.dart';
|
||||||
import 'package:flutter_tools/src/android/android_sdk.dart';
|
import 'package:flutter_tools/src/android/android_sdk.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build_appbundle.dart';
|
import 'package:flutter_tools/src/commands/build_appbundle.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||||
@ -213,7 +214,7 @@ Future<BuildAppBundleCommand> runBuildAppBundleCommand(
|
|||||||
String target, {
|
String target, {
|
||||||
List<String>? arguments,
|
List<String>? arguments,
|
||||||
}) async {
|
}) async {
|
||||||
final BuildAppBundleCommand command = BuildAppBundleCommand();
|
final BuildAppBundleCommand command = BuildAppBundleCommand(logger: BufferLogger.test());
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'appbundle',
|
'appbundle',
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/bundle.dart';
|
import 'package:flutter_tools/src/bundle.dart';
|
||||||
@ -46,6 +47,7 @@ void main() {
|
|||||||
|
|
||||||
Future<BuildBundleCommand> runCommandIn(String projectPath, { List<String>? arguments }) async {
|
Future<BuildBundleCommand> runCommandIn(String projectPath, { List<String>? arguments }) async {
|
||||||
final BuildBundleCommand command = BuildBundleCommand(
|
final BuildBundleCommand command = BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
bundleBuilder: fakeBundleBuilder,
|
bundleBuilder: fakeBundleBuilder,
|
||||||
);
|
);
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
@ -89,7 +91,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync(recursive: true);
|
globals.fs.file('pubspec.yaml').createSync(recursive: true);
|
||||||
globals.fs.file('.packages').createSync(recursive: true);
|
globals.fs.file('.packages').createSync(recursive: true);
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
expect(() => runner.run(<String>[
|
expect(() => runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -107,7 +111,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
expect(() => runner.run(<String>[
|
expect(() => runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -125,7 +131,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
expect(() => runner.run(<String>[
|
expect(() => runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -143,7 +151,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
expect(() => runner.run(<String>[
|
expect(() => runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -160,7 +170,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -178,7 +190,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -196,7 +210,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -214,7 +230,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -244,7 +262,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -275,7 +295,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -305,7 +327,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -336,7 +360,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -367,7 +393,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -398,7 +426,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -437,7 +467,9 @@ void main() {
|
|||||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -493,7 +525,9 @@ void main() {
|
|||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
);
|
);
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -530,7 +564,9 @@ void main() {
|
|||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
);
|
);
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
await runner.run(<String>[
|
await runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -551,7 +587,9 @@ void main() {
|
|||||||
globals.fs.file('pubspec.yaml').createSync();
|
globals.fs.file('pubspec.yaml').createSync();
|
||||||
globals.fs.file('.packages').createSync();
|
globals.fs.file('.packages').createSync();
|
||||||
globals.fs.directory('config').createSync();
|
globals.fs.directory('config').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
expect(() => runner.run(<String>[
|
expect(() => runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
@ -578,7 +616,9 @@ void main() {
|
|||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
);
|
);
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
));
|
||||||
|
|
||||||
expect(() => runner.run(<String>[
|
expect(() => runner.run(<String>[
|
||||||
'bundle',
|
'bundle',
|
||||||
|
@ -9,6 +9,7 @@ import 'package:flutter_tools/src/android/android_workflow.dart';
|
|||||||
import 'package:flutter_tools/src/base/config.dart';
|
import 'package:flutter_tools/src/base/config.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/base/time.dart';
|
import 'package:flutter_tools/src/base/time.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
@ -219,6 +220,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
final FlutterCommand buildApkCommand = buildCommand.subcommands['apk']! as FlutterCommand;
|
final FlutterCommand buildApkCommand = buildCommand.subcommands['apk']! as FlutterCommand;
|
||||||
|
@ -250,7 +250,7 @@ void main() {
|
|||||||
'--ez', 'verify-entry-points', 'true',
|
'--ez', 'verify-entry-points', 'true',
|
||||||
'--ez', 'start-paused', 'true',
|
'--ez', 'start-paused', 'true',
|
||||||
'--ez', 'disable-service-auth-codes', 'true',
|
'--ez', 'disable-service-auth-codes', 'true',
|
||||||
'--es', 'dart-flags', 'foo',
|
'--es', 'dart-flags', 'foo,--null_assertions',
|
||||||
'--ez', 'use-test-fonts', 'true',
|
'--ez', 'use-test-fonts', 'true',
|
||||||
'--ez', 'verbose-logging', 'true',
|
'--ez', 'verbose-logging', 'true',
|
||||||
'--user', '10',
|
'--user', '10',
|
||||||
@ -278,6 +278,7 @@ void main() {
|
|||||||
purgePersistentCache: true,
|
purgePersistentCache: true,
|
||||||
useTestFonts: true,
|
useTestFonts: true,
|
||||||
verboseSystemLogs: true,
|
verboseSystemLogs: true,
|
||||||
|
nullAssertions: true,
|
||||||
enableImpeller: true,
|
enableImpeller: true,
|
||||||
),
|
),
|
||||||
platformArgs: <String, dynamic>{},
|
platformArgs: <String, dynamic>{},
|
||||||
|
@ -152,6 +152,22 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('precompiled web artifact paths are correct', () {
|
testWithoutContext('precompiled web artifact paths are correct', () {
|
||||||
|
expect(
|
||||||
|
artifacts.getHostArtifact(HostArtifact.webPrecompiledSdk).path,
|
||||||
|
'root/bin/cache/flutter_web_sdk/kernel/amd/dart_sdk.js',
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
artifacts.getHostArtifact(HostArtifact.webPrecompiledSdkSourcemaps).path,
|
||||||
|
'root/bin/cache/flutter_web_sdk/kernel/amd/dart_sdk.js.map',
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
artifacts.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdk).path,
|
||||||
|
'root/bin/cache/flutter_web_sdk/kernel/amd-canvaskit/dart_sdk.js',
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
artifacts.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdkSourcemaps).path,
|
||||||
|
'root/bin/cache/flutter_web_sdk/kernel/amd-canvaskit/dart_sdk.js.map',
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.webPrecompiledSoundSdk).path,
|
artifacts.getHostArtifact(HostArtifact.webPrecompiledSoundSdk).path,
|
||||||
'root/bin/cache/flutter_web_sdk/kernel/amd-sound/dart_sdk.js',
|
'root/bin/cache/flutter_web_sdk/kernel/amd-sound/dart_sdk.js',
|
||||||
|
@ -2,13 +2,29 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:args/args.dart';
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
|
import 'package:flutter_tools/src/artifacts.dart';
|
||||||
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
|
import 'package:flutter_tools/src/base/signals.dart';
|
||||||
import 'package:flutter_tools/src/base/terminal.dart';
|
import 'package:flutter_tools/src/base/terminal.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/attach.dart';
|
||||||
import 'package:flutter_tools/src/commands/build.dart';
|
import 'package:flutter_tools/src/commands/build.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/build_aar.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/build_apk.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/build_appbundle.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/build_ios.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/build_ios_framework.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/build_linux.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/build_macos.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/build_web.dart';
|
||||||
|
import 'package:flutter_tools/src/commands/build_windows.dart';
|
||||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
|
|
||||||
@ -30,11 +46,78 @@ class FakeProcessInfo extends Fake implements ProcessInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
testUsingContext('All build commands support null safety options', () {
|
||||||
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
|
final Platform platform = FakePlatform();
|
||||||
|
final BufferLogger logger = BufferLogger.test();
|
||||||
|
final List<FlutterCommand> commands = <FlutterCommand>[
|
||||||
|
BuildWindowsCommand(logger: BufferLogger.test()),
|
||||||
|
BuildLinuxCommand(logger: BufferLogger.test(), operatingSystemUtils: FakeOperatingSystemUtils()),
|
||||||
|
BuildMacosCommand(logger: BufferLogger.test(), verboseHelp: false),
|
||||||
|
BuildWebCommand(fileSystem: fileSystem, logger: BufferLogger.test(), verboseHelp: false),
|
||||||
|
BuildApkCommand(logger: BufferLogger.test()),
|
||||||
|
BuildIOSCommand(logger: BufferLogger.test(), verboseHelp: false),
|
||||||
|
BuildIOSArchiveCommand(logger: BufferLogger.test(), verboseHelp: false),
|
||||||
|
BuildAppBundleCommand(logger: BufferLogger.test()),
|
||||||
|
BuildAarCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
androidSdk: FakeAndroidSdk(),
|
||||||
|
fileSystem: fileSystem,
|
||||||
|
verboseHelp: false,
|
||||||
|
),
|
||||||
|
BuildIOSFrameworkCommand(
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
verboseHelp: false,
|
||||||
|
buildSystem: FlutterBuildSystem(
|
||||||
|
fileSystem: fileSystem,
|
||||||
|
platform: platform,
|
||||||
|
logger: logger,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
AttachCommand(
|
||||||
|
artifacts: Artifacts.test(),
|
||||||
|
stdio: FakeStdio(),
|
||||||
|
logger: logger,
|
||||||
|
terminal: FakeTerminal(),
|
||||||
|
signals: Signals.test(),
|
||||||
|
platform: platform,
|
||||||
|
processInfo: FakeProcessInfo(),
|
||||||
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
for (final FlutterCommand command in commands) {
|
||||||
|
final ArgResults results = command.argParser.parse(<String>[
|
||||||
|
'--sound-null-safety',
|
||||||
|
'--enable-experiment=non-nullable',
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(results.wasParsed('sound-null-safety'), true);
|
||||||
|
expect(results.wasParsed('enable-experiment'), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('BuildSubCommand displays current null safety mode',
|
||||||
|
() async {
|
||||||
|
const BuildInfo unsound = BuildInfo(
|
||||||
|
BuildMode.debug,
|
||||||
|
'',
|
||||||
|
nullSafetyMode: NullSafetyMode.unsound,
|
||||||
|
treeShakeIcons: false,
|
||||||
|
);
|
||||||
|
|
||||||
|
final BufferLogger logger = BufferLogger.test();
|
||||||
|
FakeBuildSubCommand(logger).test(unsound);
|
||||||
|
expect(logger.statusText,
|
||||||
|
contains('Building without sound null safety ⚠️'));
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('Include only supported sub commands', () {
|
testUsingContext('Include only supported sub commands', () {
|
||||||
final BuildCommand command = BuildCommand(
|
final BuildCommand command = BuildCommand(
|
||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
for (final Command<void> x in command.subcommands.values) {
|
for (final Command<void> x in command.subcommands.values) {
|
||||||
@ -44,7 +127,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FakeBuildSubCommand extends BuildSubCommand {
|
class FakeBuildSubCommand extends BuildSubCommand {
|
||||||
FakeBuildSubCommand() : super(verboseHelp: false);
|
FakeBuildSubCommand(Logger logger) : super(logger: logger, verboseHelp: false);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description => throw UnimplementedError();
|
String get description => throw UnimplementedError();
|
||||||
@ -53,8 +136,7 @@ class FakeBuildSubCommand extends BuildSubCommand {
|
|||||||
String get name => throw UnimplementedError();
|
String get name => throw UnimplementedError();
|
||||||
|
|
||||||
void test(BuildInfo buildInfo) {
|
void test(BuildInfo buildInfo) {
|
||||||
throw UnimplementedError('TODO what should we do here?');
|
displayNullSafetyMode(buildInfo);
|
||||||
//displayNullSafetyMode(buildInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -159,9 +159,10 @@ void main() {
|
|||||||
'FLUTTER_ENGINE_SWITCH_14': 'verify-entry-points=true',
|
'FLUTTER_ENGINE_SWITCH_14': 'verify-entry-points=true',
|
||||||
'FLUTTER_ENGINE_SWITCH_15': 'start-paused=true',
|
'FLUTTER_ENGINE_SWITCH_15': 'start-paused=true',
|
||||||
'FLUTTER_ENGINE_SWITCH_16': 'disable-service-auth-codes=true',
|
'FLUTTER_ENGINE_SWITCH_16': 'disable-service-auth-codes=true',
|
||||||
'FLUTTER_ENGINE_SWITCH_17': 'use-test-fonts=true',
|
'FLUTTER_ENGINE_SWITCH_17': 'dart-flags=--null_assertions',
|
||||||
'FLUTTER_ENGINE_SWITCH_18': 'verbose-logging=true',
|
'FLUTTER_ENGINE_SWITCH_18': 'use-test-fonts=true',
|
||||||
'FLUTTER_ENGINE_SWITCHES': '18',
|
'FLUTTER_ENGINE_SWITCH_19': 'verbose-logging=true',
|
||||||
|
'FLUTTER_ENGINE_SWITCHES': '19',
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
@ -189,6 +190,7 @@ void main() {
|
|||||||
purgePersistentCache: true,
|
purgePersistentCache: true,
|
||||||
useTestFonts: true,
|
useTestFonts: true,
|
||||||
verboseSystemLogs: true,
|
verboseSystemLogs: true,
|
||||||
|
nullAssertions: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -701,9 +701,11 @@ void main() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('computeDartVmFlags handles various combinations of Dart VM flags', () {
|
testWithoutContext('computeDartVmFlags handles various combinations of Dart VM flags and null_assertions', () {
|
||||||
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug)), '');
|
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug)), '');
|
||||||
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '--foo')), '--foo');
|
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '--foo')), '--foo');
|
||||||
|
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, nullAssertions: true)), '--null_assertions');
|
||||||
|
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '--foo', nullAssertions: true)), '--foo,--null_assertions');
|
||||||
});
|
});
|
||||||
|
|
||||||
group('JSON encode DebuggingOptions', () {
|
group('JSON encode DebuggingOptions', () {
|
||||||
@ -755,6 +757,7 @@ void main() {
|
|||||||
cacheSkSL: true,
|
cacheSkSL: true,
|
||||||
purgePersistentCache: true,
|
purgePersistentCache: true,
|
||||||
verboseSystemLogs: true,
|
verboseSystemLogs: true,
|
||||||
|
nullAssertions: true,
|
||||||
enableImpeller: true,
|
enableImpeller: true,
|
||||||
deviceVmServicePort: 0,
|
deviceVmServicePort: 0,
|
||||||
hostVmServicePort: 1,
|
hostVmServicePort: 1,
|
||||||
@ -775,7 +778,7 @@ void main() {
|
|||||||
'--disable-service-auth-codes',
|
'--disable-service-auth-codes',
|
||||||
'--disable-vm-service-publication',
|
'--disable-vm-service-publication',
|
||||||
'--start-paused',
|
'--start-paused',
|
||||||
'--dart-flags="--foo"',
|
'--dart-flags="--foo,--null_assertions"',
|
||||||
'--use-test-fonts',
|
'--use-test-fonts',
|
||||||
'--enable-checked-mode',
|
'--enable-checked-mode',
|
||||||
'--verify-entry-points',
|
'--verify-entry-points',
|
||||||
@ -914,6 +917,7 @@ void main() {
|
|||||||
cacheSkSL: true,
|
cacheSkSL: true,
|
||||||
purgePersistentCache: true,
|
purgePersistentCache: true,
|
||||||
verboseSystemLogs: true,
|
verboseSystemLogs: true,
|
||||||
|
nullAssertions: true,
|
||||||
enableImpeller: true,
|
enableImpeller: true,
|
||||||
deviceVmServicePort: 0,
|
deviceVmServicePort: 0,
|
||||||
hostVmServicePort: 1,
|
hostVmServicePort: 1,
|
||||||
@ -934,7 +938,7 @@ void main() {
|
|||||||
'--disable-service-auth-codes',
|
'--disable-service-auth-codes',
|
||||||
'--disable-vm-service-publication',
|
'--disable-vm-service-publication',
|
||||||
'--start-paused',
|
'--start-paused',
|
||||||
'--dart-flags=--foo',
|
'--dart-flags=--foo,--null_assertions',
|
||||||
'--use-test-fonts',
|
'--use-test-fonts',
|
||||||
'--enable-checked-mode',
|
'--enable-checked-mode',
|
||||||
'--verify-entry-points',
|
'--verify-entry-points',
|
||||||
|
@ -337,7 +337,7 @@ void main() {
|
|||||||
'--disable-service-auth-codes',
|
'--disable-service-auth-codes',
|
||||||
'--disable-vm-service-publication',
|
'--disable-vm-service-publication',
|
||||||
'--start-paused',
|
'--start-paused',
|
||||||
'--dart-flags="--foo"',
|
'--dart-flags="--foo,--null_assertions"',
|
||||||
'--use-test-fonts',
|
'--use-test-fonts',
|
||||||
'--enable-checked-mode',
|
'--enable-checked-mode',
|
||||||
'--verify-entry-points',
|
'--verify-entry-points',
|
||||||
@ -404,6 +404,7 @@ void main() {
|
|||||||
cacheSkSL: true,
|
cacheSkSL: true,
|
||||||
purgePersistentCache: true,
|
purgePersistentCache: true,
|
||||||
verboseSystemLogs: true,
|
verboseSystemLogs: true,
|
||||||
|
nullAssertions: true,
|
||||||
enableImpeller: true,
|
enableImpeller: true,
|
||||||
enableEmbedderApi: true,
|
enableEmbedderApi: true,
|
||||||
),
|
),
|
||||||
|
@ -1041,6 +1041,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
|
|||||||
cacheSkSL: true,
|
cacheSkSL: true,
|
||||||
purgePersistentCache: true,
|
purgePersistentCache: true,
|
||||||
dartFlags: '--baz',
|
dartFlags: '--baz',
|
||||||
|
nullAssertions: true,
|
||||||
enableImpeller: true,
|
enableImpeller: true,
|
||||||
hostVmServicePort: 0,
|
hostVmServicePort: 0,
|
||||||
);
|
);
|
||||||
@ -1064,7 +1065,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
|
|||||||
'--verbose-logging',
|
'--verbose-logging',
|
||||||
'--cache-sksl',
|
'--cache-sksl',
|
||||||
'--purge-persistent-cache',
|
'--purge-persistent-cache',
|
||||||
'--dart-flags=--baz',
|
'--dart-flags=--baz,--null_assertions',
|
||||||
'--enable-impeller',
|
'--enable-impeller',
|
||||||
'--vm-service-port=0',
|
'--vm-service-port=0',
|
||||||
]));
|
]));
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/doctor_validator.dart';
|
import 'package:flutter_tools/src/doctor_validator.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
|
import 'package:package_config/package_config.dart';
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
|
|
||||||
@ -54,6 +56,74 @@ void main() {
|
|||||||
const TestUsageEvent('doctor-result', 'FakeGroupedValidator', label: 'crash'),
|
const TestUsageEvent('doctor-result', 'FakeGroupedValidator', label: 'crash'),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWithoutContext('Reports null safe analytics events', () {
|
||||||
|
final TestUsage usage = TestUsage();
|
||||||
|
final PackageConfig packageConfig = PackageConfig(<Package>[
|
||||||
|
Package('foo', Uri.parse('file:///foo/'), languageVersion: LanguageVersion(2, 12)),
|
||||||
|
Package('bar', Uri.parse('file:///fizz/'), languageVersion: LanguageVersion(2, 1)),
|
||||||
|
Package('baz', Uri.parse('file:///bar/'), languageVersion: LanguageVersion(2, 2)),
|
||||||
|
]);
|
||||||
|
|
||||||
|
NullSafetyAnalysisEvent(
|
||||||
|
packageConfig,
|
||||||
|
NullSafetyMode.sound,
|
||||||
|
'foo',
|
||||||
|
usage,
|
||||||
|
).send();
|
||||||
|
|
||||||
|
expect(usage.events, unorderedEquals(<TestUsageEvent>[
|
||||||
|
const TestUsageEvent(NullSafetyAnalysisEvent.kNullSafetyCategory, 'runtime-mode', label: 'NullSafetyMode.sound'),
|
||||||
|
TestUsageEvent(NullSafetyAnalysisEvent.kNullSafetyCategory, 'stats', parameters: CustomDimensions.fromMap(<String, String>{
|
||||||
|
'cd49': '1', 'cd50': '3',
|
||||||
|
})),
|
||||||
|
const TestUsageEvent(NullSafetyAnalysisEvent.kNullSafetyCategory, 'language-version', label: '2.12'),
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
|
||||||
|
testWithoutContext('Does not crash if main package is missing', () {
|
||||||
|
final TestUsage usage = TestUsage();
|
||||||
|
final PackageConfig packageConfig = PackageConfig(<Package>[
|
||||||
|
Package('foo', Uri.parse('file:///foo/lib/'), languageVersion: LanguageVersion(2, 12)),
|
||||||
|
Package('bar', Uri.parse('file:///fizz/lib/'), languageVersion: LanguageVersion(2, 1)),
|
||||||
|
Package('baz', Uri.parse('file:///bar/lib/'), languageVersion: LanguageVersion(2, 2)),
|
||||||
|
]);
|
||||||
|
|
||||||
|
NullSafetyAnalysisEvent(
|
||||||
|
packageConfig,
|
||||||
|
NullSafetyMode.sound,
|
||||||
|
'something-unrelated',
|
||||||
|
usage,
|
||||||
|
).send();
|
||||||
|
|
||||||
|
expect(usage.events, unorderedEquals(<TestUsageEvent>[
|
||||||
|
const TestUsageEvent(NullSafetyAnalysisEvent.kNullSafetyCategory, 'runtime-mode', label: 'NullSafetyMode.sound'),
|
||||||
|
TestUsageEvent(NullSafetyAnalysisEvent.kNullSafetyCategory, 'stats', parameters: CustomDimensions.fromMap(<String, String>{
|
||||||
|
'cd49': '1', 'cd50': '3',
|
||||||
|
})),
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
|
||||||
|
testWithoutContext('a null language version is treated as unmigrated', () {
|
||||||
|
final TestUsage usage = TestUsage();
|
||||||
|
final PackageConfig packageConfig = PackageConfig(<Package>[
|
||||||
|
Package('foo', Uri.parse('file:///foo/lib/')),
|
||||||
|
]);
|
||||||
|
|
||||||
|
NullSafetyAnalysisEvent(
|
||||||
|
packageConfig,
|
||||||
|
NullSafetyMode.sound,
|
||||||
|
'something-unrelated',
|
||||||
|
usage,
|
||||||
|
).send();
|
||||||
|
|
||||||
|
expect(usage.events, unorderedEquals(<TestUsageEvent>[
|
||||||
|
const TestUsageEvent(NullSafetyAnalysisEvent.kNullSafetyCategory, 'runtime-mode', label: 'NullSafetyMode.sound'),
|
||||||
|
TestUsageEvent(NullSafetyAnalysisEvent.kNullSafetyCategory, 'stats', parameters: CustomDimensions.fromMap(<String, String>{
|
||||||
|
'cd49': '0', 'cd50': '1',
|
||||||
|
})),
|
||||||
|
]));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class FakeGroupedValidator extends GroupedValidator {
|
class FakeGroupedValidator extends GroupedValidator {
|
||||||
|
@ -1960,13 +1960,45 @@ flutter:
|
|||||||
BuildMode.debug,
|
BuildMode.debug,
|
||||||
'',
|
'',
|
||||||
treeShakeIcons: false,
|
treeShakeIcons: false,
|
||||||
|
nullSafetyMode: NullSafetyMode.unsound,
|
||||||
),
|
),
|
||||||
target: null,
|
target: null,
|
||||||
platform: FakePlatform(),
|
platform: FakePlatform(),
|
||||||
)).generator as DefaultResidentCompiler?;
|
)).generator as DefaultResidentCompiler?;
|
||||||
|
|
||||||
expect(residentCompiler!.initializeFromDill,
|
expect(residentCompiler!.initializeFromDill,
|
||||||
globals.fs.path.join(getBuildDirectory(), 'cache.dill'));
|
globals.fs.path.join(getBuildDirectory(), 'fbbe6a61fb7a1de317d381f8df4814e5.cache.dill'));
|
||||||
|
expect(residentCompiler.librariesSpec,
|
||||||
|
globals.fs.file(globals.artifacts!.getHostArtifact(HostArtifact.flutterWebLibrariesJson))
|
||||||
|
.uri.toString());
|
||||||
|
expect(residentCompiler.targetModel, TargetModel.dartdevc);
|
||||||
|
expect(residentCompiler.sdkRoot,
|
||||||
|
'${globals.artifacts!.getHostArtifact(HostArtifact.flutterWebSdk).path}/');
|
||||||
|
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformKernelFolder/ddc_outline.dill');
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => Artifacts.test(),
|
||||||
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('FlutterDevice uses dartdevc configuration when targeting web with null-safety autodetected', () async {
|
||||||
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
||||||
|
final FakeDevice device = FakeDevice(targetPlatform: TargetPlatform.web_javascript);
|
||||||
|
|
||||||
|
final DefaultResidentCompiler? residentCompiler = (await FlutterDevice.create(
|
||||||
|
device,
|
||||||
|
buildInfo: const BuildInfo(
|
||||||
|
BuildMode.debug,
|
||||||
|
'',
|
||||||
|
treeShakeIcons: false,
|
||||||
|
extraFrontEndOptions: <String>['--enable-experiment=non-nullable'],
|
||||||
|
),
|
||||||
|
target: null,
|
||||||
|
platform: FakePlatform(),
|
||||||
|
)).generator as DefaultResidentCompiler?;
|
||||||
|
|
||||||
|
expect(residentCompiler!.initializeFromDill,
|
||||||
|
globals.fs.path.join(getBuildDirectory(), '80b1a4cf4e7b90e1ab5f72022a0bc624.cache.dill'));
|
||||||
expect(residentCompiler.librariesSpec,
|
expect(residentCompiler.librariesSpec,
|
||||||
globals.fs.file(globals.artifacts!.getHostArtifact(HostArtifact.flutterWebLibrariesJson))
|
globals.fs.file(globals.artifacts!.getHostArtifact(HostArtifact.flutterWebLibrariesJson))
|
||||||
.uri.toString());
|
.uri.toString());
|
||||||
|
@ -497,6 +497,82 @@ void main() {
|
|||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('reports null safety analytics when reportNullSafety is true', () async {
|
||||||
|
globals.fs.file('lib/main.dart')
|
||||||
|
..createSync(recursive: true)
|
||||||
|
..writeAsStringSync('// @dart=2.12');
|
||||||
|
globals.fs.file('pubspec.yaml')
|
||||||
|
.writeAsStringSync('name: example\n');
|
||||||
|
globals.fs.file('.dart_tool/package_config.json')
|
||||||
|
..createSync(recursive: true)
|
||||||
|
..writeAsStringSync(r'''
|
||||||
|
{
|
||||||
|
"configVersion": 2,
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "example",
|
||||||
|
"rootUri": "../",
|
||||||
|
"packageUri": "lib/",
|
||||||
|
"languageVersion": "2.12"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"generated": "2020-12-02T19:30:53.862346Z",
|
||||||
|
"generator": "pub",
|
||||||
|
"generatorVersion": "2.12.0-76.0.dev"
|
||||||
|
}
|
||||||
|
''');
|
||||||
|
final FakeReportingNullSafetyCommand command = FakeReportingNullSafetyCommand();
|
||||||
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
|
await runner.run(<String>['test']);
|
||||||
|
|
||||||
|
expect(usage.events, containsAll(<TestUsageEvent>[
|
||||||
|
const TestUsageEvent(
|
||||||
|
NullSafetyAnalysisEvent.kNullSafetyCategory,
|
||||||
|
'runtime-mode',
|
||||||
|
label: 'NullSafetyMode.sound',
|
||||||
|
),
|
||||||
|
TestUsageEvent(
|
||||||
|
NullSafetyAnalysisEvent.kNullSafetyCategory,
|
||||||
|
'stats',
|
||||||
|
parameters: CustomDimensions.fromMap(<String, String>{
|
||||||
|
'cd49': '1', 'cd50': '1',
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
const TestUsageEvent(
|
||||||
|
NullSafetyAnalysisEvent.kNullSafetyCategory,
|
||||||
|
'language-version',
|
||||||
|
label: '2.12',
|
||||||
|
),
|
||||||
|
]));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Pub: () => FakePub(),
|
||||||
|
Usage: () => usage,
|
||||||
|
FileSystem: () => fileSystem,
|
||||||
|
ProcessManager: () => processManager,
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('tool exits on non-sound-null-safe code when explicit flag not passed', () async {
|
||||||
|
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(packagesPath: 'foo');
|
||||||
|
flutterCommand.argParser
|
||||||
|
..addFlag(FlutterOptions.kNullSafety, defaultsTo: true)
|
||||||
|
..addOption('target');
|
||||||
|
final File targetFile = fileSystem.file('targetFile.dart')
|
||||||
|
..writeAsStringSync('// @dart = 2.11');
|
||||||
|
expect(
|
||||||
|
() async => flutterCommand.getBuildInfo(
|
||||||
|
forcedBuildMode: BuildMode.debug,
|
||||||
|
forcedTargetFile: targetFile,
|
||||||
|
),
|
||||||
|
throwsToolExit(
|
||||||
|
message: 'This application does not support sound null-safety (its language version is 2.11)',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FileSystem: () => fileSystem,
|
||||||
|
ProcessManager: () => processManager,
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('use packagesPath to generate BuildInfo', () async {
|
testUsingContext('use packagesPath to generate BuildInfo', () async {
|
||||||
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(packagesPath: 'foo');
|
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(packagesPath: 'foo');
|
||||||
final BuildInfo buildInfo = await flutterCommand.getBuildInfo(forcedBuildMode: BuildMode.debug);
|
final BuildInfo buildInfo = await flutterCommand.getBuildInfo(forcedBuildMode: BuildMode.debug);
|
||||||
@ -701,6 +777,9 @@ class FakeReportingNullSafetyCommand extends FlutterCommand {
|
|||||||
@override
|
@override
|
||||||
bool get shouldRunPub => true;
|
bool get shouldRunPub => true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get reportNullSafety => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
return FlutterCommandResult.success();
|
return FlutterCommandResult.success();
|
||||||
|
@ -35,7 +35,7 @@ void main() {
|
|||||||
platform: platform,
|
platform: platform,
|
||||||
);
|
);
|
||||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||||
const FakeCommand(command: <String>[
|
FakeCommand(command: <Pattern>[
|
||||||
'Artifact.engineDartBinary.TargetPlatform.web_javascript',
|
'Artifact.engineDartBinary.TargetPlatform.web_javascript',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk.TargetPlatform.web_javascript',
|
'Artifact.frontendServerSnapshotForEngineDartSdk.TargetPlatform.web_javascript',
|
||||||
@ -58,10 +58,11 @@ void main() {
|
|||||||
'--filesystem-scheme',
|
'--filesystem-scheme',
|
||||||
'org-dartlang-app',
|
'org-dartlang-app',
|
||||||
'--initialize-from-dill',
|
'--initialize-from-dill',
|
||||||
r'build/cache.dill',
|
RegExp(r'^build\/(?:[a-z0-9]{32})\.cache\.dill$'),
|
||||||
'--platform',
|
'--platform',
|
||||||
'file:///HostArtifact.webPlatformKernelFolder/ddc_outline_sound.dill',
|
'file:///HostArtifact.webPlatformKernelFolder/ddc_outline_sound.dill',
|
||||||
'--verbosity=error',
|
'--verbosity=error',
|
||||||
|
'--sound-null-safety'
|
||||||
], stdout: 'result abc\nline0\nline1\nabc\nabc build/out 0')
|
], stdout: 'result abc\nline0\nline1\nabc\nabc build/out 0')
|
||||||
]);
|
]);
|
||||||
final WebTestCompiler compiler = WebTestCompiler(
|
final WebTestCompiler compiler = WebTestCompiler(
|
||||||
|
@ -49,6 +49,7 @@ void main() {
|
|||||||
test('generateMainModule removes timeout from requireJS', () {
|
test('generateMainModule removes timeout from requireJS', () {
|
||||||
final String result = generateMainModule(
|
final String result = generateMainModule(
|
||||||
entrypoint: 'foo/bar/main.js',
|
entrypoint: 'foo/bar/main.js',
|
||||||
|
nullAssertions: false,
|
||||||
nativeNullAssertions: false,
|
nativeNullAssertions: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -64,6 +65,7 @@ void main() {
|
|||||||
test('generateMainModule embeds urls correctly', () {
|
test('generateMainModule embeds urls correctly', () {
|
||||||
final String result = generateMainModule(
|
final String result = generateMainModule(
|
||||||
entrypoint: 'foo/bar/main.js',
|
entrypoint: 'foo/bar/main.js',
|
||||||
|
nullAssertions: false,
|
||||||
nativeNullAssertions: false,
|
nativeNullAssertions: false,
|
||||||
);
|
);
|
||||||
// bootstrap main module has correct defined module.
|
// bootstrap main module has correct defined module.
|
||||||
@ -74,6 +76,7 @@ void main() {
|
|||||||
test('generateMainModule can set bootstrap name', () {
|
test('generateMainModule can set bootstrap name', () {
|
||||||
final String result = generateMainModule(
|
final String result = generateMainModule(
|
||||||
entrypoint: 'foo/bar/main.js',
|
entrypoint: 'foo/bar/main.js',
|
||||||
|
nullAssertions: false,
|
||||||
nativeNullAssertions: false,
|
nativeNullAssertions: false,
|
||||||
bootstrapModule: 'foo_module.bootstrap',
|
bootstrapModule: 'foo_module.bootstrap',
|
||||||
);
|
);
|
||||||
@ -85,18 +88,22 @@ void main() {
|
|||||||
test('generateMainModule includes null safety switches', () {
|
test('generateMainModule includes null safety switches', () {
|
||||||
final String result = generateMainModule(
|
final String result = generateMainModule(
|
||||||
entrypoint: 'foo/bar/main.js',
|
entrypoint: 'foo/bar/main.js',
|
||||||
|
nullAssertions: true,
|
||||||
nativeNullAssertions: true,
|
nativeNullAssertions: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
expect(result, contains('''dart_sdk.dart.nonNullAsserts(true);'''));
|
||||||
expect(result, contains('''dart_sdk.dart.nativeNonNullAsserts(true);'''));
|
expect(result, contains('''dart_sdk.dart.nativeNonNullAsserts(true);'''));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('generateMainModule can disable null safety switches', () {
|
test('generateMainModule can disable null safety switches', () {
|
||||||
final String result = generateMainModule(
|
final String result = generateMainModule(
|
||||||
entrypoint: 'foo/bar/main.js',
|
entrypoint: 'foo/bar/main.js',
|
||||||
|
nullAssertions: false,
|
||||||
nativeNullAssertions: false,
|
nativeNullAssertions: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
expect(result, contains('''dart_sdk.dart.nonNullAsserts(false);'''));
|
||||||
expect(result, contains('''dart_sdk.dart.nativeNonNullAsserts(false);'''));
|
expect(result, contains('''dart_sdk.dart.nativeNonNullAsserts(false);'''));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ void main() {
|
|||||||
InternetAddress.loopbackIPv4,
|
InternetAddress.loopbackIPv4,
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
|
NullSafetyMode.unsound,
|
||||||
);
|
);
|
||||||
releaseAssetServer = ReleaseAssetServer(
|
releaseAssetServer = ReleaseAssetServer(
|
||||||
globals.fs.file('main.dart').uri,
|
globals.fs.file('main.dart').uri,
|
||||||
@ -289,6 +290,7 @@ void main() {
|
|||||||
InternetAddress.loopbackIPv4,
|
InternetAddress.loopbackIPv4,
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
|
NullSafetyMode.unsound,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(webAssetServer.basePath, 'foo/bar');
|
expect(webAssetServer.basePath, 'foo/bar');
|
||||||
@ -307,6 +309,7 @@ void main() {
|
|||||||
InternetAddress.loopbackIPv4,
|
InternetAddress.loopbackIPv4,
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
|
NullSafetyMode.unsound,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Defaults to "/" when there's no base element.
|
// Defaults to "/" when there's no base element.
|
||||||
@ -327,6 +330,7 @@ void main() {
|
|||||||
InternetAddress.loopbackIPv4,
|
InternetAddress.loopbackIPv4,
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
|
NullSafetyMode.unsound,
|
||||||
),
|
),
|
||||||
throwsToolExit(),
|
throwsToolExit(),
|
||||||
);
|
);
|
||||||
@ -346,6 +350,7 @@ void main() {
|
|||||||
InternetAddress.loopbackIPv4,
|
InternetAddress.loopbackIPv4,
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
|
NullSafetyMode.unsound,
|
||||||
),
|
),
|
||||||
throwsToolExit(),
|
throwsToolExit(),
|
||||||
);
|
);
|
||||||
@ -661,11 +666,13 @@ void main() {
|
|||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
useSseForInjectedClient: true,
|
useSseForInjectedClient: true,
|
||||||
|
nullAssertions: true,
|
||||||
nativeNullAssertions: true,
|
nativeNullAssertions: true,
|
||||||
buildInfo: const BuildInfo(
|
buildInfo: const BuildInfo(
|
||||||
BuildMode.debug,
|
BuildMode.debug,
|
||||||
'',
|
'',
|
||||||
treeShakeIcons: false,
|
treeShakeIcons: false,
|
||||||
|
nullSafetyMode: NullSafetyMode.unsound,
|
||||||
),
|
),
|
||||||
enableDwds: false,
|
enableDwds: false,
|
||||||
enableDds: false,
|
enableDds: false,
|
||||||
@ -673,6 +680,7 @@ void main() {
|
|||||||
testMode: true,
|
testMode: true,
|
||||||
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
||||||
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
||||||
|
nullSafetyMode: NullSafetyMode.unsound,
|
||||||
);
|
);
|
||||||
webDevFS.requireJS.createSync(recursive: true);
|
webDevFS.requireJS.createSync(recursive: true);
|
||||||
webDevFS.stackTraceMapper.createSync(recursive: true);
|
webDevFS.stackTraceMapper.createSync(recursive: true);
|
||||||
@ -680,13 +688,13 @@ void main() {
|
|||||||
final Uri uri = await webDevFS.create();
|
final Uri uri = await webDevFS.create();
|
||||||
webDevFS.webAssetServer.entrypointCacheDirectory = globals.fs.currentDirectory;
|
webDevFS.webAssetServer.entrypointCacheDirectory = globals.fs.currentDirectory;
|
||||||
final String webPrecompiledSdk = globals.artifacts!
|
final String webPrecompiledSdk = globals.artifacts!
|
||||||
.getHostArtifact(HostArtifact.webPrecompiledSoundSdk).path;
|
.getHostArtifact(HostArtifact.webPrecompiledSdk).path;
|
||||||
final String webPrecompiledSdkSourcemaps = globals.artifacts!
|
final String webPrecompiledSdkSourcemaps = globals.artifacts!
|
||||||
.getHostArtifact(HostArtifact.webPrecompiledSoundSdkSourcemaps).path;
|
.getHostArtifact(HostArtifact.webPrecompiledSdkSourcemaps).path;
|
||||||
final String webPrecompiledCanvaskitSdk = globals.artifacts!
|
final String webPrecompiledCanvaskitSdk = globals.artifacts!
|
||||||
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSoundSdk).path;
|
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdk).path;
|
||||||
final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts!
|
final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts!
|
||||||
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps).path;
|
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdkSourcemaps).path;
|
||||||
globals.fs.currentDirectory
|
globals.fs.currentDirectory
|
||||||
.childDirectory('lib')
|
.childDirectory('lib')
|
||||||
.childFile('web_entrypoint.dart')
|
.childFile('web_entrypoint.dart')
|
||||||
@ -771,6 +779,7 @@ void main() {
|
|||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
useSseForInjectedClient: true,
|
useSseForInjectedClient: true,
|
||||||
|
nullAssertions: true,
|
||||||
nativeNullAssertions: true,
|
nativeNullAssertions: true,
|
||||||
buildInfo: const BuildInfo(
|
buildInfo: const BuildInfo(
|
||||||
BuildMode.debug,
|
BuildMode.debug,
|
||||||
@ -783,6 +792,7 @@ void main() {
|
|||||||
testMode: true,
|
testMode: true,
|
||||||
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
||||||
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
||||||
|
nullSafetyMode: NullSafetyMode.sound,
|
||||||
);
|
);
|
||||||
webDevFS.requireJS.createSync(recursive: true);
|
webDevFS.requireJS.createSync(recursive: true);
|
||||||
webDevFS.stackTraceMapper.createSync(recursive: true);
|
webDevFS.stackTraceMapper.createSync(recursive: true);
|
||||||
@ -878,6 +888,7 @@ void main() {
|
|||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
useSseForInjectedClient: true,
|
useSseForInjectedClient: true,
|
||||||
|
nullAssertions: true,
|
||||||
nativeNullAssertions: true,
|
nativeNullAssertions: true,
|
||||||
buildInfo: const BuildInfo(
|
buildInfo: const BuildInfo(
|
||||||
BuildMode.debug,
|
BuildMode.debug,
|
||||||
@ -890,6 +901,7 @@ void main() {
|
|||||||
testMode: true,
|
testMode: true,
|
||||||
expressionCompiler: null,
|
expressionCompiler: null,
|
||||||
chromiumLauncher: null,
|
chromiumLauncher: null,
|
||||||
|
nullSafetyMode: NullSafetyMode.sound,
|
||||||
);
|
);
|
||||||
webDevFS.requireJS.createSync(recursive: true);
|
webDevFS.requireJS.createSync(recursive: true);
|
||||||
webDevFS.stackTraceMapper.createSync(recursive: true);
|
webDevFS.stackTraceMapper.createSync(recursive: true);
|
||||||
@ -945,7 +957,9 @@ void main() {
|
|||||||
testMode: true,
|
testMode: true,
|
||||||
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
||||||
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
||||||
|
nullAssertions: true,
|
||||||
nativeNullAssertions: true,
|
nativeNullAssertions: true,
|
||||||
|
nullSafetyMode: NullSafetyMode.sound,
|
||||||
);
|
);
|
||||||
webDevFS.requireJS.createSync(recursive: true);
|
webDevFS.requireJS.createSync(recursive: true);
|
||||||
webDevFS.stackTraceMapper.createSync(recursive: true);
|
webDevFS.stackTraceMapper.createSync(recursive: true);
|
||||||
@ -971,6 +985,7 @@ void main() {
|
|||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
useSseForInjectedClient: true,
|
useSseForInjectedClient: true,
|
||||||
|
nullAssertions: true,
|
||||||
nativeNullAssertions: true,
|
nativeNullAssertions: true,
|
||||||
buildInfo: const BuildInfo(
|
buildInfo: const BuildInfo(
|
||||||
BuildMode.debug,
|
BuildMode.debug,
|
||||||
@ -986,6 +1001,7 @@ void main() {
|
|||||||
testMode: true,
|
testMode: true,
|
||||||
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
||||||
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
||||||
|
nullSafetyMode: NullSafetyMode.sound,
|
||||||
);
|
);
|
||||||
webDevFS.requireJS.createSync(recursive: true);
|
webDevFS.requireJS.createSync(recursive: true);
|
||||||
webDevFS.stackTraceMapper.createSync(recursive: true);
|
webDevFS.stackTraceMapper.createSync(recursive: true);
|
||||||
@ -1012,6 +1028,7 @@ void main() {
|
|||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
useSseForInjectedClient: true,
|
useSseForInjectedClient: true,
|
||||||
|
nullAssertions: true,
|
||||||
nativeNullAssertions: true,
|
nativeNullAssertions: true,
|
||||||
buildInfo: const BuildInfo(
|
buildInfo: const BuildInfo(
|
||||||
BuildMode.debug,
|
BuildMode.debug,
|
||||||
@ -1027,6 +1044,7 @@ void main() {
|
|||||||
testMode: true,
|
testMode: true,
|
||||||
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
||||||
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
||||||
|
nullSafetyMode: NullSafetyMode.sound,
|
||||||
);
|
);
|
||||||
webDevFS.requireJS.createSync(recursive: true);
|
webDevFS.requireJS.createSync(recursive: true);
|
||||||
webDevFS.stackTraceMapper.createSync(recursive: true);
|
webDevFS.stackTraceMapper.createSync(recursive: true);
|
||||||
@ -1056,6 +1074,7 @@ void main() {
|
|||||||
false,
|
false,
|
||||||
Uri.base,
|
Uri.base,
|
||||||
null,
|
null,
|
||||||
|
NullSafetyMode.unsound,
|
||||||
testMode: true);
|
testMode: true);
|
||||||
|
|
||||||
expect(webAssetServer.defaultResponseHeaders['x-frame-options'], null);
|
expect(webAssetServer.defaultResponseHeaders['x-frame-options'], null);
|
||||||
@ -1089,6 +1108,7 @@ void main() {
|
|||||||
InternetAddress.anyIPv4,
|
InternetAddress.anyIPv4,
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
<String, String>{},
|
<String, String>{},
|
||||||
|
NullSafetyMode.sound,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(await webAssetServer.metadataContents('foo/main_module.ddc_merged_metadata'), null);
|
expect(await webAssetServer.metadataContents('foo/main_module.ddc_merged_metadata'), null);
|
||||||
@ -1118,6 +1138,7 @@ void main() {
|
|||||||
useSseForDebugProxy: true,
|
useSseForDebugProxy: true,
|
||||||
useSseForDebugBackend: true,
|
useSseForDebugBackend: true,
|
||||||
useSseForInjectedClient: true,
|
useSseForInjectedClient: true,
|
||||||
|
nullAssertions: true,
|
||||||
nativeNullAssertions: true,
|
nativeNullAssertions: true,
|
||||||
buildInfo: BuildInfo.debug,
|
buildInfo: BuildInfo.debug,
|
||||||
enableDwds: false,
|
enableDwds: false,
|
||||||
@ -1126,6 +1147,7 @@ void main() {
|
|||||||
testMode: true,
|
testMode: true,
|
||||||
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
expressionCompiler: null, // ignore: avoid_redundant_argument_values
|
||||||
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
chromiumLauncher: null, // ignore: avoid_redundant_argument_values
|
||||||
|
nullSafetyMode: NullSafetyMode.unsound,
|
||||||
);
|
);
|
||||||
webDevFS.requireJS.createSync(recursive: true);
|
webDevFS.requireJS.createSync(recursive: true);
|
||||||
webDevFS.stackTraceMapper.createSync(recursive: true);
|
webDevFS.stackTraceMapper.createSync(recursive: true);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build.dart';
|
import 'package:flutter_tools/src/commands/build.dart';
|
||||||
@ -49,6 +50,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: buildSystem,
|
buildSystem: buildSystem,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
))
|
))
|
||||||
.run(<String>['build', 'web', '--no-pub']);
|
.run(<String>['build', 'web', '--no-pub']);
|
||||||
@ -71,6 +73,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: buildSystem,
|
buildSystem: buildSystem,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
))
|
))
|
||||||
.run(<String>['build', 'web', '--no-pub']);
|
.run(<String>['build', 'web', '--no-pub']);
|
||||||
@ -92,6 +95,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: buildSystem,
|
buildSystem: buildSystem,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
))
|
))
|
||||||
.run(<String>['build', 'web', '--no-pub']);
|
.run(<String>['build', 'web', '--no-pub']);
|
||||||
@ -112,6 +116,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: buildSystem,
|
buildSystem: buildSystem,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
))
|
))
|
||||||
.run(<String>['build', 'web', '--no-pub']);
|
.run(<String>['build', 'web', '--no-pub']);
|
||||||
@ -134,6 +139,7 @@ void main() {
|
|||||||
androidSdk: FakeAndroidSdk(),
|
androidSdk: FakeAndroidSdk(),
|
||||||
buildSystem: buildSystem,
|
buildSystem: buildSystem,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
logger: BufferLogger.test(),
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
))
|
))
|
||||||
.run(<String>['build', 'web', '--no-pub']);
|
.run(<String>['build', 'web', '--no-pub']);
|
||||||
|
@ -0,0 +1,83 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:file/file.dart';
|
||||||
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
|
import '../src/common.dart';
|
||||||
|
import 'test_utils.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
late Directory tempDir;
|
||||||
|
late Directory projectRoot;
|
||||||
|
late String flutterBin;
|
||||||
|
final List<String> targetPlatforms = <String>[
|
||||||
|
'apk',
|
||||||
|
'web',
|
||||||
|
if (platform.isWindows) 'windows',
|
||||||
|
if (platform.isMacOS) ...<String>['macos', 'ios'],
|
||||||
|
];
|
||||||
|
|
||||||
|
setUpAll(() {
|
||||||
|
tempDir = createResolvedTempDirectorySync('build_null_unsafe_test.');
|
||||||
|
flutterBin = fileSystem.path.join(
|
||||||
|
getFlutterRoot(),
|
||||||
|
'bin',
|
||||||
|
'flutter',
|
||||||
|
);
|
||||||
|
processManager.runSync(<String>[
|
||||||
|
flutterBin,
|
||||||
|
'config',
|
||||||
|
'--enable-macos-desktop',
|
||||||
|
'--enable-windows-desktop',
|
||||||
|
'--enable-web',
|
||||||
|
]);
|
||||||
|
|
||||||
|
processManager.runSync(<String>[
|
||||||
|
flutterBin,
|
||||||
|
...getLocalEngineArguments(),
|
||||||
|
'create',
|
||||||
|
'hello',
|
||||||
|
], workingDirectory: tempDir.path);
|
||||||
|
|
||||||
|
projectRoot = tempDir.childDirectory('hello');
|
||||||
|
writeFile(fileSystem.path.join(projectRoot.path, 'pubspec.yaml'), '''
|
||||||
|
name: hello
|
||||||
|
environment:
|
||||||
|
sdk: '>=2.12.0 <4.0.0'
|
||||||
|
''');
|
||||||
|
writeFile(fileSystem.path.join(projectRoot.path, 'lib', 'main.dart'), '''
|
||||||
|
import 'unsafe.dart';
|
||||||
|
void main() {
|
||||||
|
print(unsafeString);
|
||||||
|
}
|
||||||
|
''');
|
||||||
|
writeFile(fileSystem.path.join(projectRoot.path, 'lib', 'unsafe.dart'), '''
|
||||||
|
// @dart=2.9
|
||||||
|
String unsafeString = null;
|
||||||
|
''');
|
||||||
|
});
|
||||||
|
|
||||||
|
tearDownAll(() {
|
||||||
|
tryToDelete(tempDir);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (final String targetPlatform in targetPlatforms) {
|
||||||
|
testWithoutContext('flutter build $targetPlatform --no-sound-null-safety', () {
|
||||||
|
final ProcessResult result = processManager.runSync(<String>[
|
||||||
|
flutterBin,
|
||||||
|
...getLocalEngineArguments(),
|
||||||
|
'build',
|
||||||
|
targetPlatform,
|
||||||
|
'--no-pub',
|
||||||
|
'--no-sound-null-safety',
|
||||||
|
if (targetPlatform == 'ios') '--no-codesign',
|
||||||
|
], workingDirectory: projectRoot.path);
|
||||||
|
|
||||||
|
if (result.exitCode != 0) {
|
||||||
|
fail('build --no-sound-null-safety failed: ${result.exitCode}\n${result.stderr}\n${result.stdout}');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user