Skip to content

Commit f4c3fac

Browse files
Revert "Revert "[flutter_tools] Remove sound null safety flag (flutter#120936)" (flutter#122909)" (flutter#123031)
[flutter_tools] Remove sound null safety flag #2
1 parent 484c226 commit f4c3fac

File tree

67 files changed

+130
-1126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+130
-1126
lines changed

dev/bots/test.dart

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,7 @@ Future<void> _runExampleProjectBuildTests(Directory exampleDirectory, [File? mai
573573
// Only verify caching with flutter gallery.
574574
final bool verifyCaching = exampleDirectory.path.contains('flutter_gallery');
575575
final String examplePath = path.relative(exampleDirectory.path, from: Directory.current.path);
576-
final bool hasNullSafety = File(path.join(examplePath, 'null_safety')).existsSync();
577576
final List<String> additionalArgs = <String>[
578-
if (hasNullSafety) '--no-sound-null-safety',
579577
if (mainFile != null) path.relative(mainFile.path, from: exampleDirectory.absolute.path),
580578
];
581579
if (Directory(path.join(examplePath, 'android')).existsSync()) {
@@ -771,16 +769,14 @@ Future<void> _runAddToAppLifeCycleTests() async {
771769
}
772770

773771
Future<void> _runFrameworkTests() async {
774-
final List<String> soundNullSafetyOptions = <String>['--null-assertions', '--sound-null-safety'];
775-
final List<String> mixedModeNullSafetyOptions = <String>['--null-assertions', '--no-sound-null-safety'];
776772
final List<String> trackWidgetCreationAlternatives = <String>['--track-widget-creation', '--no-track-widget-creation'];
777773

778774
Future<void> runWidgets() async {
779775
printProgress('${green}Running packages/flutter tests $reset for ${cyan}test/widgets/$reset');
780776
for (final String trackWidgetCreationOption in trackWidgetCreationAlternatives) {
781777
await _runFlutterTest(
782778
path.join(flutterRoot, 'packages', 'flutter'),
783-
options: <String>[trackWidgetCreationOption, ...soundNullSafetyOptions],
779+
options: <String>[trackWidgetCreationOption],
784780
tests: <String>[ path.join('test', 'widgets') + path.separator ],
785781
);
786782
}
@@ -795,13 +791,13 @@ Future<void> _runFrameworkTests() async {
795791
// Run release mode tests (see packages/flutter/test_release/README.md)
796792
await _runFlutterTest(
797793
path.join(flutterRoot, 'packages', 'flutter'),
798-
options: <String>['--dart-define=dart.vm.product=true', ...soundNullSafetyOptions],
794+
options: <String>['--dart-define=dart.vm.product=true'],
799795
tests: <String>['test_release${path.separator}'],
800796
);
801797
// Run profile mode tests (see packages/flutter/test_profile/README.md)
802798
await _runFlutterTest(
803799
path.join(flutterRoot, 'packages', 'flutter'),
804-
options: <String>['--dart-define=dart.vm.product=false', '--dart-define=dart.vm.profile=true', ...soundNullSafetyOptions],
800+
options: <String>['--dart-define=dart.vm.product=false', '--dart-define=dart.vm.profile=true'],
805801
tests: <String>['test_profile${path.separator}'],
806802
);
807803
}
@@ -817,7 +813,7 @@ Future<void> _runFrameworkTests() async {
817813
for (final String trackWidgetCreationOption in trackWidgetCreationAlternatives) {
818814
await _runFlutterTest(
819815
path.join(flutterRoot, 'packages', 'flutter'),
820-
options: <String>[trackWidgetCreationOption, ...soundNullSafetyOptions],
816+
options: <String>[trackWidgetCreationOption],
821817
tests: tests,
822818
);
823819
}
@@ -837,9 +833,9 @@ Future<void> _runFrameworkTests() async {
837833
workingDirectory: path.join(flutterRoot, 'examples', 'api'),
838834
);
839835
}
840-
await _runFlutterTest(path.join(flutterRoot, 'examples', 'api'), options: soundNullSafetyOptions);
841-
await _runFlutterTest(path.join(flutterRoot, 'examples', 'hello_world'), options: soundNullSafetyOptions);
842-
await _runFlutterTest(path.join(flutterRoot, 'examples', 'layers'), options: soundNullSafetyOptions);
836+
await _runFlutterTest(path.join(flutterRoot, 'examples', 'api'));
837+
await _runFlutterTest(path.join(flutterRoot, 'examples', 'hello_world'));
838+
await _runFlutterTest(path.join(flutterRoot, 'examples', 'layers'));
843839
}
844840

845841
Future<void> runTracingTests() async {
@@ -945,7 +941,6 @@ Future<void> _runFrameworkTests() async {
945941

946942
Future<void> runPrivateTests() async {
947943
final List<String> args = <String>[
948-
'--sound-null-safety',
949944
'run',
950945
'bin/test_private.dart',
951946
];
@@ -989,17 +984,17 @@ Future<void> _runFrameworkTests() async {
989984
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'gen_defaults'));
990985
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'gen_keycodes'));
991986
await _runFlutterTest(path.join(flutterRoot, 'dev', 'benchmarks', 'test_apps', 'stocks'));
992-
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_driver'), tests: <String>[path.join('test', 'src', 'real_tests')], options: soundNullSafetyOptions);
987+
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_driver'), tests: <String>[path.join('test', 'src', 'real_tests')]);
993988
await _runFlutterTest(path.join(flutterRoot, 'packages', 'integration_test'), options: <String>[
994989
'--enable-vmservice',
995990
// Web-specific tests depend on Chromium, so they run as part of the web_long_running_tests shard.
996991
'--exclude-tags=web',
997992
]);
998-
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_goldens'), options: soundNullSafetyOptions);
999-
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_localizations'), options: soundNullSafetyOptions);
1000-
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_test'), options: soundNullSafetyOptions);
1001-
await _runFlutterTest(path.join(flutterRoot, 'packages', 'fuchsia_remote_debug_protocol'), options: soundNullSafetyOptions);
1002-
await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'non_nullable'), options: mixedModeNullSafetyOptions);
993+
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_goldens'));
994+
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_localizations'));
995+
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_test'));
996+
await _runFlutterTest(path.join(flutterRoot, 'packages', 'fuchsia_remote_debug_protocol'));
997+
await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'non_nullable'));
1003998
const String httpClientWarning =
1004999
'Warning: At least one test in this suite creates an HttpClient. When\n'
10051000
'running a test suite that uses TestWidgetsFlutterBinding, all HTTP\n'
@@ -1229,7 +1224,7 @@ Future<void> _runWebLongRunningTests() async {
12291224
() => _runWebDebugTest('lib/framework_stack_trace.dart'),
12301225
() => _runWebDebugTest('lib/web_directory_loading.dart'),
12311226
() => _runWebDebugTest('test/test.dart'),
1232-
() => _runWebDebugTest('lib/null_safe_main.dart', enableNullSafety: true),
1227+
() => _runWebDebugTest('lib/null_safe_main.dart'),
12331228
() => _runWebDebugTest('lib/web_define_loading.dart',
12341229
additionalArguments: <String>[
12351230
'--dart-define=test.valueA=Example,A',
@@ -1242,12 +1237,8 @@ Future<void> _runWebLongRunningTests() async {
12421237
'--dart-define=test.valueB=Value',
12431238
]
12441239
),
1245-
() => _runWebDebugTest('lib/sound_mode.dart', additionalArguments: <String>[
1246-
'--sound-null-safety',
1247-
]),
1248-
() => _runWebReleaseTest('lib/sound_mode.dart', additionalArguments: <String>[
1249-
'--sound-null-safety',
1250-
]),
1240+
() => _runWebDebugTest('lib/sound_mode.dart'),
1241+
() => _runWebReleaseTest('lib/sound_mode.dart'),
12511242
() => _runFlutterWebTest(
12521243
'html',
12531244
path.join(flutterRoot, 'packages', 'integration_test'),
@@ -1306,7 +1297,6 @@ Future<void> _runFlutterDriverWebTest({
13061297
if (driver != null) '--driver=$driver',
13071298
'--target=$target',
13081299
'--browser-name=chrome',
1309-
'--no-sound-null-safety',
13101300
'-d',
13111301
'web-server',
13121302
'--$buildMode',
@@ -1348,7 +1338,6 @@ Future<void> _runWebTreeshakeTest() async {
13481338
'build',
13491339
'web',
13501340
'--target=$target',
1351-
'--no-sound-null-safety',
13521341
'--profile',
13531342
],
13541343
workingDirectory: testAppDirectory,
@@ -1574,7 +1563,6 @@ Future<void> _runGalleryE2eWebTest(String buildMode, { bool canvasKit = false })
15741563
'--driver=test_driver/transitions_perf_e2e_test.dart',
15751564
'--target=test_driver/transitions_perf_e2e.dart',
15761565
'--browser-name=chrome',
1577-
'--no-sound-null-safety',
15781566
'-d',
15791567
'web-server',
15801568
'--$buildMode',
@@ -1681,7 +1669,6 @@ Future<void> _runWebReleaseTest(String target, {
16811669
///
16821670
/// Instead, we use `flutter run --debug` and sniff out the standard output.
16831671
Future<void> _runWebDebugTest(String target, {
1684-
bool enableNullSafety = false,
16851672
List<String> additionalArguments = const<String>[],
16861673
}) async {
16871674
final String testAppDirectory = path.join(flutterRoot, 'dev', 'integration_tests', 'web');
@@ -1695,11 +1682,6 @@ Future<void> _runWebDebugTest(String target, {
16951682
<String>[
16961683
'run',
16971684
'--debug',
1698-
if (enableNullSafety)
1699-
...<String>[
1700-
'--no-sound-null-safety',
1701-
'--null-assertions',
1702-
],
17031685
'-d',
17041686
'chrome',
17051687
'--web-run-headless',
@@ -1742,7 +1724,6 @@ Future<void> _runFlutterWebTest(String webRenderer, String workingDirectory, Lis
17421724
'--platform=chrome',
17431725
'--web-renderer=$webRenderer',
17441726
'--dart-define=DART_HHH_BOT=$_runningInDartHHHBot',
1745-
'--sound-null-safety',
17461727
...flutterTestArgs,
17471728
...tests,
17481729
],

packages/flutter/test/foundation/isolates_test.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ Future<int> test5CallCompute(int value) {
8080
return compute(test5, value);
8181
}
8282

83-
Future<void> expectFileSuccessfullyCompletes(String filename,
84-
[bool unsound = false]) async {
83+
Future<void> expectFileSuccessfullyCompletes(String filename) async {
8584
// Run a Dart script that calls compute().
8685
// The Dart process will terminate only if the script exits cleanly with
8786
// all isolate ports closed.
@@ -93,12 +92,10 @@ Future<void> expectFileSuccessfullyCompletes(String filename,
9392
final String packageRoot = fs.path.dirname(fs.path.fromUri(platform.script));
9493
final String scriptPath =
9594
fs.path.join(packageRoot, 'test', 'foundation', filename);
96-
final String nullSafetyArg =
97-
unsound ? '--no-sound-null-safety' : '--sound-null-safety';
9895

9996
// Enable asserts to also catch potentially invalid assertions.
10097
final ProcessResult result = await Process.run(
101-
dartPath, <String>[nullSafetyArg, 'run', '--enable-asserts', scriptPath]);
98+
dartPath, <String>['run', '--enable-asserts', scriptPath]);
10299
expect(result.exitCode, 0);
103100
}
104101

packages/flutter/test_private/bin/test_private.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class TestCase {
225225
for (final File test in tests) {
226226
final String testPath = path.join(path.dirname(test.path), 'lib', path.basenameWithoutExtension(test.path));
227227
final ProcessRunnerResult result = await runner.runProcess(
228-
<String>[flutter, 'test', '--enable-experiment=non-nullable', '--no-sound-null-safety', '--null-assertions', testPath],
228+
<String>[flutter, 'test', testPath],
229229
failOk: true,
230230
);
231231
if (result.exitCode != 0) {

packages/flutter_tools/lib/executable.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ List<FlutterCommand> generateCommands({
171171
osUtils: globals.os,
172172
verboseHelp: verboseHelp,
173173
androidSdk: globals.androidSdk,
174-
logger: globals.logger,
175174
),
176175
ChannelCommand(verboseHelp: verboseHelp),
177176
CleanCommand(verbose: verbose),

packages/flutter_tools/lib/src/artifacts.dart

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@ enum HostArtifact {
9191
webPlatformDart2JSSoundKernelDill,
9292

9393
/// The precompiled SDKs and sourcemaps for web debug builds.
94-
webPrecompiledSdk,
95-
webPrecompiledSdkSourcemaps,
96-
webPrecompiledCanvaskitSdk,
97-
webPrecompiledCanvaskitSdkSourcemaps,
98-
webPrecompiledCanvaskitAndHtmlSdk,
99-
webPrecompiledCanvaskitAndHtmlSdkSourcemaps,
94+
10095
webPrecompiledSoundSdk,
10196
webPrecompiledSoundSdkSourcemaps,
10297
webPrecompiledCanvaskitSoundSdk,
@@ -248,16 +243,10 @@ String _hostArtifactToFileName(HostArtifact artifact, Platform platform) {
248243
return 'dart2js_platform.dill';
249244
case HostArtifact.flutterWebLibrariesJson:
250245
return 'libraries.json';
251-
case HostArtifact.webPrecompiledSdk:
252-
case HostArtifact.webPrecompiledCanvaskitSdk:
253-
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
254246
case HostArtifact.webPrecompiledSoundSdk:
255247
case HostArtifact.webPrecompiledCanvaskitSoundSdk:
256248
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk:
257249
return 'dart_sdk.js';
258-
case HostArtifact.webPrecompiledSdkSourcemaps:
259-
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
260-
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
261250
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
262251
case HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps:
263252
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps:
@@ -407,18 +396,6 @@ class CachedArtifacts implements Artifacts {
407396
case HostArtifact.webPlatformDart2JSSoundKernelDill:
408397
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
409398
return _fileSystem.file(path);
410-
case HostArtifact.webPrecompiledSdk:
411-
case HostArtifact.webPrecompiledSdkSourcemaps:
412-
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
413-
return _fileSystem.file(path);
414-
case HostArtifact.webPrecompiledCanvaskitSdk:
415-
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
416-
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform));
417-
return _fileSystem.file(path);
418-
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
419-
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
420-
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform));
421-
return _fileSystem.file(path);
422399
case HostArtifact.webPrecompiledSoundSdk:
423400
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
424401
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
@@ -851,18 +828,6 @@ class CachedLocalEngineArtifacts implements Artifacts {
851828
case HostArtifact.webPlatformDart2JSSoundKernelDill:
852829
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
853830
return _fileSystem.file(path);
854-
case HostArtifact.webPrecompiledSdk:
855-
case HostArtifact.webPrecompiledSdkSourcemaps:
856-
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
857-
return _fileSystem.file(path);
858-
case HostArtifact.webPrecompiledCanvaskitSdk:
859-
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
860-
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform));
861-
return _fileSystem.file(path);
862-
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
863-
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
864-
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform));
865-
return _fileSystem.file(path);
866831
case HostArtifact.webPrecompiledSoundSdk:
867832
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
868833
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
@@ -1153,18 +1118,6 @@ class CachedLocalWebSdkArtifacts implements Artifacts {
11531118
case HostArtifact.webPlatformDart2JSSoundKernelDill:
11541119
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
11551120
return _fileSystem.file(path);
1156-
case HostArtifact.webPrecompiledSdk:
1157-
case HostArtifact.webPrecompiledSdkSourcemaps:
1158-
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
1159-
return _fileSystem.file(path);
1160-
case HostArtifact.webPrecompiledCanvaskitSdk:
1161-
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
1162-
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform));
1163-
return _fileSystem.file(path);
1164-
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
1165-
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
1166-
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform));
1167-
return _fileSystem.file(path);
11681121
case HostArtifact.webPrecompiledSoundSdk:
11691122
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
11701123
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));

packages/flutter_tools/lib/src/build_info.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class BuildInfo {
4040
this.performanceMeasurementFile,
4141
this.dartDefineConfigJsonMap,
4242
this.packagesPath = '.dart_tool/package_config.json', // TODO(zanderso): make this required and remove the default.
43-
this.nullSafetyMode = NullSafetyMode.sound,
4443
this.codeSizeDirectory,
4544
this.androidGradleDaemon = true,
4645
this.packageConfig = PackageConfig.empty,
@@ -54,11 +53,6 @@ class BuildInfo {
5453

5554
final BuildMode mode;
5655

57-
/// The null safety mode the application should be run in.
58-
///
59-
/// If not provided, defaults to [NullSafetyMode.autodetect].
60-
final NullSafetyMode nullSafetyMode;
61-
6256
/// Whether the build should subset icon fonts.
6357
final bool treeShakeIcons;
6458

packages/flutter_tools/lib/src/commands/attach.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class AttachCommand extends FlutterCommand {
9090
usesDartDefineOption();
9191
usesDeviceUserOption();
9292
addEnableExperimentation(hide: !verboseHelp);
93-
addNullSafetyModeOptions(hide: !verboseHelp);
9493
usesInitializeFromDillOption(hide: !verboseHelp);
9594
argParser
9695
..addOption(

0 commit comments

Comments
 (0)