Revert "Bump cli_util to 0.2.0; implement new methods"

This reverts commit ebcc6dc2a2.

Reason for revert: Broke golem. I think there are more implementations of Logger than I realized.

Original change's description:
> Bump cli_util to 0.2.0; implement new methods
> 
> This fixes the issue of progress indicators being shown during tests.
> 
> Change-Id: I39fd68cfeca70a63d088aceb4325b42c53766afd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150669
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Paul Berry <paulberry@google.com>

TBR=paulberry@google.com,jcollins@google.com,mfairhurst@google.com,srawlins@google.com

Change-Id: I52ac0f5d96a161534c28cc160c2a2b3b364ad511
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150693
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Samuel Rawlins 2020-06-10 23:59:05 +00:00 committed by commit-bot@chromium.org
parent 3902021740
commit 5a32ff0d7f
6 changed files with 8 additions and 41 deletions

2
DEPS
View file

@ -75,7 +75,7 @@ vars = {
"browser-compat-data_tag": "v1.0.22",
"charcode_rev": "9085e6b6127f084d66c0a94810a808121459012a",
"chrome_rev" : "19997",
"cli_util_tag" : "0.2.0",
"cli_util_tag" : "0.1.4",
"collection_rev": "7be42e03d427cc19571cd7f9fc628a5913a6b757",
"convert_rev": "49bde5b371eb5c2c8e721557cf762f17c75e49fc",
"crypto_rev": "7422fb2f6584fe1839eb30bc4ca56e9f9760b801",

View file

@ -180,16 +180,6 @@ class TestLogger implements Logger {
}
}
@override
void write(String message) {
stdoutBuffer.write(message);
}
@override
void writeCharCode(int charCode) {
stdoutBuffer.writeCharCode(charCode);
}
String get stdoutText => stdoutBuffer.toString();
String get stderrText => stderrBuffer.toString();

View file

@ -72,16 +72,6 @@ class TestLogger implements Logger {
stdoutBuffer.writeln(message);
}
}
@override
void write(String message) {
stdoutBuffer.write(message);
}
@override
void writeCharCode(int charCode) {
stdoutBuffer.writeCharCode(charCode);
}
}
void expectHasSuggestion(

View file

@ -894,8 +894,7 @@ class _FixCodeProcessor extends Object {
Future<void> runFirstPhase() async {
// All tasks should be registered; [numPhases] should be finalized.
_progressBar = _ProgressBar(
_migrationCli.logger, pathsToProcess.length * _task.numPhases);
_progressBar = _ProgressBar(pathsToProcess.length * _task.numPhases);
// Process package
_task.processPackage(context.contextRoot.root);
@ -1005,20 +1004,18 @@ class _ProgressBar {
/// This represents the number of characters available for drawing progress.
/*late*/ int _innerWidth;
final Logger _logger;
final int _totalTickCount;
int _tickCount = 0;
_ProgressBar(this._logger, this._totalTickCount) {
_ProgressBar(this._totalTickCount) {
if (!stdout.hasTerminal) {
_shouldDrawProgress = false;
} else {
_shouldDrawProgress = true;
_width = stdout.terminalColumns;
_innerWidth = stdout.terminalColumns - 2;
_logger.write('[' + ' ' * _innerWidth + ']');
stdout.write('[' + ' ' * _innerWidth + ']');
}
}
@ -1028,7 +1025,7 @@ class _ProgressBar {
if (!_shouldDrawProgress) {
return;
}
_logger.write('\r' + ' ' * _width + '\r');
stdout.write('\r' + ' ' * _width + '\r');
}
/// Draw the progress bar as complete, and print two newlines.
@ -1036,7 +1033,7 @@ class _ProgressBar {
if (!_shouldDrawProgress) {
return;
}
_logger.write('\r[' + '-' * _innerWidth + ']\n\n');
stdout.write('\r[' + '-' * _innerWidth + ']\n\n');
}
/// Progress the bar by one tick.
@ -1047,7 +1044,7 @@ class _ProgressBar {
_tickCount++;
var fractionComplete = _tickCount * _innerWidth ~/ _totalTickCount - 1;
var remaining = _innerWidth - fractionComplete - 1;
_logger.write('\r[' + // Bring cursor back to the start of the line.
stdout.write('\r[' + // Bring cursor back to the start of the line.
'-' * fractionComplete + // Print complete work.
AnsiProgress.kAnimationItems[_tickCount % 4] + // Print spinner.
' ' * remaining + // Print remaining work.

View file

@ -10,7 +10,7 @@ dependencies:
analyzer_plugin: ^0.2.4
args: ^1.4.4
charcode: ^1.1.2
cli_util: ^0.2.0
cli_util: ^0.1.4
collection: ^1.14.11
crypto: ^2.0.6
meta: ^1.1.6

View file

@ -1653,14 +1653,4 @@ class _TestLogger implements Logger {
void trace(String message) {
throw UnimplementedError('TODO(paulberry)');
}
@override
void write(String message) {
stdoutBuffer.write(message);
}
@override
void writeCharCode(int charCode) {
stdoutBuffer.writeCharCode(charCode);
}
}