Unverified Commit 0d39f646 authored by William Hesse's avatar William Hesse Committed by GitHub

[testing] Make the FLUTTER_STORAGE_BASE_URL warning non-fatal (#128335)

Presubmit testing and CI testing of Flutter using a custom storage location for engine artifacts must be able to use the --fatal-warnings flag without failing due to the custom artifact location.

This change adds an option that makes this warning non-fatal. The new --no-fatal-storage-url-warning flag makes the --fatal-warnings flag ignore the warning that a custom artifact download URL is being used by setting the environment variable FLUTTER_STORAGE_BASE_URL.

Bug: #127683

- [X ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
- [X ] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
- [X ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
- [X ] I signed the [CLA].
- [X ] I listed at least one issue that this PR fixes in the description above.
- [X ] I updated/added relevant documentation (doc comments with `///`).
parent 46007d61
...@@ -46,7 +46,8 @@ abstract class Logger { ...@@ -46,7 +46,8 @@ abstract class Logger {
/// since the last time it was set to false. /// since the last time it was set to false.
bool hadErrorOutput = 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. /// since the last time it was reset to false.
bool hadWarningOutput = false; bool hadWarningOutput = false;
...@@ -124,6 +125,7 @@ abstract class Logger { ...@@ -124,6 +125,7 @@ abstract class Logger {
int? indent, int? indent,
int? hangingIndent, int? hangingIndent,
bool? wrap, bool? wrap,
bool fatal = true,
}); });
/// Display normal output of the command. This should be used for things like /// Display normal output of the command. This should be used for things like
...@@ -314,6 +316,7 @@ class DelegatingLogger implements Logger { ...@@ -314,6 +316,7 @@ class DelegatingLogger implements Logger {
int? indent, int? indent,
int? hangingIndent, int? hangingIndent,
bool? wrap, bool? wrap,
bool fatal = true,
}) { }) {
_delegate.printWarning( _delegate.printWarning(
message, message,
...@@ -322,6 +325,7 @@ class DelegatingLogger implements Logger { ...@@ -322,6 +325,7 @@ class DelegatingLogger implements Logger {
indent: indent, indent: indent,
hangingIndent: hangingIndent, hangingIndent: hangingIndent,
wrap: wrap, wrap: wrap,
fatal: fatal,
); );
} }
...@@ -481,8 +485,9 @@ class StdoutLogger extends Logger { ...@@ -481,8 +485,9 @@ class StdoutLogger extends Logger {
int? indent, int? indent,
int? hangingIndent, int? hangingIndent,
bool? wrap, bool? wrap,
bool fatal = true,
}) { }) {
hadWarningOutput = true; hadWarningOutput = hadWarningOutput || fatal;
_status?.pause(); _status?.pause();
message = wrapText(message, message = wrapText(message,
indent: indent, indent: indent,
...@@ -820,8 +825,9 @@ class BufferLogger extends Logger { ...@@ -820,8 +825,9 @@ class BufferLogger extends Logger {
int? indent, int? indent,
int? hangingIndent, int? hangingIndent,
bool? wrap, bool? wrap,
bool fatal = true,
}) { }) {
hadWarningOutput = true; hadWarningOutput = hadWarningOutput || fatal;
_warning.writeln(terminal.color( _warning.writeln(terminal.color(
wrapText(message, wrapText(message,
indent: indent, indent: indent,
...@@ -965,6 +971,7 @@ class VerboseLogger extends DelegatingLogger { ...@@ -965,6 +971,7 @@ class VerboseLogger extends DelegatingLogger {
int? indent, int? indent,
int? hangingIndent, int? hangingIndent,
bool? wrap, bool? wrap,
bool fatal = true,
}) { }) {
hadWarningOutput = true; hadWarningOutput = true;
_emit( _emit(
......
...@@ -278,6 +278,9 @@ class Cache { ...@@ -278,6 +278,9 @@ class Cache {
// Whether to cache the unsigned mac binaries. Defaults to caching the signed binaries. // Whether to cache the unsigned mac binaries. Defaults to caching the signed binaries.
bool useUnsignedMacBinaries = false; bool useUnsignedMacBinaries = false;
// Whether the warning printed when a custom artifact URL is used is fatal.
bool fatalStorageWarning = true;
static RandomAccessFile? _lock; static RandomAccessFile? _lock;
static bool _lockEnabled = true; static bool _lockEnabled = true;
...@@ -340,12 +343,11 @@ class Cache { ...@@ -340,12 +343,11 @@ class Cache {
// version --machine"). It's not really a "warning" though, so print it // 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 // in grey. Also, make sure that it isn't counted as a warning for
// Logger.warningsAreFatal. // Logger.warningsAreFatal.
final bool oldWarnings = _logger.hadWarningOutput;
_logger.printWarning( _logger.printWarning(
'Waiting for another flutter command to release the startup lock...', 'Waiting for another flutter command to release the startup lock...',
color: TerminalColor.grey, color: TerminalColor.grey,
fatal: false,
); );
_logger.hadWarningOutput = oldWarnings;
printed = true; printed = true;
} }
await Future<void>.delayed(const Duration(milliseconds: 50)); await Future<void>.delayed(const Duration(milliseconds: 50));
...@@ -522,6 +524,7 @@ class Cache { ...@@ -522,6 +524,7 @@ class Cache {
_logger.printWarning( _logger.printWarning(
'Flutter assets will be downloaded from $overrideUrl. Make sure you trust this source!', 'Flutter assets will be downloaded from $overrideUrl. Make sure you trust this source!',
emphasis: true, emphasis: true,
fatal: false,
); );
_hasWarnedAboutStorageOverride = true; _hasWarnedAboutStorageOverride = true;
} }
......
...@@ -1250,6 +1250,7 @@ class NotifyingLogger extends DelegatingLogger { ...@@ -1250,6 +1250,7 @@ class NotifyingLogger extends DelegatingLogger {
int? indent, int? indent,
int? hangingIndent, int? hangingIndent,
bool? wrap, bool? wrap,
bool fatal = true,
}) { }) {
_sendMessage(LogMessage('warning', message)); _sendMessage(LogMessage('warning', message));
} }
......
...@@ -1138,8 +1138,9 @@ class StreamLogger extends Logger { ...@@ -1138,8 +1138,9 @@ class StreamLogger extends Logger {
int? indent, int? indent,
int? hangingIndent, int? hangingIndent,
bool? wrap, bool? wrap,
bool fatal = true,
}) { }) {
hadWarningOutput = true; hadWarningOutput = hadWarningOutput || fatal;
_log('[stderr] $message'); _log('[stderr] $message');
} }
......
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