Skip printing rendered error text in machine mode (#61684)

This commit is contained in:
Helin Shiah
2020-07-20 09:41:03 -07:00
committed by GitHub
parent c4bfa4c7ab
commit 5b9ce492f3
9 changed files with 106 additions and 27 deletions

View File

@@ -53,6 +53,7 @@ class DwdsWebRunnerFactory extends WebRunnerFactory {
@required bool ipv6,
@required DebuggingOptions debuggingOptions,
@required UrlTunneller urlTunneller,
bool machine = false,
}) {
return _ResidentWebRunner(
device,
@@ -62,6 +63,7 @@ class DwdsWebRunnerFactory extends WebRunnerFactory {
ipv6: ipv6,
stayResident: stayResident,
urlTunneller: urlTunneller,
machine: machine,
);
}
}
@@ -79,12 +81,14 @@ abstract class ResidentWebRunner extends ResidentRunner {
@required bool ipv6,
@required DebuggingOptions debuggingOptions,
bool stayResident = true,
bool machine = false,
}) : super(
<FlutterDevice>[device],
target: target ?? globals.fs.path.join('lib', 'main.dart'),
debuggingOptions: debuggingOptions,
ipv6: ipv6,
stayResident: stayResident,
machine: machine,
);
FlutterDevice get device => flutterDevices.first;
@@ -390,6 +394,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
@required DebuggingOptions debuggingOptions,
bool stayResident = true,
@required this.urlTunneller,
bool machine = false,
}) : super(
device,
flutterProject: flutterProject,
@@ -397,6 +402,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
debuggingOptions: debuggingOptions,
ipv6: ipv6,
stayResident: stayResident,
machine: machine,
);
final UrlTunneller urlTunneller;

View File

@@ -448,6 +448,7 @@ class AppDomain extends Domain {
String dillOutputPath,
bool ipv6 = false,
String isolateFilter,
bool machine = true,
}) async {
if (!await device.supportsRuntimeMode(options.buildInfo.mode)) {
throw Exception(
@@ -480,6 +481,7 @@ class AppDomain extends Domain {
ipv6: ipv6,
stayResident: true,
urlTunneller: options.webEnableExposeUrl ? daemon.daemonDomain.exposeUrl : null,
machine: machine,
);
} else if (enableHotReload) {
runner = HotRunner(
@@ -491,6 +493,7 @@ class AppDomain extends Domain {
dillOutputPath: dillOutputPath,
ipv6: ipv6,
hostIsIde: true,
machine: machine,
);
} else {
runner = ColdRunner(
@@ -499,6 +502,7 @@ class AppDomain extends Domain {
debuggingOptions: options,
applicationBinary: applicationBinary,
ipv6: ipv6,
machine: machine,
);
}

View File

@@ -450,6 +450,7 @@ class RunCommand extends RunCommandBase {
packagesFilePath: globalResults['packages'] as String,
dillOutputPath: stringArg('output-dill'),
ipv6: ipv6,
machine: true,
);
} on Exception catch (error) {
throwToolExit(error.toString());

View File

@@ -705,6 +705,7 @@ abstract class ResidentRunner {
this.stayResident = true,
this.hotMode = true,
String dillOutputPath,
this.machine = false,
}) : mainPath = findMainDartFile(target),
packagesFilePath = debuggingOptions.buildInfo.packagesPath,
projectRootPath = projectRootPath ?? globals.fs.currentDirectory.path,
@@ -741,6 +742,7 @@ abstract class ResidentRunner {
final AssetBundle assetBundle;
final CommandHelp commandHelp;
final bool machine;
io.HttpServer _devtoolsServer;
@@ -1141,7 +1143,7 @@ abstract class ResidentRunner {
}
void printStructuredErrorLog(vm_service.Event event) {
if (event.extensionKind == 'Flutter.Error') {
if (event.extensionKind == 'Flutter.Error' && !machine) {
final Map<dynamic, dynamic> json = event.extensionData?.data;
if (json != null && json.containsKey('renderedErrorText')) {
globals.printStatus('\n${json['renderedErrorText']}');

View File

@@ -23,12 +23,16 @@ class ColdRunner extends ResidentRunner {
this.applicationBinary,
bool ipv6 = false,
bool stayResident = true,
}) : super(devices,
target: target,
debuggingOptions: debuggingOptions,
hotMode: false,
stayResident: stayResident,
ipv6: ipv6);
bool machine = false,
}) : super(
devices,
target: target,
debuggingOptions: debuggingOptions,
hotMode: false,
stayResident: stayResident,
ipv6: ipv6,
machine: machine,
);
final bool traceStartup;
final bool awaitFirstFrameWhenTracing;

View File

@@ -74,14 +74,18 @@ class HotRunner extends ResidentRunner {
String dillOutputPath,
bool stayResident = true,
bool ipv6 = false,
}) : super(devices,
target: target,
debuggingOptions: debuggingOptions,
projectRootPath: projectRootPath,
stayResident: stayResident,
hotMode: true,
dillOutputPath: dillOutputPath,
ipv6: ipv6);
bool machine = false,
}) : super(
devices,
target: target,
debuggingOptions: debuggingOptions,
projectRootPath: projectRootPath,
stayResident: stayResident,
hotMode: true,
dillOutputPath: dillOutputPath,
ipv6: ipv6,
machine: machine,
);
final bool benchmarkMode;
final File applicationBinary;

View File

@@ -25,5 +25,6 @@ abstract class WebRunnerFactory {
@required bool ipv6,
@required DebuggingOptions debuggingOptions,
@required UrlTunneller urlTunneller,
bool machine = false,
});
}