diff --git a/packages/flutter_tools/lib/src/base/logger.dart b/packages/flutter_tools/lib/src/base/logger.dart index f8bac32f28..2c418a3b9d 100644 --- a/packages/flutter_tools/lib/src/base/logger.dart +++ b/packages/flutter_tools/lib/src/base/logger.dart @@ -46,7 +46,8 @@ abstract class Logger { /// since the last time it was set to false. bool hadErrorOutput = false; - /// If true, then [printWarning] has been called at least once for this logger + /// If true, then [printWarning] has been called at least once with its + /// "fatal" argument true for this logger /// since the last time it was reset to false. bool hadWarningOutput = false; @@ -124,6 +125,7 @@ abstract class Logger { int? indent, int? hangingIndent, bool? wrap, + bool fatal = true, }); /// Display normal output of the command. This should be used for things like @@ -314,6 +316,7 @@ class DelegatingLogger implements Logger { int? indent, int? hangingIndent, bool? wrap, + bool fatal = true, }) { _delegate.printWarning( message, @@ -322,6 +325,7 @@ class DelegatingLogger implements Logger { indent: indent, hangingIndent: hangingIndent, wrap: wrap, + fatal: fatal, ); } @@ -481,8 +485,9 @@ class StdoutLogger extends Logger { int? indent, int? hangingIndent, bool? wrap, + bool fatal = true, }) { - hadWarningOutput = true; + hadWarningOutput = hadWarningOutput || fatal; _status?.pause(); message = wrapText(message, indent: indent, @@ -820,8 +825,9 @@ class BufferLogger extends Logger { int? indent, int? hangingIndent, bool? wrap, + bool fatal = true, }) { - hadWarningOutput = true; + hadWarningOutput = hadWarningOutput || fatal; _warning.writeln(terminal.color( wrapText(message, indent: indent, @@ -965,6 +971,7 @@ class VerboseLogger extends DelegatingLogger { int? indent, int? hangingIndent, bool? wrap, + bool fatal = true, }) { hadWarningOutput = true; _emit( diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart index 6d97815115..13efbde879 100644 --- a/packages/flutter_tools/lib/src/cache.dart +++ b/packages/flutter_tools/lib/src/cache.dart @@ -278,6 +278,9 @@ class Cache { // Whether to cache the unsigned mac binaries. Defaults to caching the signed binaries. bool useUnsignedMacBinaries = false; + // Whether the warning printed when a custom artifact URL is used is fatal. + bool fatalStorageWarning = true; + static RandomAccessFile? _lock; static bool _lockEnabled = true; @@ -340,12 +343,11 @@ class Cache { // version --machine"). It's not really a "warning" though, so print it // in grey. Also, make sure that it isn't counted as a warning for // Logger.warningsAreFatal. - final bool oldWarnings = _logger.hadWarningOutput; _logger.printWarning( 'Waiting for another flutter command to release the startup lock...', color: TerminalColor.grey, + fatal: false, ); - _logger.hadWarningOutput = oldWarnings; printed = true; } await Future.delayed(const Duration(milliseconds: 50)); @@ -522,6 +524,7 @@ class Cache { _logger.printWarning( 'Flutter assets will be downloaded from $overrideUrl. Make sure you trust this source!', emphasis: true, + fatal: false, ); _hasWarnedAboutStorageOverride = true; } diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index 5791cd0216..ab1659fecb 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart @@ -1250,6 +1250,7 @@ class NotifyingLogger extends DelegatingLogger { int? indent, int? hangingIndent, bool? wrap, + bool fatal = true, }) { _sendMessage(LogMessage('warning', message)); } diff --git a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart index c0c825abed..1b3b9611a0 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart @@ -1138,8 +1138,9 @@ class StreamLogger extends Logger { int? indent, int? hangingIndent, bool? wrap, + bool fatal = true, }) { - hadWarningOutput = true; + hadWarningOutput = hadWarningOutput || fatal; _log('[stderr] $message'); }