Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/flutter_tools/lib/src/base/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -314,6 +316,7 @@ class DelegatingLogger implements Logger {
int? indent,
int? hangingIndent,
bool? wrap,
bool fatal = true,
}) {
_delegate.printWarning(
message,
Expand All @@ -322,6 +325,7 @@ class DelegatingLogger implements Logger {
indent: indent,
hangingIndent: hangingIndent,
wrap: wrap,
fatal: fatal,
);
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -965,6 +971,7 @@ class VerboseLogger extends DelegatingLogger {
int? indent,
int? hangingIndent,
bool? wrap,
bool fatal = true,
}) {
hadWarningOutput = true;
_emit(
Expand Down
7 changes: 5 additions & 2 deletions packages/flutter_tools/lib/src/cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions packages/flutter_tools/lib/src/commands/daemon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,7 @@ class NotifyingLogger extends DelegatingLogger {
int? indent,
int? hangingIndent,
bool? wrap,
bool fatal = true,
}) {
_sendMessage(LogMessage('warning', message));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down