Unverified Commit 63a40131 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert "[flutter_tools] let the logger know about machine mode (#86116)" (#86363)

This reverts commit 53d8cba3.
parent 28b4b84f
...@@ -77,9 +77,8 @@ Future<void> main(List<String> args) async { ...@@ -77,9 +77,8 @@ Future<void> main(List<String> args) async {
final bool muteCommandLogging = (help || doctor) && !veryVerbose; final bool muteCommandLogging = (help || doctor) && !veryVerbose;
final bool verboseHelp = help && verbose; final bool verboseHelp = help && verbose;
final bool daemon = args.contains('daemon'); final bool daemon = args.contains('daemon');
final bool machine = args.contains('--machine'); final bool runMachine = (args.contains('--machine') && args.contains('run')) ||
final bool runMachine = (machine && args.contains('run')) || (args.contains('--machine') && args.contains('attach'));
(machine && args.contains('attach'));
// Cache.flutterRoot must be set early because other features use it (e.g. // Cache.flutterRoot must be set early because other features use it (e.g.
// enginePath's initializer uses it). This can only work with the real // enginePath's initializer uses it). This can only work with the real
...@@ -123,11 +122,10 @@ Future<void> main(List<String> args) async { ...@@ -123,11 +122,10 @@ Future<void> main(List<String> args) async {
); );
return loggerFactory.createLogger( return loggerFactory.createLogger(
daemon: daemon, daemon: daemon,
runMachine: runMachine, machine: runMachine,
verbose: verbose && !muteCommandLogging, verbose: verbose && !muteCommandLogging,
prefixedErrors: prefixedErrors, prefixedErrors: prefixedErrors,
windows: globals.platform.isWindows, windows: globals.platform.isWindows,
machine: machine,
); );
}, },
}, },
...@@ -228,10 +226,9 @@ class LoggerFactory { ...@@ -228,10 +226,9 @@ class LoggerFactory {
Logger createLogger({ Logger createLogger({
@required bool verbose, @required bool verbose,
@required bool prefixedErrors, @required bool prefixedErrors,
@required bool runMachine, @required bool machine,
@required bool daemon, @required bool daemon,
@required bool windows, @required bool windows,
@required bool machine,
}) { }) {
Logger logger; Logger logger;
if (windows) { if (windows) {
...@@ -240,15 +237,13 @@ class LoggerFactory { ...@@ -240,15 +237,13 @@ class LoggerFactory {
stdio: _stdio, stdio: _stdio,
outputPreferences: _outputPreferences, outputPreferences: _outputPreferences,
stopwatchFactory: _stopwatchFactory, stopwatchFactory: _stopwatchFactory,
machine: machine,
); );
} else { } else {
logger = StdoutLogger( logger = StdoutLogger(
terminal: _terminal, terminal: _terminal,
stdio: _stdio, stdio: _stdio,
outputPreferences: _outputPreferences, outputPreferences: _outputPreferences,
stopwatchFactory: _stopwatchFactory, stopwatchFactory: _stopwatchFactory
machine: machine,
); );
} }
if (verbose) { if (verbose) {
...@@ -260,7 +255,7 @@ class LoggerFactory { ...@@ -260,7 +255,7 @@ class LoggerFactory {
if (daemon) { if (daemon) {
return NotifyingLogger(verbose: verbose, parent: logger); return NotifyingLogger(verbose: verbose, parent: logger);
} }
if (runMachine) { if (machine) {
return AppRunLogger(parent: logger); return AppRunLogger(parent: logger);
} }
return logger; return logger;
......
...@@ -226,7 +226,6 @@ Future<String> _doctorText() async { ...@@ -226,7 +226,6 @@ Future<String> _doctorText() async {
final BufferLogger logger = BufferLogger( final BufferLogger logger = BufferLogger(
terminal: globals.terminal, terminal: globals.terminal,
outputPreferences: globals.outputPreferences, outputPreferences: globals.outputPreferences,
machine: false,
); );
final Doctor doctor = Doctor(logger: logger); final Doctor doctor = Doctor(logger: logger);
......
...@@ -36,12 +36,6 @@ abstract class Logger { ...@@ -36,12 +36,6 @@ abstract class Logger {
bool get hasTerminal; bool get hasTerminal;
/// Whether the current flutter command invocation also contains a `--machine` flag.
///
/// This should be used to elide output to stdout that is not formatted in newline
/// delimited JSON.
bool get machine;
Terminal get terminal; Terminal get terminal;
OutputPreferences get _outputPreferences; OutputPreferences get _outputPreferences;
...@@ -165,9 +159,6 @@ class DelegatingLogger implements Logger { ...@@ -165,9 +159,6 @@ class DelegatingLogger implements Logger {
@override @override
bool get quiet => _delegate.quiet; bool get quiet => _delegate.quiet;
@override
bool get machine => _delegate.machine;
@override @override
set quiet(bool value) => _delegate.quiet = value; set quiet(bool value) => _delegate.quiet = value;
...@@ -278,7 +269,6 @@ class StdoutLogger extends Logger { ...@@ -278,7 +269,6 @@ class StdoutLogger extends Logger {
required this.terminal, required this.terminal,
required Stdio stdio, required Stdio stdio,
required OutputPreferences outputPreferences, required OutputPreferences outputPreferences,
required this.machine,
StopwatchFactory stopwatchFactory = const StopwatchFactory(), StopwatchFactory stopwatchFactory = const StopwatchFactory(),
}) })
: _stdio = stdio, : _stdio = stdio,
...@@ -289,8 +279,6 @@ class StdoutLogger extends Logger { ...@@ -289,8 +279,6 @@ class StdoutLogger extends Logger {
final Terminal terminal; final Terminal terminal;
@override @override
final OutputPreferences _outputPreferences; final OutputPreferences _outputPreferences;
@override
final bool machine;
final Stdio _stdio; final Stdio _stdio;
final StopwatchFactory _stopwatchFactory; final StopwatchFactory _stopwatchFactory;
...@@ -455,14 +443,12 @@ class WindowsStdoutLogger extends StdoutLogger { ...@@ -455,14 +443,12 @@ class WindowsStdoutLogger extends StdoutLogger {
required Terminal terminal, required Terminal terminal,
required Stdio stdio, required Stdio stdio,
required OutputPreferences outputPreferences, required OutputPreferences outputPreferences,
required bool machine,
StopwatchFactory stopwatchFactory = const StopwatchFactory(), StopwatchFactory stopwatchFactory = const StopwatchFactory(),
}) : super( }) : super(
terminal: terminal, terminal: terminal,
stdio: stdio, stdio: stdio,
outputPreferences: outputPreferences, outputPreferences: outputPreferences,
stopwatchFactory: stopwatchFactory, stopwatchFactory: stopwatchFactory,
machine: machine,
); );
@override @override
...@@ -484,7 +470,6 @@ class BufferLogger extends Logger { ...@@ -484,7 +470,6 @@ class BufferLogger extends Logger {
BufferLogger({ BufferLogger({
required this.terminal, required this.terminal,
required OutputPreferences outputPreferences, required OutputPreferences outputPreferences,
this.machine = false,
StopwatchFactory stopwatchFactory = const StopwatchFactory(), StopwatchFactory stopwatchFactory = const StopwatchFactory(),
}) : _outputPreferences = outputPreferences, }) : _outputPreferences = outputPreferences,
_stopwatchFactory = stopwatchFactory; _stopwatchFactory = stopwatchFactory;
...@@ -493,7 +478,6 @@ class BufferLogger extends Logger { ...@@ -493,7 +478,6 @@ class BufferLogger extends Logger {
BufferLogger.test({ BufferLogger.test({
Terminal? terminal, Terminal? terminal,
OutputPreferences? outputPreferences, OutputPreferences? outputPreferences,
this.machine = false,
}) : terminal = terminal ?? Terminal.test(), }) : terminal = terminal ?? Terminal.test(),
_outputPreferences = outputPreferences ?? OutputPreferences.test(), _outputPreferences = outputPreferences ?? OutputPreferences.test(),
_stopwatchFactory = const StopwatchFactory(); _stopwatchFactory = const StopwatchFactory();
...@@ -505,9 +489,6 @@ class BufferLogger extends Logger { ...@@ -505,9 +489,6 @@ class BufferLogger extends Logger {
@override @override
final Terminal terminal; final Terminal terminal;
@override
final bool machine;
final StopwatchFactory _stopwatchFactory; final StopwatchFactory _stopwatchFactory;
@override @override
......
...@@ -274,13 +274,11 @@ Future<T> runInContext<T>( ...@@ -274,13 +274,11 @@ Future<T> runInContext<T>(
terminal: globals.terminal, terminal: globals.terminal,
stdio: globals.stdio, stdio: globals.stdio,
outputPreferences: globals.outputPreferences, outputPreferences: globals.outputPreferences,
machine: false,
) )
: StdoutLogger( : StdoutLogger(
terminal: globals.terminal, terminal: globals.terminal,
stdio: globals.stdio, stdio: globals.stdio,
outputPreferences: globals.outputPreferences, outputPreferences: globals.outputPreferences,
machine: false,
), ),
MacOSWorkflow: () => MacOSWorkflow( MacOSWorkflow: () => MacOSWorkflow(
featureFlags: featureFlags, featureFlags: featureFlags,
......
...@@ -44,7 +44,7 @@ void main() { ...@@ -44,7 +44,7 @@ void main() {
platform = const LocalPlatform(); platform = const LocalPlatform();
processManager = const LocalProcessManager(); processManager = const LocalProcessManager();
terminal = AnsiTerminal(platform: platform, stdio: Stdio()); terminal = AnsiTerminal(platform: platform, stdio: Stdio());
logger = BufferLogger(outputPreferences: OutputPreferences.test(), terminal: terminal, machine: false); logger = BufferLogger(outputPreferences: OutputPreferences.test(), terminal: terminal);
tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_analysis_test.'); tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_analysis_test.');
}); });
......
...@@ -558,9 +558,6 @@ class StreamLogger extends Logger { ...@@ -558,9 +558,6 @@ class StreamLogger extends Logger {
@override @override
bool get isVerbose => true; bool get isVerbose => true;
@override
bool get machine => true;
@override @override
void printError( void printError(
String message, { String message, {
......
...@@ -186,7 +186,6 @@ void main() { ...@@ -186,7 +186,6 @@ void main() {
terminal: Terminal.test(supportsColor: true), terminal: Terminal.test(supportsColor: true),
stdio: FakeStdio(), stdio: FakeStdio(),
outputPreferences: OutputPreferences.test(), outputPreferences: OutputPreferences.test(),
machine: false,
); );
final ArtifactUpdater artifactUpdater = ArtifactUpdater( final ArtifactUpdater artifactUpdater = ArtifactUpdater(
fileSystem: fileSystem, fileSystem: fileSystem,
......
...@@ -16,7 +16,6 @@ void main() { ...@@ -16,7 +16,6 @@ void main() {
final BufferLogger bufferLogger = BufferLogger( final BufferLogger bufferLogger = BufferLogger(
outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40), outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40),
terminal: TestTerminal(platform: FakePlatform()..stdoutSupportsAnsi = true), terminal: TestTerminal(platform: FakePlatform()..stdoutSupportsAnsi = true),
machine: false,
); );
bufferLogger.printStatus('0123456789' * 8); bufferLogger.printStatus('0123456789' * 8);
...@@ -27,7 +26,6 @@ void main() { ...@@ -27,7 +26,6 @@ void main() {
final BufferLogger bufferLogger = BufferLogger( final BufferLogger bufferLogger = BufferLogger(
outputPreferences: OutputPreferences.test(wrapText: false), outputPreferences: OutputPreferences.test(wrapText: false),
terminal: TestTerminal(platform: FakePlatform()..stdoutSupportsAnsi = true), terminal: TestTerminal(platform: FakePlatform()..stdoutSupportsAnsi = true),
machine: false,
); );
final String testString = '0123456789' * 20; final String testString = '0123456789' * 20;
bufferLogger.printStatus(testString); bufferLogger.printStatus(testString);
...@@ -126,7 +124,6 @@ void main() { ...@@ -126,7 +124,6 @@ void main() {
final BufferLogger bufferLogger = BufferLogger( final BufferLogger bufferLogger = BufferLogger(
terminal: terminalUnderTest, terminal: terminalUnderTest,
outputPreferences: OutputPreferences.test(), outputPreferences: OutputPreferences.test(),
machine: false,
); );
terminalUnderTest.usesTerminalUi = true; terminalUnderTest.usesTerminalUi = true;
mockStdInStream = Stream<String>.fromFutures(<Future<String>>[ mockStdInStream = Stream<String>.fromFutures(<Future<String>>[
...@@ -151,7 +148,6 @@ void main() { ...@@ -151,7 +148,6 @@ void main() {
final BufferLogger bufferLogger = BufferLogger( final BufferLogger bufferLogger = BufferLogger(
terminal: terminalUnderTest, terminal: terminalUnderTest,
outputPreferences: OutputPreferences.test(), outputPreferences: OutputPreferences.test(),
machine: false,
); );
terminalUnderTest.usesTerminalUi = true; terminalUnderTest.usesTerminalUi = true;
mockStdInStream = Stream<String>.fromFutures(<Future<String>>[ mockStdInStream = Stream<String>.fromFutures(<Future<String>>[
......
...@@ -40,7 +40,6 @@ void main () { ...@@ -40,7 +40,6 @@ void main () {
testLogger = BufferLogger( testLogger = BufferLogger(
terminal: Terminal.test(), terminal: Terminal.test(),
outputPreferences: OutputPreferences.test(), outputPreferences: OutputPreferences.test(),
machine: false,
); );
mockCmakeProject = FakeCmakeProject(managedCmakeFile); mockCmakeProject = FakeCmakeProject(managedCmakeFile);
......
...@@ -24,7 +24,6 @@ final ProcessUtils processUtils = ProcessUtils(processManager: processManager, l ...@@ -24,7 +24,6 @@ final ProcessUtils processUtils = ProcessUtils(processManager: processManager, l
), ),
stdio: stdio, stdio: stdio,
outputPreferences: OutputPreferences.test(wrapText: true), outputPreferences: OutputPreferences.test(wrapText: true),
machine: false,
)); ));
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', platform.isWindows ? 'flutter.bat' : 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', platform.isWindows ? 'flutter.bat' : 'flutter');
......
...@@ -38,7 +38,6 @@ final Map<Type, Generator> _testbedDefaults = <Type, Generator>{ ...@@ -38,7 +38,6 @@ final Map<Type, Generator> _testbedDefaults = <Type, Generator>{
Logger: () => BufferLogger( Logger: () => BufferLogger(
terminal: AnsiTerminal(stdio: globals.stdio, platform: globals.platform), // Danger, using real stdio. terminal: AnsiTerminal(stdio: globals.stdio, platform: globals.platform), // Danger, using real stdio.
outputPreferences: OutputPreferences.test(), outputPreferences: OutputPreferences.test(),
machine: false,
), // Allows reading logs and prevents stdout. ), // Allows reading logs and prevents stdout.
OperatingSystemUtils: () => FakeOperatingSystemUtils(), OperatingSystemUtils: () => FakeOperatingSystemUtils(),
OutputPreferences: () => OutputPreferences.test(), // configures BufferLogger to avoid color codes. OutputPreferences: () => OutputPreferences.test(), // configures BufferLogger to avoid color codes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment