[flutter_tools] do not measure progress timeout (#67959)
Remove "This is taking a long time" progress timeout and TimeoutConfiguration.
This commit is contained in:
parent
3e0d2741de
commit
9e70180f63
@ -143,7 +143,6 @@ Future<void> main(List<String> args) async {
|
|||||||
outputPreferences: globals.outputPreferences,
|
outputPreferences: globals.outputPreferences,
|
||||||
terminal: globals.terminal,
|
terminal: globals.terminal,
|
||||||
stdio: globals.stdio,
|
stdio: globals.stdio,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
);
|
);
|
||||||
return loggerFactory.createLogger(
|
return loggerFactory.createLogger(
|
||||||
daemon: daemon,
|
daemon: daemon,
|
||||||
@ -163,17 +162,14 @@ class LoggerFactory {
|
|||||||
@required Terminal terminal,
|
@required Terminal terminal,
|
||||||
@required Stdio stdio,
|
@required Stdio stdio,
|
||||||
@required OutputPreferences outputPreferences,
|
@required OutputPreferences outputPreferences,
|
||||||
@required TimeoutConfiguration timeoutConfiguration,
|
|
||||||
StopwatchFactory stopwatchFactory = const StopwatchFactory(),
|
StopwatchFactory stopwatchFactory = const StopwatchFactory(),
|
||||||
}) : _terminal = terminal,
|
}) : _terminal = terminal,
|
||||||
_stdio = stdio,
|
_stdio = stdio,
|
||||||
_timeoutConfiguration = timeoutConfiguration,
|
|
||||||
_stopwatchFactory = stopwatchFactory,
|
_stopwatchFactory = stopwatchFactory,
|
||||||
_outputPreferences = outputPreferences;
|
_outputPreferences = outputPreferences;
|
||||||
|
|
||||||
final Terminal _terminal;
|
final Terminal _terminal;
|
||||||
final Stdio _stdio;
|
final Stdio _stdio;
|
||||||
final TimeoutConfiguration _timeoutConfiguration;
|
|
||||||
final StopwatchFactory _stopwatchFactory;
|
final StopwatchFactory _stopwatchFactory;
|
||||||
final OutputPreferences _outputPreferences;
|
final OutputPreferences _outputPreferences;
|
||||||
|
|
||||||
@ -190,7 +186,6 @@ class LoggerFactory {
|
|||||||
terminal: _terminal,
|
terminal: _terminal,
|
||||||
stdio: _stdio,
|
stdio: _stdio,
|
||||||
outputPreferences: _outputPreferences,
|
outputPreferences: _outputPreferences,
|
||||||
timeoutConfiguration: _timeoutConfiguration,
|
|
||||||
stopwatchFactory: _stopwatchFactory,
|
stopwatchFactory: _stopwatchFactory,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -198,7 +193,6 @@ class LoggerFactory {
|
|||||||
terminal: _terminal,
|
terminal: _terminal,
|
||||||
stdio: _stdio,
|
stdio: _stdio,
|
||||||
outputPreferences: _outputPreferences,
|
outputPreferences: _outputPreferences,
|
||||||
timeoutConfiguration: _timeoutConfiguration,
|
|
||||||
stopwatchFactory: _stopwatchFactory
|
stopwatchFactory: _stopwatchFactory
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,6 @@ class AndroidDevice extends Device {
|
|||||||
@required Platform platform,
|
@required Platform platform,
|
||||||
@required AndroidSdk androidSdk,
|
@required AndroidSdk androidSdk,
|
||||||
@required FileSystem fileSystem,
|
@required FileSystem fileSystem,
|
||||||
TimeoutConfiguration timeoutConfiguration = const TimeoutConfiguration(),
|
|
||||||
AndroidConsoleSocketFactory androidConsoleSocketFactory = kAndroidConsoleSocketFactory,
|
AndroidConsoleSocketFactory androidConsoleSocketFactory = kAndroidConsoleSocketFactory,
|
||||||
}) : _logger = logger,
|
}) : _logger = logger,
|
||||||
_processManager = processManager,
|
_processManager = processManager,
|
||||||
@ -71,7 +70,6 @@ class AndroidDevice extends Device {
|
|||||||
_platform = platform,
|
_platform = platform,
|
||||||
_fileSystem = fileSystem,
|
_fileSystem = fileSystem,
|
||||||
_androidConsoleSocketFactory = androidConsoleSocketFactory,
|
_androidConsoleSocketFactory = androidConsoleSocketFactory,
|
||||||
_timeoutConfiguration = timeoutConfiguration,
|
|
||||||
_processUtils = ProcessUtils(logger: logger, processManager: processManager),
|
_processUtils = ProcessUtils(logger: logger, processManager: processManager),
|
||||||
super(
|
super(
|
||||||
id,
|
id,
|
||||||
@ -87,7 +85,6 @@ class AndroidDevice extends Device {
|
|||||||
final FileSystem _fileSystem;
|
final FileSystem _fileSystem;
|
||||||
final ProcessUtils _processUtils;
|
final ProcessUtils _processUtils;
|
||||||
final AndroidConsoleSocketFactory _androidConsoleSocketFactory;
|
final AndroidConsoleSocketFactory _androidConsoleSocketFactory;
|
||||||
final TimeoutConfiguration _timeoutConfiguration;
|
|
||||||
|
|
||||||
final String productID;
|
final String productID;
|
||||||
final String modelID;
|
final String modelID;
|
||||||
@ -176,12 +173,12 @@ class AndroidDevice extends Device {
|
|||||||
try {
|
try {
|
||||||
await console
|
await console
|
||||||
.connect()
|
.connect()
|
||||||
.timeout(_timeoutConfiguration.fastOperation,
|
.timeout(const Duration(seconds: 2),
|
||||||
onTimeout: () => throw TimeoutException('Connection timed out'));
|
onTimeout: () => throw TimeoutException('Connection timed out'));
|
||||||
|
|
||||||
return await console
|
return await console
|
||||||
.getAvdName()
|
.getAvdName()
|
||||||
.timeout(_timeoutConfiguration.fastOperation,
|
.timeout(const Duration(seconds: 2),
|
||||||
onTimeout: () => throw TimeoutException('"avd name" timed out'));
|
onTimeout: () => throw TimeoutException('"avd name" timed out'));
|
||||||
} finally {
|
} finally {
|
||||||
console.destroy();
|
console.destroy();
|
||||||
@ -443,7 +440,6 @@ class AndroidDevice extends Device {
|
|||||||
|
|
||||||
final Status status = _logger.startProgress(
|
final Status status = _logger.startProgress(
|
||||||
'Installing ${_fileSystem.path.relative(app.file.path)}...',
|
'Installing ${_fileSystem.path.relative(app.file.path)}...',
|
||||||
timeout: _timeoutConfiguration.slowOperation,
|
|
||||||
);
|
);
|
||||||
final RunResult installResult = await _processUtils.run(
|
final RunResult installResult = await _processUtils.run(
|
||||||
adbCommandForDevice(<String>[
|
adbCommandForDevice(<String>[
|
||||||
|
@ -177,7 +177,6 @@ class AndroidDevices extends PollingDeviceDiscovery {
|
|||||||
logger: _logger,
|
logger: _logger,
|
||||||
platform: _platform,
|
platform: _platform,
|
||||||
processManager: _processManager,
|
processManager: _processManager,
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -136,7 +136,6 @@ Future<File> getGradleAppOut(AndroidProject androidProject) async {
|
|||||||
Future<void> checkGradleDependencies() async {
|
Future<void> checkGradleDependencies() async {
|
||||||
final Status progress = globals.logger.startProgress(
|
final Status progress = globals.logger.startProgress(
|
||||||
'Ensuring gradle dependencies are up to date...',
|
'Ensuring gradle dependencies are up to date...',
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
);
|
);
|
||||||
final FlutterProject flutterProject = FlutterProject.current();
|
final FlutterProject flutterProject = FlutterProject.current();
|
||||||
await processUtils.run(<String>[
|
await processUtils.run(<String>[
|
||||||
@ -167,8 +166,7 @@ void createSettingsAarGradle(Directory androidDirectory) {
|
|||||||
final String currentFileContent = currentSettingsFile.readAsStringSync();
|
final String currentFileContent = currentSettingsFile.readAsStringSync();
|
||||||
|
|
||||||
final String newSettingsRelativeFile = globals.fs.path.relative(newSettingsFile.path);
|
final String newSettingsRelativeFile = globals.fs.path.relative(newSettingsFile.path);
|
||||||
final Status status = globals.logger.startProgress('✏️ Creating `$newSettingsRelativeFile`...',
|
final Status status = globals.logger.startProgress('✏️ Creating `$newSettingsRelativeFile`...');
|
||||||
timeout: timeoutConfiguration.fastOperation);
|
|
||||||
|
|
||||||
final String flutterRoot = globals.fs.path.absolute(Cache.flutterRoot);
|
final String flutterRoot = globals.fs.path.absolute(Cache.flutterRoot);
|
||||||
final File legacySettingsDotGradleFiles = globals.fs.file(globals.fs.path.join(flutterRoot, 'packages','flutter_tools',
|
final File legacySettingsDotGradleFiles = globals.fs.file(globals.fs.path.join(flutterRoot, 'packages','flutter_tools',
|
||||||
@ -270,7 +268,6 @@ Future<void> buildGradleApp({
|
|||||||
|
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
"Running Gradle task '$assembleTask'...",
|
"Running Gradle task '$assembleTask'...",
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
multilineOutput: true,
|
multilineOutput: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -571,7 +568,6 @@ Future<void> buildGradleAar({
|
|||||||
final String aarTask = getAarTaskFor(buildInfo);
|
final String aarTask = getAarTaskFor(buildInfo);
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
"Running Gradle task '$aarTask'...",
|
"Running Gradle task '$aarTask'...",
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
multilineOutput: true,
|
multilineOutput: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ class AotBuilder {
|
|||||||
final String typeName = globals.artifacts.getEngineType(platform, buildInfo.mode);
|
final String typeName = globals.artifacts.getEngineType(platform, buildInfo.mode);
|
||||||
status = globals.logger.startProgress(
|
status = globals.logger.startProgress(
|
||||||
'Building AOT snapshot in ${getFriendlyModeName(buildInfo.mode)} mode ($typeName)...',
|
'Building AOT snapshot in ${getFriendlyModeName(buildInfo.mode)} mode ($typeName)...',
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
import '../base/context.dart';
|
|
||||||
import '../convert.dart';
|
import '../convert.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals.dart' as globals;
|
||||||
import 'io.dart';
|
import 'io.dart';
|
||||||
@ -14,13 +13,6 @@ import 'terminal.dart' show AnsiTerminal, Terminal, TerminalColor, OutputPrefere
|
|||||||
import 'utils.dart';
|
import 'utils.dart';
|
||||||
|
|
||||||
const int kDefaultStatusPadding = 59;
|
const int kDefaultStatusPadding = 59;
|
||||||
const Duration _kFastOperation = Duration(seconds: 2);
|
|
||||||
const Duration _kSlowOperation = Duration(minutes: 2);
|
|
||||||
|
|
||||||
/// The [TimeoutConfiguration] instance.
|
|
||||||
///
|
|
||||||
/// If not provided via injection, a default instance is provided.
|
|
||||||
TimeoutConfiguration get timeoutConfiguration => context.get<TimeoutConfiguration>() ?? const TimeoutConfiguration();
|
|
||||||
|
|
||||||
/// A factory for generating [Stopwatch] instances for [Status] instances.
|
/// A factory for generating [Stopwatch] instances for [Status] instances.
|
||||||
class StopwatchFactory {
|
class StopwatchFactory {
|
||||||
@ -31,22 +23,6 @@ class StopwatchFactory {
|
|||||||
Stopwatch createStopwatch() => Stopwatch();
|
Stopwatch createStopwatch() => Stopwatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
class TimeoutConfiguration {
|
|
||||||
const TimeoutConfiguration();
|
|
||||||
|
|
||||||
/// The expected time that various "slow" operations take, such as running
|
|
||||||
/// the analyzer.
|
|
||||||
///
|
|
||||||
/// Defaults to 2 minutes.
|
|
||||||
Duration get slowOperation => _kSlowOperation;
|
|
||||||
|
|
||||||
/// The expected time that various "fast" operations take, such as a hot
|
|
||||||
/// reload.
|
|
||||||
///
|
|
||||||
/// Defaults to 2 seconds.
|
|
||||||
Duration get fastOperation => _kFastOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef VoidCallback = void Function();
|
typedef VoidCallback = void Function();
|
||||||
|
|
||||||
abstract class Logger {
|
abstract class Logger {
|
||||||
@ -62,8 +38,6 @@ abstract class Logger {
|
|||||||
|
|
||||||
OutputPreferences get _outputPreferences;
|
OutputPreferences get _outputPreferences;
|
||||||
|
|
||||||
TimeoutConfiguration get _timeoutConfiguration;
|
|
||||||
|
|
||||||
/// Display an error `message` to the user. Commands should use this if they
|
/// Display an error `message` to the user. Commands should use this if they
|
||||||
/// fail in some way.
|
/// fail in some way.
|
||||||
///
|
///
|
||||||
@ -144,12 +118,6 @@ abstract class Logger {
|
|||||||
///
|
///
|
||||||
/// The `message` argument is the message to display to the user.
|
/// The `message` argument is the message to display to the user.
|
||||||
///
|
///
|
||||||
/// The `timeout` argument sets a duration after which an additional message
|
|
||||||
/// may be shown saying that the operation is taking a long time. (Not all
|
|
||||||
/// [Status] subclasses show such a message.) Set this to null if the
|
|
||||||
/// operation can legitimately take an arbitrary amount of time (e.g. waiting
|
|
||||||
/// for the user).
|
|
||||||
///
|
|
||||||
/// The `progressId` argument provides an ID that can be used to identify
|
/// The `progressId` argument provides an ID that can be used to identify
|
||||||
/// this type of progress (e.g. `hot.reload`, `hot.restart`).
|
/// this type of progress (e.g. `hot.reload`, `hot.restart`).
|
||||||
///
|
///
|
||||||
@ -157,7 +125,6 @@ abstract class Logger {
|
|||||||
/// between the `message` and the progress indicator, if any.
|
/// between the `message` and the progress indicator, if any.
|
||||||
Status startProgress(
|
Status startProgress(
|
||||||
String message, {
|
String message, {
|
||||||
@required Duration timeout,
|
|
||||||
String progressId,
|
String progressId,
|
||||||
bool multilineOutput = false,
|
bool multilineOutput = false,
|
||||||
int progressIndicatorPadding = kDefaultStatusPadding,
|
int progressIndicatorPadding = kDefaultStatusPadding,
|
||||||
@ -198,9 +165,6 @@ class DelegatingLogger implements Logger {
|
|||||||
@override
|
@override
|
||||||
OutputPreferences get _outputPreferences => _delegate._outputPreferences;
|
OutputPreferences get _outputPreferences => _delegate._outputPreferences;
|
||||||
|
|
||||||
@override
|
|
||||||
TimeoutConfiguration get _timeoutConfiguration => _delegate._timeoutConfiguration;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get isVerbose => _delegate.isVerbose;
|
bool get isVerbose => _delegate.isVerbose;
|
||||||
|
|
||||||
@ -240,9 +204,8 @@ class DelegatingLogger implements Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Status startProgress(String message, {Duration timeout, String progressId, bool multilineOutput = false, int progressIndicatorPadding = kDefaultStatusPadding}) {
|
Status startProgress(String message, {String progressId, bool multilineOutput = false, int progressIndicatorPadding = kDefaultStatusPadding}) {
|
||||||
return _delegate.startProgress(message,
|
return _delegate.startProgress(message,
|
||||||
timeout: timeout,
|
|
||||||
progressId: progressId,
|
progressId: progressId,
|
||||||
multilineOutput: multilineOutput,
|
multilineOutput: multilineOutput,
|
||||||
progressIndicatorPadding: progressIndicatorPadding,
|
progressIndicatorPadding: progressIndicatorPadding,
|
||||||
@ -279,12 +242,10 @@ class StdoutLogger extends Logger {
|
|||||||
@required Terminal terminal,
|
@required Terminal terminal,
|
||||||
@required Stdio stdio,
|
@required Stdio stdio,
|
||||||
@required OutputPreferences outputPreferences,
|
@required OutputPreferences outputPreferences,
|
||||||
@required TimeoutConfiguration timeoutConfiguration,
|
|
||||||
StopwatchFactory stopwatchFactory = const StopwatchFactory(),
|
StopwatchFactory stopwatchFactory = const StopwatchFactory(),
|
||||||
})
|
})
|
||||||
: _stdio = stdio,
|
: _stdio = stdio,
|
||||||
_terminal = terminal,
|
_terminal = terminal,
|
||||||
_timeoutConfiguration = timeoutConfiguration,
|
|
||||||
_outputPreferences = outputPreferences,
|
_outputPreferences = outputPreferences,
|
||||||
_stopwatchFactory = stopwatchFactory;
|
_stopwatchFactory = stopwatchFactory;
|
||||||
|
|
||||||
@ -292,8 +253,6 @@ class StdoutLogger extends Logger {
|
|||||||
final Terminal _terminal;
|
final Terminal _terminal;
|
||||||
@override
|
@override
|
||||||
final OutputPreferences _outputPreferences;
|
final OutputPreferences _outputPreferences;
|
||||||
@override
|
|
||||||
final TimeoutConfiguration _timeoutConfiguration;
|
|
||||||
final Stdio _stdio;
|
final Stdio _stdio;
|
||||||
final StopwatchFactory _stopwatchFactory;
|
final StopwatchFactory _stopwatchFactory;
|
||||||
|
|
||||||
@ -380,7 +339,6 @@ class StdoutLogger extends Logger {
|
|||||||
@override
|
@override
|
||||||
Status startProgress(
|
Status startProgress(
|
||||||
String message, {
|
String message, {
|
||||||
@required Duration timeout,
|
|
||||||
String progressId,
|
String progressId,
|
||||||
bool multilineOutput = false,
|
bool multilineOutput = false,
|
||||||
int progressIndicatorPadding = kDefaultStatusPadding,
|
int progressIndicatorPadding = kDefaultStatusPadding,
|
||||||
@ -389,32 +347,26 @@ class StdoutLogger extends Logger {
|
|||||||
if (_status != null) {
|
if (_status != null) {
|
||||||
// Ignore nested progresses; return a no-op status object.
|
// Ignore nested progresses; return a no-op status object.
|
||||||
return SilentStatus(
|
return SilentStatus(
|
||||||
timeout: timeout,
|
|
||||||
onFinish: _clearStatus,
|
onFinish: _clearStatus,
|
||||||
timeoutConfiguration: _timeoutConfiguration,
|
|
||||||
stopwatch: _stopwatchFactory.createStopwatch(),
|
stopwatch: _stopwatchFactory.createStopwatch(),
|
||||||
)..start();
|
)..start();
|
||||||
}
|
}
|
||||||
if (supportsColor) {
|
if (supportsColor) {
|
||||||
_status = AnsiStatus(
|
_status = AnsiStatus(
|
||||||
message: message,
|
message: message,
|
||||||
timeout: timeout,
|
|
||||||
multilineOutput: multilineOutput,
|
multilineOutput: multilineOutput,
|
||||||
padding: progressIndicatorPadding,
|
padding: progressIndicatorPadding,
|
||||||
onFinish: _clearStatus,
|
onFinish: _clearStatus,
|
||||||
stdio: _stdio,
|
stdio: _stdio,
|
||||||
timeoutConfiguration: _timeoutConfiguration,
|
|
||||||
stopwatch: _stopwatchFactory.createStopwatch(),
|
stopwatch: _stopwatchFactory.createStopwatch(),
|
||||||
terminal: _terminal,
|
terminal: _terminal,
|
||||||
)..start();
|
)..start();
|
||||||
} else {
|
} else {
|
||||||
_status = SummaryStatus(
|
_status = SummaryStatus(
|
||||||
message: message,
|
message: message,
|
||||||
timeout: timeout,
|
|
||||||
padding: progressIndicatorPadding,
|
padding: progressIndicatorPadding,
|
||||||
onFinish: _clearStatus,
|
onFinish: _clearStatus,
|
||||||
stdio: _stdio,
|
stdio: _stdio,
|
||||||
timeoutConfiguration: _timeoutConfiguration,
|
|
||||||
stopwatch: _stopwatchFactory.createStopwatch(),
|
stopwatch: _stopwatchFactory.createStopwatch(),
|
||||||
)..start();
|
)..start();
|
||||||
}
|
}
|
||||||
@ -449,13 +401,11 @@ class WindowsStdoutLogger extends StdoutLogger {
|
|||||||
@required Terminal terminal,
|
@required Terminal terminal,
|
||||||
@required Stdio stdio,
|
@required Stdio stdio,
|
||||||
@required OutputPreferences outputPreferences,
|
@required OutputPreferences outputPreferences,
|
||||||
@required TimeoutConfiguration timeoutConfiguration,
|
|
||||||
StopwatchFactory stopwatchFactory = const StopwatchFactory(),
|
StopwatchFactory stopwatchFactory = const StopwatchFactory(),
|
||||||
}) : super(
|
}) : super(
|
||||||
terminal: terminal,
|
terminal: terminal,
|
||||||
stdio: stdio,
|
stdio: stdio,
|
||||||
outputPreferences: outputPreferences,
|
outputPreferences: outputPreferences,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatchFactory: stopwatchFactory,
|
stopwatchFactory: stopwatchFactory,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -477,11 +427,9 @@ class BufferLogger extends Logger {
|
|||||||
BufferLogger({
|
BufferLogger({
|
||||||
@required AnsiTerminal terminal,
|
@required AnsiTerminal terminal,
|
||||||
@required OutputPreferences outputPreferences,
|
@required OutputPreferences outputPreferences,
|
||||||
TimeoutConfiguration timeoutConfiguration = const TimeoutConfiguration(),
|
|
||||||
StopwatchFactory stopwatchFactory = const StopwatchFactory(),
|
StopwatchFactory stopwatchFactory = const StopwatchFactory(),
|
||||||
}) : _outputPreferences = outputPreferences,
|
}) : _outputPreferences = outputPreferences,
|
||||||
_terminal = terminal,
|
_terminal = terminal,
|
||||||
_timeoutConfiguration = timeoutConfiguration,
|
|
||||||
_stopwatchFactory = stopwatchFactory;
|
_stopwatchFactory = stopwatchFactory;
|
||||||
|
|
||||||
/// Create a [BufferLogger] with test preferences.
|
/// Create a [BufferLogger] with test preferences.
|
||||||
@ -490,7 +438,6 @@ class BufferLogger extends Logger {
|
|||||||
OutputPreferences outputPreferences,
|
OutputPreferences outputPreferences,
|
||||||
}) : _terminal = terminal ?? Terminal.test(),
|
}) : _terminal = terminal ?? Terminal.test(),
|
||||||
_outputPreferences = outputPreferences ?? OutputPreferences.test(),
|
_outputPreferences = outputPreferences ?? OutputPreferences.test(),
|
||||||
_timeoutConfiguration = const TimeoutConfiguration(),
|
|
||||||
_stopwatchFactory = const StopwatchFactory();
|
_stopwatchFactory = const StopwatchFactory();
|
||||||
|
|
||||||
|
|
||||||
@ -500,9 +447,6 @@ class BufferLogger extends Logger {
|
|||||||
@override
|
@override
|
||||||
final Terminal _terminal;
|
final Terminal _terminal;
|
||||||
|
|
||||||
@override
|
|
||||||
final TimeoutConfiguration _timeoutConfiguration;
|
|
||||||
|
|
||||||
final StopwatchFactory _stopwatchFactory;
|
final StopwatchFactory _stopwatchFactory;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -578,7 +522,6 @@ class BufferLogger extends Logger {
|
|||||||
@override
|
@override
|
||||||
Status startProgress(
|
Status startProgress(
|
||||||
String message, {
|
String message, {
|
||||||
@required Duration timeout,
|
|
||||||
String progressId,
|
String progressId,
|
||||||
bool multilineOutput = false,
|
bool multilineOutput = false,
|
||||||
int progressIndicatorPadding = kDefaultStatusPadding,
|
int progressIndicatorPadding = kDefaultStatusPadding,
|
||||||
@ -586,8 +529,6 @@ class BufferLogger extends Logger {
|
|||||||
assert(progressIndicatorPadding != null);
|
assert(progressIndicatorPadding != null);
|
||||||
printStatus(message);
|
printStatus(message);
|
||||||
return SilentStatus(
|
return SilentStatus(
|
||||||
timeout: timeout,
|
|
||||||
timeoutConfiguration: _timeoutConfiguration,
|
|
||||||
stopwatch: _stopwatchFactory.createStopwatch(),
|
stopwatch: _stopwatchFactory.createStopwatch(),
|
||||||
)..start();
|
)..start();
|
||||||
}
|
}
|
||||||
@ -673,7 +614,6 @@ class VerboseLogger extends DelegatingLogger {
|
|||||||
@override
|
@override
|
||||||
Status startProgress(
|
Status startProgress(
|
||||||
String message, {
|
String message, {
|
||||||
@required Duration timeout,
|
|
||||||
String progressId,
|
String progressId,
|
||||||
bool multilineOutput = false,
|
bool multilineOutput = false,
|
||||||
int progressIndicatorPadding = kDefaultStatusPadding,
|
int progressIndicatorPadding = kDefaultStatusPadding,
|
||||||
@ -682,22 +622,16 @@ class VerboseLogger extends DelegatingLogger {
|
|||||||
printStatus(message);
|
printStatus(message);
|
||||||
final Stopwatch timer = _stopwatchFactory.createStopwatch()..start();
|
final Stopwatch timer = _stopwatchFactory.createStopwatch()..start();
|
||||||
return SilentStatus(
|
return SilentStatus(
|
||||||
timeout: timeout,
|
|
||||||
timeoutConfiguration: _timeoutConfiguration,
|
|
||||||
// This is intentionally a different stopwatch than above.
|
// This is intentionally a different stopwatch than above.
|
||||||
stopwatch: _stopwatchFactory.createStopwatch(),
|
stopwatch: _stopwatchFactory.createStopwatch(),
|
||||||
onFinish: () {
|
onFinish: () {
|
||||||
String time;
|
String time;
|
||||||
if (timeout == null || timeout > _timeoutConfiguration.fastOperation) {
|
if (timer.elapsed.inSeconds > 2) {
|
||||||
time = getElapsedAsSeconds(timer.elapsed);
|
time = getElapsedAsSeconds(timer.elapsed);
|
||||||
} else {
|
} else {
|
||||||
time = getElapsedAsMilliseconds(timer.elapsed);
|
time = getElapsedAsMilliseconds(timer.elapsed);
|
||||||
}
|
}
|
||||||
if (timeout != null && timer.elapsed > timeout) {
|
printTrace('$message (completed in $time)');
|
||||||
printTrace('$message (completed in $time, longer than expected)');
|
|
||||||
} else {
|
|
||||||
printTrace('$message (completed in $time)');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)..start();
|
)..start();
|
||||||
}
|
}
|
||||||
@ -748,9 +682,6 @@ typedef SlowWarningCallback = String Function();
|
|||||||
/// A [Status] class begins when start is called, and may produce progress
|
/// A [Status] class begins when start is called, and may produce progress
|
||||||
/// information asynchronously.
|
/// information asynchronously.
|
||||||
///
|
///
|
||||||
/// Some subclasses change output once [timeout] has expired, to indicate that
|
|
||||||
/// something is taking longer than expected.
|
|
||||||
///
|
|
||||||
/// The [SilentStatus] class never has any output.
|
/// The [SilentStatus] class never has any output.
|
||||||
///
|
///
|
||||||
/// The [AnsiSpinner] subclass shows a spinner, and replaces it with a single
|
/// The [AnsiSpinner] subclass shows a spinner, and replaces it with a single
|
||||||
@ -767,55 +698,38 @@ typedef SlowWarningCallback = String Function();
|
|||||||
/// a [Status] or one of its subclasses.
|
/// a [Status] or one of its subclasses.
|
||||||
abstract class Status {
|
abstract class Status {
|
||||||
Status({
|
Status({
|
||||||
@required this.timeout,
|
|
||||||
@required TimeoutConfiguration timeoutConfiguration,
|
|
||||||
this.onFinish,
|
this.onFinish,
|
||||||
@required Stopwatch stopwatch,
|
@required Stopwatch stopwatch,
|
||||||
}) : _timeoutConfiguration = timeoutConfiguration,
|
}) : _stopwatch = stopwatch;
|
||||||
_stopwatch = stopwatch;
|
|
||||||
|
|
||||||
/// A [SilentStatus] or an [AnsiSpinner] (depending on whether the
|
/// A [SilentStatus] or an [AnsiSpinner] (depending on whether the
|
||||||
/// terminal is fancy enough), already started.
|
/// terminal is fancy enough), already started.
|
||||||
factory Status.withSpinner({
|
factory Status.withSpinner({
|
||||||
@required Duration timeout,
|
|
||||||
@required TimeoutConfiguration timeoutConfiguration,
|
|
||||||
@required Stopwatch stopwatch,
|
@required Stopwatch stopwatch,
|
||||||
@required Terminal terminal,
|
@required Terminal terminal,
|
||||||
VoidCallback onFinish,
|
VoidCallback onFinish,
|
||||||
SlowWarningCallback slowWarningCallback,
|
|
||||||
}) {
|
}) {
|
||||||
if (terminal.supportsColor) {
|
if (terminal.supportsColor) {
|
||||||
return AnsiSpinner(
|
return AnsiSpinner(
|
||||||
timeout: timeout,
|
|
||||||
onFinish: onFinish,
|
onFinish: onFinish,
|
||||||
slowWarningCallback: slowWarningCallback,
|
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatch: stopwatch,
|
stopwatch: stopwatch,
|
||||||
terminal: terminal,
|
terminal: terminal,
|
||||||
)..start();
|
)..start();
|
||||||
}
|
}
|
||||||
return SilentStatus(
|
return SilentStatus(
|
||||||
timeout: timeout,
|
|
||||||
onFinish: onFinish,
|
onFinish: onFinish,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatch: stopwatch,
|
stopwatch: stopwatch,
|
||||||
)..start();
|
)..start();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Duration timeout;
|
|
||||||
final VoidCallback onFinish;
|
final VoidCallback onFinish;
|
||||||
final TimeoutConfiguration _timeoutConfiguration;
|
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
final Stopwatch _stopwatch;
|
final Stopwatch _stopwatch;
|
||||||
|
|
||||||
@protected
|
|
||||||
@visibleForTesting
|
|
||||||
bool get seemsSlow => timeout != null && _stopwatch.elapsed > timeout;
|
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
String get elapsedTime {
|
String get elapsedTime {
|
||||||
if (timeout == null || timeout > _timeoutConfiguration.fastOperation) {
|
if (_stopwatch.elapsed.inSeconds > 2) {
|
||||||
return getElapsedAsSeconds(_stopwatch.elapsed);
|
return getElapsedAsSeconds(_stopwatch.elapsed);
|
||||||
}
|
}
|
||||||
return getElapsedAsMilliseconds(_stopwatch.elapsed);
|
return getElapsedAsMilliseconds(_stopwatch.elapsed);
|
||||||
@ -856,14 +770,10 @@ abstract class Status {
|
|||||||
/// A [SilentStatus] shows nothing.
|
/// A [SilentStatus] shows nothing.
|
||||||
class SilentStatus extends Status {
|
class SilentStatus extends Status {
|
||||||
SilentStatus({
|
SilentStatus({
|
||||||
@required Duration timeout,
|
|
||||||
@required TimeoutConfiguration timeoutConfiguration,
|
|
||||||
@required Stopwatch stopwatch,
|
@required Stopwatch stopwatch,
|
||||||
VoidCallback onFinish,
|
VoidCallback onFinish,
|
||||||
}) : super(
|
}) : super(
|
||||||
timeout: timeout,
|
|
||||||
onFinish: onFinish,
|
onFinish: onFinish,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatch: stopwatch,
|
stopwatch: stopwatch,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -880,8 +790,6 @@ class SilentStatus extends Status {
|
|||||||
class SummaryStatus extends Status {
|
class SummaryStatus extends Status {
|
||||||
SummaryStatus({
|
SummaryStatus({
|
||||||
this.message = '',
|
this.message = '',
|
||||||
@required Duration timeout,
|
|
||||||
@required TimeoutConfiguration timeoutConfiguration,
|
|
||||||
@required Stopwatch stopwatch,
|
@required Stopwatch stopwatch,
|
||||||
this.padding = kDefaultStatusPadding,
|
this.padding = kDefaultStatusPadding,
|
||||||
VoidCallback onFinish,
|
VoidCallback onFinish,
|
||||||
@ -890,9 +798,7 @@ class SummaryStatus extends Status {
|
|||||||
assert(padding != null),
|
assert(padding != null),
|
||||||
_stdio = stdio ?? globals.stdio,
|
_stdio = stdio ?? globals.stdio,
|
||||||
super(
|
super(
|
||||||
timeout: timeout,
|
|
||||||
onFinish: onFinish,
|
onFinish: onFinish,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatch: stopwatch,
|
stopwatch: stopwatch,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -935,18 +841,9 @@ class SummaryStatus extends Status {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Prints a (minimum) 8 character padded time.
|
/// Prints a (minimum) 8 character padded time.
|
||||||
///
|
|
||||||
/// If [timeout] is less than or equal to [kFastOperation], the time is in
|
|
||||||
/// seconds; otherwise, milliseconds. If the time is longer than [timeout],
|
|
||||||
/// appends "(!)" to the time.
|
|
||||||
///
|
|
||||||
/// Examples: ` 0.5s`, ` 150ms`, ` 1,600ms`, ` 3.1s (!)`
|
|
||||||
void writeSummaryInformation() {
|
void writeSummaryInformation() {
|
||||||
assert(_messageShowingOnCurrentLine);
|
assert(_messageShowingOnCurrentLine);
|
||||||
_writeToStdOut(elapsedTime.padLeft(_kTimePadding));
|
_writeToStdOut(elapsedTime.padLeft(_kTimePadding));
|
||||||
if (seemsSlow) {
|
|
||||||
_writeToStdOut(' (!)');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -959,24 +856,16 @@ class SummaryStatus extends Status {
|
|||||||
|
|
||||||
/// An [AnsiSpinner] is a simple animation that does nothing but implement a
|
/// An [AnsiSpinner] is a simple animation that does nothing but implement a
|
||||||
/// terminal spinner. When stopped or canceled, the animation erases itself.
|
/// terminal spinner. When stopped or canceled, the animation erases itself.
|
||||||
///
|
|
||||||
/// If the timeout expires, a customizable warning is shown (but the spinner
|
|
||||||
/// continues otherwise unabated).
|
|
||||||
class AnsiSpinner extends Status {
|
class AnsiSpinner extends Status {
|
||||||
AnsiSpinner({
|
AnsiSpinner({
|
||||||
@required Duration timeout,
|
|
||||||
@required TimeoutConfiguration timeoutConfiguration,
|
|
||||||
@required Stopwatch stopwatch,
|
@required Stopwatch stopwatch,
|
||||||
@required Terminal terminal,
|
@required Terminal terminal,
|
||||||
VoidCallback onFinish,
|
VoidCallback onFinish,
|
||||||
this.slowWarningCallback,
|
|
||||||
Stdio stdio,
|
Stdio stdio,
|
||||||
}) : _stdio = stdio ?? globals.stdio,
|
}) : _stdio = stdio ?? globals.stdio,
|
||||||
_terminal = terminal,
|
_terminal = terminal,
|
||||||
super(
|
super(
|
||||||
timeout: timeout,
|
|
||||||
onFinish: onFinish,
|
onFinish: onFinish,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatch: stopwatch,
|
stopwatch: stopwatch,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -995,13 +884,8 @@ class AnsiSpinner extends Status {
|
|||||||
? const <String>[r'-', r'\', r'|', r'/']
|
? const <String>[r'-', r'\', r'|', r'/']
|
||||||
: const <String>['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷'];
|
: const <String>['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷'];
|
||||||
|
|
||||||
static const String _defaultSlowWarning = '(This is taking an unexpectedly long time.)';
|
|
||||||
final SlowWarningCallback slowWarningCallback;
|
|
||||||
|
|
||||||
String _slowWarning = '';
|
|
||||||
|
|
||||||
String get _currentAnimationFrame => _animation[ticks % _animation.length];
|
String get _currentAnimationFrame => _animation[ticks % _animation.length];
|
||||||
int get _currentLength => _currentAnimationFrame.length + _slowWarning.length;
|
int get _currentLength => _currentAnimationFrame.length;
|
||||||
String get _backspace => _backspaceChar * (spinnerIndent + _currentLength);
|
String get _backspace => _backspaceChar * (spinnerIndent + _currentLength);
|
||||||
String get _clear => _clearChar * (spinnerIndent + _currentLength);
|
String get _clear => _clearChar * (spinnerIndent + _currentLength);
|
||||||
|
|
||||||
@ -1029,18 +913,6 @@ class AnsiSpinner extends Status {
|
|||||||
assert(timer.isActive);
|
assert(timer.isActive);
|
||||||
_writeToStdOut(_backspace);
|
_writeToStdOut(_backspace);
|
||||||
ticks += 1;
|
ticks += 1;
|
||||||
if (seemsSlow) {
|
|
||||||
if (!timedOut) {
|
|
||||||
timedOut = true;
|
|
||||||
_writeToStdOut('$_clear\n');
|
|
||||||
}
|
|
||||||
if (slowWarningCallback != null) {
|
|
||||||
_slowWarning = slowWarningCallback();
|
|
||||||
} else {
|
|
||||||
_slowWarning = _defaultSlowWarning;
|
|
||||||
}
|
|
||||||
_writeToStdOut(_slowWarning);
|
|
||||||
}
|
|
||||||
_writeToStdOut('${_clearChar * spinnerIndent}$_currentAnimationFrame');
|
_writeToStdOut('${_clearChar * spinnerIndent}$_currentAnimationFrame');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1087,20 +959,16 @@ class AnsiStatus extends AnsiSpinner {
|
|||||||
this.message = '',
|
this.message = '',
|
||||||
this.multilineOutput = false,
|
this.multilineOutput = false,
|
||||||
this.padding = kDefaultStatusPadding,
|
this.padding = kDefaultStatusPadding,
|
||||||
@required Duration timeout,
|
|
||||||
@required Stopwatch stopwatch,
|
@required Stopwatch stopwatch,
|
||||||
@required Terminal terminal,
|
@required Terminal terminal,
|
||||||
VoidCallback onFinish,
|
VoidCallback onFinish,
|
||||||
Stdio stdio,
|
Stdio stdio,
|
||||||
TimeoutConfiguration timeoutConfiguration,
|
|
||||||
}) : assert(message != null),
|
}) : assert(message != null),
|
||||||
assert(multilineOutput != null),
|
assert(multilineOutput != null),
|
||||||
assert(padding != null),
|
assert(padding != null),
|
||||||
super(
|
super(
|
||||||
timeout: timeout,
|
|
||||||
onFinish: onFinish,
|
onFinish: onFinish,
|
||||||
stdio: stdio,
|
stdio: stdio,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatch: stopwatch,
|
stopwatch: stopwatch,
|
||||||
terminal: terminal,
|
terminal: terminal,
|
||||||
);
|
);
|
||||||
@ -1152,9 +1020,6 @@ class AnsiStatus extends AnsiSpinner {
|
|||||||
_writeToStdOut('\n${'$message Done'.padRight(padding)}$_margin');
|
_writeToStdOut('\n${'$message Done'.padRight(padding)}$_margin');
|
||||||
}
|
}
|
||||||
_writeToStdOut(elapsedTime.padLeft(_kTimePadding));
|
_writeToStdOut(elapsedTime.padLeft(_kTimePadding));
|
||||||
if (seemsSlow) {
|
|
||||||
_writeToStdOut(' (!)');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _clearStatus() {
|
void _clearStatus() {
|
||||||
|
@ -538,7 +538,6 @@ class Cache {
|
|||||||
Future<bool> doesRemoteExist(String message, Uri url) async {
|
Future<bool> doesRemoteExist(String message, Uri url) async {
|
||||||
final Status status = _logger.startProgress(
|
final Status status = _logger.startProgress(
|
||||||
message,
|
message,
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
);
|
);
|
||||||
bool exists;
|
bool exists;
|
||||||
try {
|
try {
|
||||||
@ -1079,8 +1078,7 @@ class AndroidMavenArtifacts extends ArtifactSet {
|
|||||||
);
|
);
|
||||||
gradleUtils.injectGradleWrapperIfNeeded(tempDir);
|
gradleUtils.injectGradleWrapperIfNeeded(tempDir);
|
||||||
|
|
||||||
final Status status = globals.logger.startProgress('Downloading Android Maven dependencies...',
|
final Status status = globals.logger.startProgress('Downloading Android Maven dependencies...');
|
||||||
timeout: timeoutConfiguration.slowOperation);
|
|
||||||
final File gradle = tempDir.childFile(
|
final File gradle = tempDir.childFile(
|
||||||
globals.platform.isWindows ? 'gradlew.bat' : 'gradlew',
|
globals.platform.isWindows ? 'gradlew.bat' : 'gradlew',
|
||||||
);
|
);
|
||||||
@ -1597,7 +1595,6 @@ class ArtifactUpdater {
|
|||||||
while (retries > 0) {
|
while (retries > 0) {
|
||||||
status = _logger.startProgress(
|
status = _logger.startProgress(
|
||||||
message,
|
message,
|
||||||
timeout: null, // This will take a variable amount of time based on network connectivity.
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
_ensureExists(tempFile.parent);
|
_ensureExists(tempFile.parent);
|
||||||
|
@ -102,7 +102,7 @@ class AnalyzeContinuously extends AnalyzeBase {
|
|||||||
if (!firstAnalysis) {
|
if (!firstAnalysis) {
|
||||||
logger.printStatus('\n');
|
logger.printStatus('\n');
|
||||||
}
|
}
|
||||||
analysisStatus = logger.startProgress('Analyzing $analysisTarget...', timeout: timeoutConfiguration.slowOperation);
|
analysisStatus = logger.startProgress('Analyzing $analysisTarget...');
|
||||||
analyzedPaths.clear();
|
analyzedPaths.clear();
|
||||||
analysisTimer = Stopwatch()..start();
|
analysisTimer = Stopwatch()..start();
|
||||||
} else {
|
} else {
|
||||||
|
@ -137,7 +137,6 @@ class AnalyzeOnce extends AnalyzeBase {
|
|||||||
progress = argResults['preamble'] as bool
|
progress = argResults['preamble'] as bool
|
||||||
? logger.startProgress(
|
? logger.startProgress(
|
||||||
'Analyzing $message...',
|
'Analyzing $message...',
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
)
|
)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
' └─Moving to ${globals.fs.path.relative(modeDirectory.path)}', timeout: timeoutConfiguration.slowOperation);
|
' └─Moving to ${globals.fs.path.relative(modeDirectory.path)}');
|
||||||
try {
|
try {
|
||||||
// Delete the intermediaries since they would have been copied into our
|
// Delete the intermediaries since they would have been copied into our
|
||||||
// output frameworks.
|
// output frameworks.
|
||||||
@ -230,7 +230,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
|
|||||||
/// vendored framework caching.
|
/// vendored framework caching.
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
void produceFlutterPodspec(BuildMode mode, Directory modeDirectory, { bool force = false }) {
|
void produceFlutterPodspec(BuildMode mode, Directory modeDirectory, { bool force = false }) {
|
||||||
final Status status = globals.logger.startProgress(' ├─Creating Flutter.podspec...', timeout: timeoutConfiguration.fastOperation);
|
final Status status = globals.logger.startProgress(' ├─Creating Flutter.podspec...');
|
||||||
try {
|
try {
|
||||||
final GitTagVersion gitTagVersion = _flutterVersion.gitTagVersion;
|
final GitTagVersion gitTagVersion = _flutterVersion.gitTagVersion;
|
||||||
if (!force && (gitTagVersion.x == null || gitTagVersion.y == null || gitTagVersion.z == null || gitTagVersion.commits != 0)) {
|
if (!force && (gitTagVersion.x == null || gitTagVersion.y == null || gitTagVersion.z == null || gitTagVersion.commits != 0)) {
|
||||||
@ -290,7 +290,6 @@ end
|
|||||||
) async {
|
) async {
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
' ├─Populating Flutter.framework...',
|
' ├─Populating Flutter.framework...',
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
);
|
);
|
||||||
final String engineCacheFlutterFrameworkDirectory = globals.artifacts.getArtifactPath(
|
final String engineCacheFlutterFrameworkDirectory = globals.artifacts.getArtifactPath(
|
||||||
Artifact.flutterFramework,
|
Artifact.flutterFramework,
|
||||||
@ -347,7 +346,6 @@ end
|
|||||||
|
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
' ├─Building App.framework...',
|
' ├─Building App.framework...',
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
Target target;
|
Target target;
|
||||||
@ -411,7 +409,8 @@ end
|
|||||||
Directory outputDirectory,
|
Directory outputDirectory,
|
||||||
) async {
|
) async {
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
' ├─Building plugins...', timeout: timeoutConfiguration.slowOperation);
|
' ├─Building plugins...'
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
// Regardless of the last "flutter build" build mode,
|
// Regardless of the last "flutter build" build mode,
|
||||||
// copy the corresponding engine.
|
// copy the corresponding engine.
|
||||||
@ -572,7 +571,6 @@ end
|
|||||||
|
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
' ├─Creating $frameworkBinaryName.xcframework...',
|
' ├─Creating $frameworkBinaryName.xcframework...',
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
if (buildInfo.mode == BuildMode.debug) {
|
if (buildInfo.mode == BuildMode.debug) {
|
||||||
|
@ -67,7 +67,6 @@ class CleanCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
final Status xcodeStatus = globals.logger.startProgress(
|
final Status xcodeStatus = globals.logger.startProgress(
|
||||||
'Cleaning Xcode workspace...',
|
'Cleaning Xcode workspace...',
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
final Directory xcodeWorkspace = xcodeProject.xcodeWorkspace;
|
final Directory xcodeWorkspace = xcodeProject.xcodeWorkspace;
|
||||||
@ -95,7 +94,6 @@ class CleanCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
final Status deletionStatus = globals.logger.startProgress(
|
final Status deletionStatus = globals.logger.startProgress(
|
||||||
'Deleting ${file.basename}...',
|
'Deleting ${file.basename}...',
|
||||||
timeout: timeoutConfiguration.fastOperation,
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
file.deleteSync(recursive: true);
|
file.deleteSync(recursive: true);
|
||||||
|
@ -1025,8 +1025,6 @@ class NotifyingLogger extends DelegatingLogger {
|
|||||||
assert(timeout != null);
|
assert(timeout != null);
|
||||||
printStatus(message);
|
printStatus(message);
|
||||||
return SilentStatus(
|
return SilentStatus(
|
||||||
timeout: timeout,
|
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatch: Stopwatch(),
|
stopwatch: Stopwatch(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1161,8 +1159,6 @@ class AppRunLogger extends DelegatingLogger {
|
|||||||
);
|
);
|
||||||
|
|
||||||
_status = SilentStatus(
|
_status = SilentStatus(
|
||||||
timeout: timeout,
|
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
onFinish: () {
|
onFinish: () {
|
||||||
_status = null;
|
_status = null;
|
||||||
_sendProgressEvent(
|
_sendProgressEvent(
|
||||||
|
@ -146,7 +146,6 @@ class UpdatePackagesCommand extends FlutterCommand {
|
|||||||
Future<void> _downloadCoverageData() async {
|
Future<void> _downloadCoverageData() async {
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Downloading lcov data for package:flutter...',
|
'Downloading lcov data for package:flutter...',
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
);
|
);
|
||||||
final String urlBase = globals.platform.environment['FLUTTER_STORAGE_BASE_URL'] ?? 'https://storage.googleapis.com';
|
final String urlBase = globals.platform.environment['FLUTTER_STORAGE_BASE_URL'] ?? 'https://storage.googleapis.com';
|
||||||
final Uri coverageUri = Uri.parse('$urlBase/flutter_infra/flutter/coverage/lcov.info');
|
final Uri coverageUri = Uri.parse('$urlBase/flutter_infra/flutter/coverage/lcov.info');
|
||||||
|
@ -111,7 +111,6 @@ Future<T> runInContext<T>(
|
|||||||
logger: globals.logger,
|
logger: globals.logger,
|
||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
xcodeProjectInterpreter: globals.xcodeProjectInterpreter,
|
xcodeProjectInterpreter: globals.xcodeProjectInterpreter,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
),
|
),
|
||||||
CocoaPodsValidator: () => CocoaPodsValidator(
|
CocoaPodsValidator: () => CocoaPodsValidator(
|
||||||
globals.cocoaPods,
|
globals.cocoaPods,
|
||||||
@ -197,13 +196,11 @@ Future<T> runInContext<T>(
|
|||||||
terminal: globals.terminal,
|
terminal: globals.terminal,
|
||||||
stdio: globals.stdio,
|
stdio: globals.stdio,
|
||||||
outputPreferences: globals.outputPreferences,
|
outputPreferences: globals.outputPreferences,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
)
|
)
|
||||||
: StdoutLogger(
|
: StdoutLogger(
|
||||||
terminal: globals.terminal,
|
terminal: globals.terminal,
|
||||||
stdio: globals.stdio,
|
stdio: globals.stdio,
|
||||||
outputPreferences: globals.outputPreferences,
|
outputPreferences: globals.outputPreferences,
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
),
|
),
|
||||||
MacOSWorkflow: () => MacOSWorkflow(
|
MacOSWorkflow: () => MacOSWorkflow(
|
||||||
featureFlags: featureFlags,
|
featureFlags: featureFlags,
|
||||||
@ -243,7 +240,6 @@ Future<T> runInContext<T>(
|
|||||||
ShutdownHooks: () => ShutdownHooks(logger: globals.logger),
|
ShutdownHooks: () => ShutdownHooks(logger: globals.logger),
|
||||||
Stdio: () => Stdio(),
|
Stdio: () => Stdio(),
|
||||||
SystemClock: () => const SystemClock(),
|
SystemClock: () => const SystemClock(),
|
||||||
TimeoutConfiguration: () => const TimeoutConfiguration(),
|
|
||||||
Usage: () => Usage(
|
Usage: () => Usage(
|
||||||
runningOnBot: runningOnBot,
|
runningOnBot: runningOnBot,
|
||||||
),
|
),
|
||||||
|
@ -198,7 +198,6 @@ class _DefaultPub implements Pub {
|
|||||||
final String command = upgrade ? 'upgrade' : 'get';
|
final String command = upgrade ? 'upgrade' : 'get';
|
||||||
final Status status = _logger.startProgress(
|
final Status status = _logger.startProgress(
|
||||||
'Running "flutter pub $command" in ${_fileSystem.path.basename(directory)}...',
|
'Running "flutter pub $command" in ${_fileSystem.path.basename(directory)}...',
|
||||||
timeout: const TimeoutConfiguration().slowOperation,
|
|
||||||
);
|
);
|
||||||
final bool verbose = _logger.isVerbose;
|
final bool verbose = _logger.isVerbose;
|
||||||
final List<String> args = <String>[
|
final List<String> args = <String>[
|
||||||
|
@ -301,9 +301,6 @@ class Doctor {
|
|||||||
for (final ValidatorTask validatorTask in startValidatorTasks()) {
|
for (final ValidatorTask validatorTask in startValidatorTasks()) {
|
||||||
final DoctorValidator validator = validatorTask.validator;
|
final DoctorValidator validator = validatorTask.validator;
|
||||||
final Status status = Status.withSpinner(
|
final Status status = Status.withSpinner(
|
||||||
timeout: timeoutConfiguration.fastOperation,
|
|
||||||
slowWarningCallback: () => validator.slowWarning,
|
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatch: Stopwatch(),
|
stopwatch: Stopwatch(),
|
||||||
terminal: globals.terminal,
|
terminal: globals.terminal,
|
||||||
);
|
);
|
||||||
|
@ -103,7 +103,6 @@ Future<void> _genSnapshot(
|
|||||||
int result;
|
int result;
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Compiling Fuchsia application to native code...',
|
'Compiling Fuchsia application to native code...',
|
||||||
timeout: null,
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
result = await processUtils.stream(command, trace: true);
|
result = await processUtils.stream(command, trace: true);
|
||||||
|
@ -328,7 +328,6 @@ class FuchsiaDevice extends Device {
|
|||||||
final String appName = FlutterProject.current().manifest.appName;
|
final String appName = FlutterProject.current().manifest.appName;
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Starting Fuchsia application $appName...',
|
'Starting Fuchsia application $appName...',
|
||||||
timeout: null,
|
|
||||||
);
|
);
|
||||||
FuchsiaPackageServer fuchsiaPackageServer;
|
FuchsiaPackageServer fuchsiaPackageServer;
|
||||||
bool serverRegistered = false;
|
bool serverRegistered = false;
|
||||||
@ -756,7 +755,6 @@ class FuchsiaIsolateDiscoveryProtocol {
|
|||||||
}
|
}
|
||||||
_status ??= globals.logger.startProgress(
|
_status ??= globals.logger.startProgress(
|
||||||
'Waiting for a connection from $_isolateName on ${_device.name}...',
|
'Waiting for a connection from $_isolateName on ${_device.name}...',
|
||||||
timeout: null, // could take an arbitrary amount of time
|
|
||||||
);
|
);
|
||||||
unawaited(_findIsolate()); // Completes the _foundUri Future.
|
unawaited(_findIsolate()); // Completes the _foundUri Future.
|
||||||
return _foundUri.future.then((Uri uri) {
|
return _foundUri.future.then((Uri uri) {
|
||||||
|
@ -71,7 +71,6 @@ class FuchsiaKernelCompiler {
|
|||||||
];
|
];
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Building Fuchsia application...',
|
'Building Fuchsia application...',
|
||||||
timeout: null,
|
|
||||||
);
|
);
|
||||||
int result;
|
int result;
|
||||||
try {
|
try {
|
||||||
|
@ -395,8 +395,8 @@ class IOSDevice extends Device {
|
|||||||
];
|
];
|
||||||
|
|
||||||
final Status installStatus = _logger.startProgress(
|
final Status installStatus = _logger.startProgress(
|
||||||
'Installing and launching...',
|
'Installing and launching...',
|
||||||
timeout: timeoutConfiguration.slowOperation);
|
);
|
||||||
try {
|
try {
|
||||||
ProtocolDiscovery observatoryDiscovery;
|
ProtocolDiscovery observatoryDiscovery;
|
||||||
int installationResult = 1;
|
int installationResult = 1;
|
||||||
|
@ -302,7 +302,6 @@ Future<XcodeBuildResult> buildXcodeProject({
|
|||||||
initialBuildStatus = null;
|
initialBuildStatus = null;
|
||||||
buildSubStatus = globals.logger.startProgress(
|
buildSubStatus = globals.logger.startProgress(
|
||||||
line,
|
line,
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
progressIndicatorPadding: kDefaultStatusPadding - 7,
|
progressIndicatorPadding: kDefaultStatusPadding - 7,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -331,7 +330,7 @@ Future<XcodeBuildResult> buildXcodeProject({
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Stopwatch sw = Stopwatch()..start();
|
final Stopwatch sw = Stopwatch()..start();
|
||||||
initialBuildStatus = globals.logger.startProgress('Running Xcode build...', timeout: timeoutConfiguration.slowOperation);
|
initialBuildStatus = globals.logger.startProgress('Running Xcode build...');
|
||||||
|
|
||||||
final RunResult buildResult = await _runBuildWithRetries(buildCommands, app);
|
final RunResult buildResult = await _runBuildWithRetries(buildCommands, app);
|
||||||
|
|
||||||
|
@ -327,8 +327,6 @@ class XcodeProjectInterpreter {
|
|||||||
Duration timeout = const Duration(minutes: 1),
|
Duration timeout = const Duration(minutes: 1),
|
||||||
}) async {
|
}) async {
|
||||||
final Status status = Status.withSpinner(
|
final Status status = Status.withSpinner(
|
||||||
timeout: const TimeoutConfiguration().fastOperation,
|
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
stopwatch: Stopwatch(),
|
stopwatch: Stopwatch(),
|
||||||
terminal: _terminal,
|
terminal: _terminal,
|
||||||
);
|
);
|
||||||
|
@ -576,9 +576,6 @@ class _ResidentWebRunner extends ResidentWebRunner {
|
|||||||
final Stopwatch timer = Stopwatch()..start();
|
final Stopwatch timer = Stopwatch()..start();
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Performing hot restart...',
|
'Performing hot restart...',
|
||||||
timeout: supportsServiceProtocol
|
|
||||||
? timeoutConfiguration.fastOperation
|
|
||||||
: timeoutConfiguration.slowOperation,
|
|
||||||
progressId: 'hot.restart',
|
progressId: 'hot.restart',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -731,7 +728,6 @@ class _ResidentWebRunner extends ResidentWebRunner {
|
|||||||
);
|
);
|
||||||
final Status devFSStatus = globals.logger.startProgress(
|
final Status devFSStatus = globals.logger.startProgress(
|
||||||
'Syncing files to device ${device.device.name}...',
|
'Syncing files to device ${device.device.name}...',
|
||||||
timeout: timeoutConfiguration.fastOperation,
|
|
||||||
);
|
);
|
||||||
final UpdateFSReport report = await device.devFS.update(
|
final UpdateFSReport report = await device.devFS.update(
|
||||||
mainUri: await _generateEntrypoint(
|
mainUri: await _generateEntrypoint(
|
||||||
|
@ -46,7 +46,6 @@ Future<void> buildLinux(
|
|||||||
|
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Building Linux application...',
|
'Building Linux application...',
|
||||||
timeout: null,
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
final String buildModeName = getNameForBuildMode(buildInfo.mode ?? BuildMode.release);
|
final String buildModeName = getNameForBuildMode(buildInfo.mode ?? BuildMode.release);
|
||||||
|
@ -79,7 +79,6 @@ Future<void> buildMacOS({
|
|||||||
final Stopwatch sw = Stopwatch()..start();
|
final Stopwatch sw = Stopwatch()..start();
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Building macOS application...',
|
'Building macOS application...',
|
||||||
timeout: null,
|
|
||||||
);
|
);
|
||||||
int result;
|
int result;
|
||||||
try {
|
try {
|
||||||
|
@ -83,15 +83,13 @@ class CocoaPods {
|
|||||||
@required XcodeProjectInterpreter xcodeProjectInterpreter,
|
@required XcodeProjectInterpreter xcodeProjectInterpreter,
|
||||||
@required Logger logger,
|
@required Logger logger,
|
||||||
@required Platform platform,
|
@required Platform platform,
|
||||||
@required TimeoutConfiguration timeoutConfiguration,
|
|
||||||
}) : _fileSystem = fileSystem,
|
}) : _fileSystem = fileSystem,
|
||||||
_processManager = processManager,
|
_processManager = processManager,
|
||||||
_xcodeProjectInterpreter = xcodeProjectInterpreter,
|
_xcodeProjectInterpreter = xcodeProjectInterpreter,
|
||||||
_logger = logger,
|
_logger = logger,
|
||||||
_platform = platform,
|
_platform = platform,
|
||||||
_processUtils = ProcessUtils(processManager: processManager, logger: logger),
|
_processUtils = ProcessUtils(processManager: processManager, logger: logger),
|
||||||
_fileSystemUtils = FileSystemUtils(fileSystem: fileSystem, platform: platform),
|
_fileSystemUtils = FileSystemUtils(fileSystem: fileSystem, platform: platform);
|
||||||
_timeoutConfiguration = timeoutConfiguration;
|
|
||||||
|
|
||||||
final FileSystem _fileSystem;
|
final FileSystem _fileSystem;
|
||||||
final ProcessManager _processManager;
|
final ProcessManager _processManager;
|
||||||
@ -100,7 +98,6 @@ class CocoaPods {
|
|||||||
final XcodeProjectInterpreter _xcodeProjectInterpreter;
|
final XcodeProjectInterpreter _xcodeProjectInterpreter;
|
||||||
final Logger _logger;
|
final Logger _logger;
|
||||||
final Platform _platform;
|
final Platform _platform;
|
||||||
final TimeoutConfiguration _timeoutConfiguration;
|
|
||||||
|
|
||||||
Future<String> _versionText;
|
Future<String> _versionText;
|
||||||
|
|
||||||
@ -342,7 +339,7 @@ class CocoaPods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _runPodInstall(XcodeBasedProject xcodeProject, String engineDirectory) async {
|
Future<void> _runPodInstall(XcodeBasedProject xcodeProject, String engineDirectory) async {
|
||||||
final Status status = _logger.startProgress('Running pod install...', timeout: _timeoutConfiguration.slowOperation);
|
final Status status = _logger.startProgress('Running pod install...');
|
||||||
final ProcessResult result = await _processManager.run(
|
final ProcessResult result = await _processManager.run(
|
||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: _fileSystem.path.dirname(xcodeProject.podfile.path),
|
workingDirectory: _fileSystem.path.dirname(xcodeProject.podfile.path),
|
||||||
|
@ -670,7 +670,6 @@ class FlutterDevice {
|
|||||||
}) async {
|
}) async {
|
||||||
final Status devFSStatus = globals.logger.startProgress(
|
final Status devFSStatus = globals.logger.startProgress(
|
||||||
'Syncing files to device ${device.name}...',
|
'Syncing files to device ${device.name}...',
|
||||||
timeout: timeoutConfiguration.fastOperation,
|
|
||||||
);
|
);
|
||||||
UpdateFSReport report;
|
UpdateFSReport report;
|
||||||
try {
|
try {
|
||||||
@ -1089,7 +1088,6 @@ abstract class ResidentRunner {
|
|||||||
|
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Taking screenshot for ${device.device.name}...',
|
'Taking screenshot for ${device.device.name}...',
|
||||||
timeout: timeoutConfiguration.fastOperation,
|
|
||||||
);
|
);
|
||||||
final File outputFile = globals.fsUtils.getUniqueFile(
|
final File outputFile = globals.fsUtils.getUniqueFile(
|
||||||
globals.fs.currentDirectory,
|
globals.fs.currentDirectory,
|
||||||
@ -1237,7 +1235,6 @@ abstract class ResidentRunner {
|
|||||||
// This will wait for at least one flutter view before returning.
|
// This will wait for at least one flutter view before returning.
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Waiting for ${device.device.name} to report its views...',
|
'Waiting for ${device.device.name} to report its views...',
|
||||||
timeout: const Duration(milliseconds: 200),
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
await device.vmService.getFlutterViews();
|
await device.vmService.getFlutterViews();
|
||||||
|
@ -659,7 +659,6 @@ class HotRunner extends ResidentRunner {
|
|||||||
if (!silent) {
|
if (!silent) {
|
||||||
status = globals.logger.startProgress(
|
status = globals.logger.startProgress(
|
||||||
'Performing hot restart...',
|
'Performing hot restart...',
|
||||||
timeout: timeoutConfiguration.fastOperation,
|
|
||||||
progressId: 'hot.restart',
|
progressId: 'hot.restart',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -709,7 +708,6 @@ class HotRunner extends ResidentRunner {
|
|||||||
}) async {
|
}) async {
|
||||||
Status status = globals.logger.startProgress(
|
Status status = globals.logger.startProgress(
|
||||||
'Performing hot reload...',
|
'Performing hot reload...',
|
||||||
timeout: timeoutConfiguration.fastOperation,
|
|
||||||
progressId: 'hot.reload',
|
progressId: 'hot.reload',
|
||||||
);
|
);
|
||||||
OperationResult result;
|
OperationResult result;
|
||||||
@ -724,7 +722,6 @@ class HotRunner extends ResidentRunner {
|
|||||||
status?.cancel();
|
status?.cancel();
|
||||||
status = globals.logger.startProgress(
|
status = globals.logger.startProgress(
|
||||||
message,
|
message,
|
||||||
timeout: timeoutConfiguration.slowOperation,
|
|
||||||
progressId: 'hot.reload',
|
progressId: 'hot.reload',
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -43,7 +43,6 @@ class Tracing {
|
|||||||
if (awaitFirstFrame) {
|
if (awaitFirstFrame) {
|
||||||
final Status status = _logger.startProgress(
|
final Status status = _logger.startProgress(
|
||||||
'Waiting for application to render first frame...',
|
'Waiting for application to render first frame...',
|
||||||
timeout: null,
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
final Completer<void> whenFirstFrameRendered = Completer<void>();
|
final Completer<void> whenFirstFrameRendered = Completer<void>();
|
||||||
|
@ -42,7 +42,7 @@ Future<void> buildWeb(
|
|||||||
outputDirectory.createSync(recursive: true);
|
outputDirectory.createSync(recursive: true);
|
||||||
}
|
}
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, checkProjects: true);
|
||||||
final Status status = globals.logger.startProgress('Compiling $target for the Web...', timeout: null);
|
final Status status = globals.logger.startProgress('Compiling $target for the Web...');
|
||||||
final Stopwatch sw = Stopwatch()..start();
|
final Stopwatch sw = Stopwatch()..start();
|
||||||
try {
|
try {
|
||||||
final BuildResult result = await globals.buildSystem.build(const WebServiceWorker(), Environment(
|
final BuildResult result = await globals.buildSystem.build(const WebServiceWorker(), Environment(
|
||||||
|
@ -56,7 +56,6 @@ Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, {
|
|||||||
final Directory buildDirectory = globals.fs.directory(getWindowsBuildDirectory());
|
final Directory buildDirectory = globals.fs.directory(getWindowsBuildDirectory());
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
'Building Windows application...',
|
'Building Windows application...',
|
||||||
timeout: null,
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
await _runCmakeGeneration(cmakePath, buildDirectory, windowsProject.cmakeFile.parent);
|
await _runCmakeGeneration(cmakePath, buildDirectory, windowsProject.cmakeFile.parent);
|
||||||
|
@ -674,8 +674,6 @@ class StreamLogger extends Logger {
|
|||||||
}) {
|
}) {
|
||||||
_log('[progress] $message');
|
_log('[progress] $message');
|
||||||
return SilentStatus(
|
return SilentStatus(
|
||||||
timeout: timeout,
|
|
||||||
timeoutConfiguration: timeoutConfiguration,
|
|
||||||
stopwatch: Stopwatch(),
|
stopwatch: Stopwatch(),
|
||||||
)..start();
|
)..start();
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,6 @@ AndroidDevice setUpAndroidDevice({
|
|||||||
fileSystem: fileSystem ?? MemoryFileSystem.test(),
|
fileSystem: fileSystem ?? MemoryFileSystem.test(),
|
||||||
processManager: processManager ?? FakeProcessManager.any(),
|
processManager: processManager ?? FakeProcessManager.any(),
|
||||||
androidConsoleSocketFactory: androidConsoleSocketFactory,
|
androidConsoleSocketFactory: androidConsoleSocketFactory,
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,6 @@ void main() {
|
|||||||
terminal: Terminal.test(supportsColor: true),
|
terminal: Terminal.test(supportsColor: true),
|
||||||
stdio: MockStdio(),
|
stdio: MockStdio(),
|
||||||
outputPreferences: OutputPreferences.test(),
|
outputPreferences: OutputPreferences.test(),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
final ArtifactUpdater artifactUpdater = ArtifactUpdater(
|
final ArtifactUpdater artifactUpdater = ArtifactUpdater(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert' show jsonEncode;
|
|
||||||
|
|
||||||
import 'package:flutter_tools/executable.dart';
|
import 'package:flutter_tools/executable.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
@ -33,7 +32,6 @@ void main() {
|
|||||||
terminal: Terminal.test(),
|
terminal: Terminal.test(),
|
||||||
stdio: mocks.MockStdio(),
|
stdio: mocks.MockStdio(),
|
||||||
outputPreferences: OutputPreferences.test(),
|
outputPreferences: OutputPreferences.test(),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(loggerFactory.createLogger(
|
expect(loggerFactory.createLogger(
|
||||||
@ -155,19 +153,16 @@ void main() {
|
|||||||
_throwsInvocationFor(() => fakeLogger.sendEvent(message, eventArgs)),
|
_throwsInvocationFor(() => fakeLogger.sendEvent(message, eventArgs)),
|
||||||
);
|
);
|
||||||
|
|
||||||
const Duration timeout = Duration(seconds: 12);
|
|
||||||
const String progressId = 'progressId';
|
const String progressId = 'progressId';
|
||||||
const bool multilineOutput = true;
|
const bool multilineOutput = true;
|
||||||
const int progressIndicatorPadding = kDefaultStatusPadding * 2;
|
const int progressIndicatorPadding = kDefaultStatusPadding * 2;
|
||||||
expect(
|
expect(
|
||||||
() => delegatingLogger.startProgress(message,
|
() => delegatingLogger.startProgress(message,
|
||||||
timeout: timeout,
|
|
||||||
progressId: progressId,
|
progressId: progressId,
|
||||||
multilineOutput: multilineOutput,
|
multilineOutput: multilineOutput,
|
||||||
progressIndicatorPadding: progressIndicatorPadding,
|
progressIndicatorPadding: progressIndicatorPadding,
|
||||||
),
|
),
|
||||||
_throwsInvocationFor(() => fakeLogger.startProgress(message,
|
_throwsInvocationFor(() => fakeLogger.startProgress(message,
|
||||||
timeout: timeout,
|
|
||||||
progressId: progressId,
|
progressId: progressId,
|
||||||
multilineOutput: multilineOutput,
|
multilineOutput: multilineOutput,
|
||||||
progressIndicatorPadding: progressIndicatorPadding,
|
progressIndicatorPadding: progressIndicatorPadding,
|
||||||
@ -279,7 +274,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: stdio,
|
stdio: stdio,
|
||||||
outputPreferences: OutputPreferences.test(),
|
outputPreferences: OutputPreferences.test(),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus('message');
|
logger.printStatus('message');
|
||||||
logger.printError('error message');
|
logger.printError('error message');
|
||||||
@ -320,7 +314,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: stdio,
|
stdio: stdio,
|
||||||
outputPreferences: OutputPreferences.test(),
|
outputPreferences: OutputPreferences.test(),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus('message');
|
logger.printStatus('message');
|
||||||
logger.printError('error message');
|
logger.printError('error message');
|
||||||
@ -359,7 +352,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: stdio,
|
stdio: stdio,
|
||||||
outputPreferences: OutputPreferences.test(),
|
outputPreferences: OutputPreferences.test(),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus('message');
|
logger.printStatus('message');
|
||||||
logger.printError('error message');
|
logger.printError('error message');
|
||||||
@ -441,11 +433,9 @@ void main() {
|
|||||||
|
|
||||||
ansiStatus = AnsiStatus(
|
ansiStatus = AnsiStatus(
|
||||||
message: 'Hello world',
|
message: 'Hello world',
|
||||||
timeout: const Duration(seconds: 2),
|
|
||||||
padding: 20,
|
padding: 20,
|
||||||
onFinish: () => called += 1,
|
onFinish: () => called += 1,
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
stopwatch: stopwatchFactory.createStopwatch(),
|
stopwatch: stopwatchFactory.createStopwatch(),
|
||||||
terminal: terminal,
|
terminal: terminal,
|
||||||
);
|
);
|
||||||
@ -456,9 +446,7 @@ void main() {
|
|||||||
mockStopwatch = FakeStopwatch();
|
mockStopwatch = FakeStopwatch();
|
||||||
FakeAsync().run((FakeAsync time) {
|
FakeAsync().run((FakeAsync time) {
|
||||||
final AnsiSpinner ansiSpinner = AnsiSpinner(
|
final AnsiSpinner ansiSpinner = AnsiSpinner(
|
||||||
timeout: const Duration(hours: 10),
|
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
stopwatch: stopwatchFactory.createStopwatch(),
|
stopwatch: stopwatchFactory.createStopwatch(),
|
||||||
terminal: terminal,
|
terminal: terminal,
|
||||||
)..start();
|
)..start();
|
||||||
@ -487,72 +475,37 @@ void main() {
|
|||||||
expect(done, isTrue);
|
expect(done, isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('AnsiSpinner works (2)', () async {
|
|
||||||
bool done = false;
|
|
||||||
mockStopwatch = FakeStopwatch();
|
|
||||||
FakeAsync().run((FakeAsync time) {
|
|
||||||
final AnsiSpinner ansiSpinner = AnsiSpinner(
|
|
||||||
timeout: const Duration(seconds: 2),
|
|
||||||
stdio: mockStdio,
|
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
stopwatch: mockStopwatch,
|
|
||||||
terminal: terminal,
|
|
||||||
)..start();
|
|
||||||
mockStopwatch.elapsed = const Duration(seconds: 1);
|
|
||||||
doWhileAsync(time, () => ansiSpinner.ticks < 10); // one second
|
|
||||||
|
|
||||||
expect(ansiSpinner.seemsSlow, isFalse);
|
|
||||||
expect(outputStdout().join('\n'), isNot(contains('This is taking an unexpectedly long time.')));
|
|
||||||
mockStopwatch.elapsed = const Duration(seconds: 3);
|
|
||||||
doWhileAsync(time, () => ansiSpinner.ticks < 30); // three seconds
|
|
||||||
|
|
||||||
expect(ansiSpinner.seemsSlow, isTrue);
|
|
||||||
// Check the 2nd line to verify there's a newline before the warning
|
|
||||||
expect(outputStdout()[1], contains('This is taking an unexpectedly long time.'));
|
|
||||||
ansiSpinner.stop();
|
|
||||||
expect(outputStdout().join('\n'), isNot(contains('(!)')));
|
|
||||||
done = true;
|
|
||||||
});
|
|
||||||
expect(done, isTrue);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWithoutContext('Stdout startProgress on colored terminal', () async {
|
testWithoutContext('Stdout startProgress on colored terminal', () async {
|
||||||
bool done = false;
|
final Logger logger = StdoutLogger(
|
||||||
FakeAsync().run((FakeAsync time) {
|
terminal: coloredTerminal,
|
||||||
final Logger logger = StdoutLogger(
|
stdio: mockStdio,
|
||||||
terminal: coloredTerminal,
|
outputPreferences: OutputPreferences.test(showColor: true),
|
||||||
stdio: mockStdio,
|
stopwatchFactory: stopwatchFactory,
|
||||||
outputPreferences: OutputPreferences.test(showColor: true),
|
);
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
final Status status = logger.startProgress(
|
||||||
stopwatchFactory: stopwatchFactory,
|
'Hello',
|
||||||
);
|
progressId: null,
|
||||||
final Status status = logger.startProgress(
|
progressIndicatorPadding: 20, // this minus the "Hello" equals the 15 below.
|
||||||
'Hello',
|
);
|
||||||
progressId: null,
|
expect(outputStderr().length, equals(1));
|
||||||
timeout: const TimeoutConfiguration().slowOperation,
|
expect(outputStderr().first, isEmpty);
|
||||||
progressIndicatorPadding: 20, // this minus the "Hello" equals the 15 below.
|
// the 5 below is the margin that is always included between the message and the time.
|
||||||
);
|
expect(
|
||||||
expect(outputStderr().length, equals(1));
|
outputStdout().join('\n'),
|
||||||
expect(outputStderr().first, isEmpty);
|
matches(terminal.supportsEmoji
|
||||||
// the 5 below is the margin that is always included between the message and the time.
|
? r'^Hello {15} {5} {8}[\b]{8} {7}⣽$'
|
||||||
expect(
|
: r'^Hello {15} {5} {8}[\b]{8} {7}\\$'),
|
||||||
outputStdout().join('\n'),
|
);
|
||||||
matches(terminal.supportsEmoji
|
mockStopwatch.elapsed = const Duration(seconds: 4, milliseconds: 100);
|
||||||
? r'^Hello {15} {5} {8}[\b]{8} {7}⣽$'
|
status.stop();
|
||||||
: r'^Hello {15} {5} {8}[\b]{8} {7}\\$'),
|
expect(
|
||||||
);
|
outputStdout().join('\n'),
|
||||||
status.stop();
|
matches(
|
||||||
expect(
|
terminal.supportsEmoji
|
||||||
outputStdout().join('\n'),
|
? r'^Hello {15} {5} {8}[\b]{8} {7}⣽[\b]{8} {8}[\b]{8}[\d, ]{4}[\d]\.[\d]s[\n]$'
|
||||||
matches(
|
: r'^Hello {15} {5} {8}[\b]{8} {7}\\[\b]{8} {8}[\b]{8}[\d, ]{4}[\d]\.[\d]s[\n]$',
|
||||||
terminal.supportsEmoji
|
),
|
||||||
? r'^Hello {15} {5} {8}[\b]{8} {7}⣽[\b]{8} {8}[\b]{8}[\d, ]{4}[\d]\.[\d]s[\n]$'
|
);
|
||||||
: r'^Hello {15} {5} {8}[\b]{8} {7}\\[\b]{8} {8}[\b]{8}[\d, ]{4}[\d]\.[\d]s[\n]$',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
done = true;
|
|
||||||
});
|
|
||||||
expect(done, isTrue);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Stdout startProgress on colored terminal pauses', () async {
|
testWithoutContext('Stdout startProgress on colored terminal pauses', () async {
|
||||||
@ -563,12 +516,10 @@ void main() {
|
|||||||
terminal: coloredTerminal,
|
terminal: coloredTerminal,
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(showColor: true),
|
outputPreferences: OutputPreferences.test(showColor: true),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
stopwatchFactory: stopwatchFactory,
|
stopwatchFactory: stopwatchFactory,
|
||||||
);
|
);
|
||||||
final Status status = logger.startProgress(
|
final Status status = logger.startProgress(
|
||||||
"Knock Knock, Who's There",
|
"Knock Knock, Who's There",
|
||||||
timeout: const Duration(days: 10),
|
|
||||||
progressIndicatorPadding: 10,
|
progressIndicatorPadding: 10,
|
||||||
);
|
);
|
||||||
logger.printStatus('Rude Interrupting Cow');
|
logger.printStatus('Rude Interrupting Cow');
|
||||||
@ -598,38 +549,6 @@ void main() {
|
|||||||
expect(done, isTrue);
|
expect(done, isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('AnsiStatus works', () {
|
|
||||||
bool done = false;
|
|
||||||
FakeAsync().run((FakeAsync time) {
|
|
||||||
ansiStatus.start();
|
|
||||||
mockStopwatch.elapsed = const Duration(seconds: 1);
|
|
||||||
doWhileAsync(time, () => ansiStatus.ticks < 10); // one second
|
|
||||||
|
|
||||||
expect(ansiStatus.seemsSlow, isFalse);
|
|
||||||
expect(outputStdout().join('\n'), isNot(contains('This is taking an unexpectedly long time.')));
|
|
||||||
expect(outputStdout().join('\n'), isNot(contains('(!)')));
|
|
||||||
mockStopwatch.elapsed = const Duration(seconds: 3);
|
|
||||||
doWhileAsync(time, () => ansiStatus.ticks < 30); // three seconds
|
|
||||||
|
|
||||||
expect(ansiStatus.seemsSlow, isTrue);
|
|
||||||
expect(outputStdout().join('\n'), contains('This is taking an unexpectedly long time.'));
|
|
||||||
|
|
||||||
// Test that the number of '\b' is correct.
|
|
||||||
for (final String line in outputStdout()) {
|
|
||||||
int currLength = 0;
|
|
||||||
for (int i = 0; i < line.length; i += 1) {
|
|
||||||
currLength += line[i] == '\b' ? -1 : 1;
|
|
||||||
expect(currLength, isNonNegative, reason: 'The following line has overflow backtraces:\n' + jsonEncode(line));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ansiStatus.stop();
|
|
||||||
expect(outputStdout().join('\n'), contains('(!)'));
|
|
||||||
done = true;
|
|
||||||
});
|
|
||||||
expect(done, isTrue);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWithoutContext('AnsiStatus works when canceled', () async {
|
testWithoutContext('AnsiStatus works when canceled', () async {
|
||||||
bool done = false;
|
bool done = false;
|
||||||
FakeAsync().run((FakeAsync time) {
|
FakeAsync().run((FakeAsync time) {
|
||||||
@ -717,18 +636,15 @@ void main() {
|
|||||||
mocks.MockStdio mockStdio;
|
mocks.MockStdio mockStdio;
|
||||||
SummaryStatus summaryStatus;
|
SummaryStatus summaryStatus;
|
||||||
int called;
|
int called;
|
||||||
final RegExp secondDigits = RegExp(r'[^\b]\b\b\b\b\b[0-9]+[.][0-9]+(?:s|ms)');
|
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
mockStdio = mocks.MockStdio();
|
mockStdio = mocks.MockStdio();
|
||||||
called = 0;
|
called = 0;
|
||||||
summaryStatus = SummaryStatus(
|
summaryStatus = SummaryStatus(
|
||||||
message: 'Hello world',
|
message: 'Hello world',
|
||||||
timeout: const TimeoutConfiguration().slowOperation,
|
|
||||||
padding: 20,
|
padding: 20,
|
||||||
onFinish: () => called++,
|
onFinish: () => called++,
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
stopwatch: FakeStopwatch(),
|
stopwatch: FakeStopwatch(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -744,7 +660,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printError('0123456789' * 15);
|
logger.printError('0123456789' * 15);
|
||||||
final List<String> lines = outputStderr();
|
final List<String> lines = outputStderr();
|
||||||
@ -774,7 +689,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printError('0123456789' * 15, indent: 5);
|
logger.printError('0123456789' * 15, indent: 5);
|
||||||
final List<String> lines = outputStderr();
|
final List<String> lines = outputStderr();
|
||||||
@ -798,7 +712,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printError('0123456789' * 15, hangingIndent: 5);
|
logger.printError('0123456789' * 15, hangingIndent: 5);
|
||||||
final List<String> lines = outputStderr();
|
final List<String> lines = outputStderr();
|
||||||
@ -822,7 +735,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printError('0123456789' * 15, indent: 4, hangingIndent: 5);
|
logger.printError('0123456789' * 15, indent: 4, hangingIndent: 5);
|
||||||
final List<String> lines = outputStderr();
|
final List<String> lines = outputStderr();
|
||||||
@ -846,7 +758,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus('0123456789' * 15);
|
logger.printStatus('0123456789' * 15);
|
||||||
final List<String> lines = outputStdout();
|
final List<String> lines = outputStdout();
|
||||||
@ -867,7 +778,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus('0123456789' * 15, indent: 5);
|
logger.printStatus('0123456789' * 15, indent: 5);
|
||||||
final List<String> lines = outputStdout();
|
final List<String> lines = outputStdout();
|
||||||
@ -890,8 +800,7 @@ void main() {
|
|||||||
platform: _kNoAnsiPlatform,
|
platform: _kNoAnsiPlatform,
|
||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false)
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus('0123456789' * 15, hangingIndent: 5);
|
logger.printStatus('0123456789' * 15, hangingIndent: 5);
|
||||||
final List<String> lines = outputStdout();
|
final List<String> lines = outputStdout();
|
||||||
@ -915,7 +824,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus('0123456789' * 15, indent: 4, hangingIndent: 5);
|
logger.printStatus('0123456789' * 15, indent: 4, hangingIndent: 5);
|
||||||
final List<String> lines = outputStdout();
|
final List<String> lines = outputStdout();
|
||||||
@ -939,7 +847,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(showColor: true),
|
outputPreferences: OutputPreferences.test(showColor: true),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printError('Pants on fire!');
|
logger.printError('Pants on fire!');
|
||||||
final List<String> lines = outputStderr();
|
final List<String> lines = outputStderr();
|
||||||
@ -957,7 +864,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(showColor: true),
|
outputPreferences: OutputPreferences.test(showColor: true),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus('All good.');
|
logger.printStatus('All good.');
|
||||||
|
|
||||||
@ -975,7 +881,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(showColor: true),
|
outputPreferences: OutputPreferences.test(showColor: true),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus(
|
logger.printStatus(
|
||||||
null,
|
null,
|
||||||
@ -999,7 +904,6 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(showColor: false),
|
outputPreferences: OutputPreferences.test(showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.printStatus(
|
logger.printStatus(
|
||||||
null,
|
null,
|
||||||
@ -1015,59 +919,52 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Stdout startProgress on non-color terminal', () async {
|
testWithoutContext('Stdout startProgress on non-color terminal', () async {
|
||||||
bool done = false;
|
final FakeStopwatch fakeStopwatch = FakeStopwatch();
|
||||||
FakeAsync().run((FakeAsync time) {
|
final Logger logger = StdoutLogger(
|
||||||
final Logger logger = StdoutLogger(
|
terminal: AnsiTerminal(
|
||||||
terminal: AnsiTerminal(
|
|
||||||
stdio: mockStdio,
|
|
||||||
platform: _kNoAnsiPlatform,
|
|
||||||
),
|
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(showColor: false),
|
platform: _kNoAnsiPlatform,
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
),
|
||||||
);
|
stdio: mockStdio,
|
||||||
final Status status = logger.startProgress(
|
outputPreferences: OutputPreferences.test(showColor: false),
|
||||||
'Hello',
|
stopwatchFactory: FakeStopwatchFactory(fakeStopwatch),
|
||||||
progressId: null,
|
);
|
||||||
timeout: const TimeoutConfiguration().slowOperation,
|
final Status status = logger.startProgress(
|
||||||
progressIndicatorPadding: 20, // this minus the "Hello" equals the 15 below.
|
'Hello',
|
||||||
);
|
progressId: null,
|
||||||
expect(outputStderr().length, equals(1));
|
progressIndicatorPadding: 20, // this minus the "Hello" equals the 15 below.
|
||||||
expect(outputStderr().first, isEmpty);
|
);
|
||||||
// the 5 below is the margin that is always included between the message and the time.
|
expect(outputStderr().length, equals(1));
|
||||||
expect(outputStdout().join('\n'), matches(r'^Hello {15} {5}$'));
|
expect(outputStderr().first, isEmpty);
|
||||||
status.stop();
|
// the 5 below is the margin that is always included between the message and the time.
|
||||||
expect(outputStdout().join('\n'), matches(r'^Hello {15} {5}[\d, ]{4}[\d]\.[\d]s[\n]$'));
|
expect(outputStdout().join('\n'), matches(r'^Hello {15} {5}$'));
|
||||||
done = true;
|
|
||||||
});
|
fakeStopwatch.elapsed = const Duration(seconds: 4, milliseconds: 123);
|
||||||
expect(done, isTrue);
|
status.stop();
|
||||||
|
|
||||||
|
expect(outputStdout(), <String>['Hello 4.1s', '']);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('SummaryStatus works when canceled', () async {
|
testWithoutContext('SummaryStatus works when canceled', () async {
|
||||||
final SummaryStatus summaryStatus = SummaryStatus(
|
final SummaryStatus summaryStatus = SummaryStatus(
|
||||||
message: 'Hello world',
|
message: 'Hello world',
|
||||||
timeout: const TimeoutConfiguration().slowOperation,
|
|
||||||
padding: 20,
|
padding: 20,
|
||||||
onFinish: () => called++,
|
onFinish: () => called++,
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
stopwatch: FakeStopwatch(),
|
stopwatch: FakeStopwatch(),
|
||||||
);
|
);
|
||||||
summaryStatus.start();
|
summaryStatus.start();
|
||||||
List<String> lines = outputStdout();
|
final List<String> lines = outputStdout();
|
||||||
expect(lines[0], startsWith('Hello world '));
|
expect(lines[0], startsWith('Hello world '));
|
||||||
expect(lines.length, equals(1));
|
expect(lines.length, equals(1));
|
||||||
expect(lines[0].endsWith('\n'), isFalse);
|
expect(lines[0].endsWith('\n'), isFalse);
|
||||||
|
|
||||||
// Verify a cancel does _not_ print the time and prints a newline.
|
// Verify a cancel does _not_ print the time and prints a newline.
|
||||||
summaryStatus.cancel();
|
summaryStatus.cancel();
|
||||||
lines = outputStdout();
|
expect(outputStdout(), <String>[
|
||||||
final List<Match> matches = secondDigits.allMatches(lines[0]).toList();
|
'Hello world ',
|
||||||
expect(matches, isEmpty);
|
'',
|
||||||
expect(lines[0], endsWith(' '));
|
]);
|
||||||
expect(called, equals(1));
|
|
||||||
expect(lines.length, equals(2));
|
|
||||||
expect(lines[1], equals(''));
|
|
||||||
|
|
||||||
// Verify that stopping or canceling multiple times throws.
|
// Verify that stopping or canceling multiple times throws.
|
||||||
expect(summaryStatus.cancel, throwsAssertionError);
|
expect(summaryStatus.cancel, throwsAssertionError);
|
||||||
@ -1076,21 +973,16 @@ void main() {
|
|||||||
|
|
||||||
testWithoutContext('SummaryStatus works when stopped', () async {
|
testWithoutContext('SummaryStatus works when stopped', () async {
|
||||||
summaryStatus.start();
|
summaryStatus.start();
|
||||||
List<String> lines = outputStdout();
|
final List<String> lines = outputStdout();
|
||||||
expect(lines[0], startsWith('Hello world '));
|
expect(lines[0], startsWith('Hello world '));
|
||||||
expect(lines.length, equals(1));
|
expect(lines.length, equals(1));
|
||||||
|
|
||||||
// Verify a stop prints the time.
|
// Verify a stop prints the time.
|
||||||
summaryStatus.stop();
|
summaryStatus.stop();
|
||||||
lines = outputStdout();
|
expect(outputStdout(), <String>[
|
||||||
final List<Match> matches = secondDigits.allMatches(lines[0]).toList();
|
'Hello world 0ms',
|
||||||
expect(matches, isNotNull);
|
'',
|
||||||
expect(matches, hasLength(1));
|
]);
|
||||||
final Match match = matches.first;
|
|
||||||
expect(lines[0], endsWith(match.group(0)));
|
|
||||||
expect(called, equals(1));
|
|
||||||
expect(lines.length, equals(2));
|
|
||||||
expect(lines[1], equals(''));
|
|
||||||
|
|
||||||
// Verify that stopping or canceling multiple times throws.
|
// Verify that stopping or canceling multiple times throws.
|
||||||
expect(summaryStatus.stop, throwsAssertionError);
|
expect(summaryStatus.stop, throwsAssertionError);
|
||||||
@ -1105,10 +997,9 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(showColor: false),
|
outputPreferences: OutputPreferences.test(showColor: false),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation).stop();
|
logger.startProgress('AAA').stop();
|
||||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation).stop();
|
logger.startProgress('BBB').stop();
|
||||||
final List<String> output = outputStdout();
|
final List<String> output = outputStdout();
|
||||||
|
|
||||||
expect(output.length, equals(3));
|
expect(output.length, equals(3));
|
||||||
@ -1129,12 +1020,11 @@ void main() {
|
|||||||
),
|
),
|
||||||
stdio: mockStdio,
|
stdio: mockStdio,
|
||||||
outputPreferences: OutputPreferences.test(),
|
outputPreferences: OutputPreferences.test(),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
),
|
),
|
||||||
stopwatchFactory: FakeStopwatchFactory(),
|
stopwatchFactory: FakeStopwatchFactory(),
|
||||||
);
|
);
|
||||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation).stop();
|
logger.startProgress('AAA').stop();
|
||||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation).stop();
|
logger.startProgress('BBB').stop();
|
||||||
|
|
||||||
expect(outputStdout(), <Matcher>[
|
expect(outputStdout(), <Matcher>[
|
||||||
matches(r'^\[ (?: {0,2}\+[0-9]{1,4} ms| )\] AAA$'),
|
matches(r'^\[ (?: {0,2}\+[0-9]{1,4} ms| )\] AAA$'),
|
||||||
@ -1153,8 +1043,8 @@ void main() {
|
|||||||
),
|
),
|
||||||
outputPreferences: OutputPreferences.test(),
|
outputPreferences: OutputPreferences.test(),
|
||||||
);
|
);
|
||||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation).stop();
|
logger.startProgress('AAA').stop();
|
||||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation).stop();
|
logger.startProgress('BBB').stop();
|
||||||
|
|
||||||
expect(logger.statusText, 'AAA\nBBB\n');
|
expect(logger.statusText, 'AAA\nBBB\n');
|
||||||
});
|
});
|
||||||
|
@ -71,7 +71,6 @@ void main() {
|
|||||||
logger: logger,
|
logger: logger,
|
||||||
platform: FakePlatform(),
|
platform: FakePlatform(),
|
||||||
xcodeProjectInterpreter: mockXcodeProjectInterpreter,
|
xcodeProjectInterpreter: mockXcodeProjectInterpreter,
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
);
|
);
|
||||||
pretendPodVersionIs('1.8.0');
|
pretendPodVersionIs('1.8.0');
|
||||||
fileSystem.file(fileSystem.path.join(
|
fileSystem.file(fileSystem.path.join(
|
||||||
|
@ -22,7 +22,6 @@ final ProcessUtils processUtils = ProcessUtils(processManager: processManager, l
|
|||||||
),
|
),
|
||||||
stdio: stdio,
|
stdio: stdio,
|
||||||
outputPreferences: OutputPreferences.test(wrapText: true),
|
outputPreferences: OutputPreferences.test(wrapText: true),
|
||||||
timeoutConfiguration: const TimeoutConfiguration(),
|
|
||||||
));
|
));
|
||||||
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
|
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
|
||||||
|
|
||||||
|
@ -127,7 +127,6 @@ void testUsingContext(
|
|||||||
Usage: () => FakeUsage(),
|
Usage: () => FakeUsage(),
|
||||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreter(),
|
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreter(),
|
||||||
FileSystem: () => LocalFileSystemBlockingSetCurrentDirectory(),
|
FileSystem: () => LocalFileSystemBlockingSetCurrentDirectory(),
|
||||||
TimeoutConfiguration: () => const TimeoutConfiguration(),
|
|
||||||
PlistParser: () => FakePlistParser(),
|
PlistParser: () => FakePlistParser(),
|
||||||
Signals: () => FakeSignals(),
|
Signals: () => FakeSignals(),
|
||||||
Pub: () => ThrowingPub(), // prevent accidentally using pub.
|
Pub: () => ThrowingPub(), // prevent accidentally using pub.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user