Unverified Commit f4c3facf authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

Revert "Revert "[flutter_tools] Remove sound null safety flag (#120936)" (#122909)" (#123031)

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