From 1efb36035eb592fe560504fdc9283101742f8660 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 20 Nov 2020 11:53:02 -0800 Subject: [PATCH] [flutter_tools] display message for current null safety mode (#70718) --- packages/flutter_tools/lib/src/base/logger.dart | 3 ++- .../lib/src/isolated/resident_web_runner.dart | 14 +++++++++++++- .../flutter_tools/lib/src/resident_runner.dart | 11 ++--------- packages/flutter_tools/lib/src/run_hot.dart | 15 +++++++++++++-- .../test/general.shard/resident_runner_test.dart | 1 + 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/packages/flutter_tools/lib/src/base/logger.dart b/packages/flutter_tools/lib/src/base/logger.dart index 75623cff96..741bba1f18 100644 --- a/packages/flutter_tools/lib/src/base/logger.dart +++ b/packages/flutter_tools/lib/src/base/logger.dart @@ -418,7 +418,8 @@ class WindowsStdoutLogger extends StdoutLogger { .replaceAll('šŸ–¼ļø', '') .replaceAll('āœ—', 'X') .replaceAll('āœ“', '√') - .replaceAll('šŸ”Ø', ''); + .replaceAll('šŸ”Ø', '') + .replaceAll('šŸ’Ŗ', ''); _stdio.stdoutWrite(windowsMessage); } } diff --git a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart index 54b9dff9bb..5aaf0c4827 100644 --- a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart +++ b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart @@ -723,7 +723,7 @@ class _ResidentWebRunner extends ResidentWebRunner { ?? debuggingOptions.buildInfo.packageConfig, ); final Status devFSStatus = globals.logger.startProgress( - 'Syncing files to device ${device.device.name}...', + 'Waiting for connection from debug service on ${device.device.name}...', ); final UpdateFSReport report = await device.devFS.update( mainUri: await _generateEntrypoint( @@ -833,6 +833,18 @@ class _ResidentWebRunner extends ResidentWebRunner { ..writeAsStringSync(websocketUri.toString()); } globals.printStatus('Debug service listening on $websocketUri'); + globals.printStatus(''); + if (debuggingOptions.buildInfo.nullSafetyMode == NullSafetyMode.sound) { + globals.printStatus('šŸ’Ŗ Running with sound null safety šŸ’Ŗ', emphasis: true); + } else { + globals.printStatus( + 'Running with unsound null safety', + emphasis: true, + ); + globals.printStatus( + 'For more information see https://dart.dev/null-safety/unsound-null-safety', + ); + } } appStartedCompleter?.complete(); connectionInfoCompleter?.complete(DebugConnectionInfo(wsUri: websocketUri)); diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index ad3074a2c3..f50242c7eb 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -1219,15 +1219,8 @@ abstract class ResidentRunner { ipv6: ipv6, disableServiceAuthCodes: debuggingOptions.disableServiceAuthCodes ); - // This will wait for at least one flutter view before returning. - final Status status = globals.logger.startProgress( - 'Waiting for ${device.device.name} to report its views...', - ); - try { - await device.vmService.getFlutterViews(); - } finally { - status.stop(); - } + await device.vmService.getFlutterViews(); + // This hooks up callbacks for when the connection stops in the future. // We don't want to wait for them. We don't handle errors in those callbacks' // futures either because they just print to logger and is not critical. diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index 2ed8b1524e..ab4532db24 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -1095,13 +1095,24 @@ class HotRunner extends ResidentRunner { printHelpDetails(); } for (final FlutterDevice device in flutterDevices) { - final String dname = device.device.name; // Caution: This log line is parsed by device lab tests. globals.printStatus( - 'An Observatory debugger and profiler on $dname is available at: ' + 'An Observatory debugger and profiler on ${device.device.name} is available at: ' '${device.vmService.httpAddress}', ); } + globals.printStatus(''); + if (debuggingOptions.buildInfo.nullSafetyMode == NullSafetyMode.sound) { + globals.printStatus('šŸ’Ŗ Running with sound null safety šŸ’Ŗ', emphasis: true); + } else { + globals.printStatus( + 'Running with unsound null safety', + emphasis: true, + ); + globals.printStatus( + 'For more information see https://dart.dev/null-safety/unsound-null-safety', + ); + } } Future _evictDirtyAssets() async { diff --git a/packages/flutter_tools/test/general.shard/resident_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_runner_test.dart index c8e66ee5af..7a7fdf8095 100644 --- a/packages/flutter_tools/test/general.shard/resident_runner_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_runner_test.dart @@ -1510,6 +1510,7 @@ void main() { commandHelp.P, commandHelp.a, 'An Observatory debugger and profiler on null is available at: null', + '\nšŸ’Ŗ Running with sound null safety šŸ’Ŗ', '' ].join('\n') ));