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 {
/// 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(
......
......@@ -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<void>.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;
}
......
......@@ -1250,6 +1250,7 @@ class NotifyingLogger extends DelegatingLogger {
int? indent,
int? hangingIndent,
bool? wrap,
bool fatal = true,
}) {
_sendMessage(LogMessage('warning', message));
}
......
......@@ -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');
}
......
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