Commit 5f57d87a authored by John McCutchan's avatar John McCutchan Committed by GitHub

Disable features of `flutter run` that depend on the service protocol when...

Disable features of `flutter run` that depend on the service protocol when running in release mode (#6571)
parent 4046db98
...@@ -28,6 +28,11 @@ abstract class ResidentRunner { ...@@ -28,6 +28,11 @@ abstract class ResidentRunner {
final bool usesTerminalUI; final bool usesTerminalUI;
final Completer<int> _finished = new Completer<int>(); final Completer<int> _finished = new Completer<int>();
bool get isRunningDebug => debuggingOptions.buildMode == BuildMode.debug;
bool get isRunningProfile => debuggingOptions.buildMode == BuildMode.profile;
bool get isRunningRelease => debuggingOptions.buildMode == BuildMode.release;
bool get supportsServiceProtocol => isRunningDebug || isRunningProfile;
VMService vmService; VMService vmService;
FlutterView currentView; FlutterView currentView;
StreamSubscription<String> _loggingSubscription; StreamSubscription<String> _loggingSubscription;
...@@ -72,6 +77,8 @@ abstract class ResidentRunner { ...@@ -72,6 +77,8 @@ abstract class ResidentRunner {
await cleanupAfterSignal(); await cleanupAfterSignal();
exit(0); exit(0);
}); });
if (!supportsServiceProtocol)
return;
ProcessSignal.SIGUSR1.watch().listen((ProcessSignal signal) async { ProcessSignal.SIGUSR1.watch().listen((ProcessSignal signal) async {
printStatus('Caught SIGUSR1'); printStatus('Caught SIGUSR1');
await restart(fullRestart: false); await restart(fullRestart: false);
...@@ -130,9 +137,13 @@ abstract class ResidentRunner { ...@@ -130,9 +137,13 @@ abstract class ResidentRunner {
printHelp(details: true); printHelp(details: true);
return true; return true;
} else if (lower == 'w') { } else if (lower == 'w') {
if (!supportsServiceProtocol)
return true;
await _debugDumpApp(); await _debugDumpApp();
return true; return true;
} else if (lower == 't') { } else if (lower == 't') {
if (!supportsServiceProtocol)
return true;
await _debugDumpRenderTree(); await _debugDumpRenderTree();
return true; return true;
} else if (lower == 'q' || character == AnsiTerminal.KEY_F10) { } else if (lower == 'q' || character == AnsiTerminal.KEY_F10) {
......
...@@ -243,6 +243,8 @@ class RunAndStayResident extends ResidentRunner { ...@@ -243,6 +243,8 @@ class RunAndStayResident extends ResidentRunner {
Future<Null> handleTerminalCommand(String code) async { Future<Null> handleTerminalCommand(String code) async {
String lower = code.toLowerCase(); String lower = code.toLowerCase();
if (lower == 'r' || code == AnsiTerminal.KEY_F5) { if (lower == 'r' || code == AnsiTerminal.KEY_F5) {
if (!supportsServiceProtocol)
return;
if (device.supportsRestart) { if (device.supportsRestart) {
// F5, restart // F5, restart
await restart(); await restart();
...@@ -263,13 +265,17 @@ class RunAndStayResident extends ResidentRunner { ...@@ -263,13 +265,17 @@ class RunAndStayResident extends ResidentRunner {
@override @override
void printHelp({ @required bool details }) { void printHelp({ @required bool details }) {
if (!prebuiltMode && device.supportsRestart) final bool showRestartText = !prebuiltMode && device.supportsRestart &&
supportsServiceProtocol;
if (showRestartText)
printStatus('To restart the app, press "r" or F5.'); printStatus('To restart the app, press "r" or F5.');
if (_result.hasObservatory) if (_result.hasObservatory)
printStatus('The Observatory debugger and profiler is available at: http://127.0.0.1:${_result.observatoryPort}/'); printStatus('The Observatory debugger and profiler is available at: http://127.0.0.1:${_result.observatoryPort}/');
if (details) { if (details) {
printStatus('To dump the widget hierarchy of the app (debugDumpApp), press "w".'); if (supportsServiceProtocol) {
printStatus('To dump the rendering tree of the app (debugDumpRenderTree), press "r".'); printStatus('To dump the widget hierarchy of the app (debugDumpApp), press "w".');
printStatus('To dump the rendering tree of the app (debugDumpRenderTree), press "r".');
}
printStatus('To repeat this help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.'); printStatus('To repeat this help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.');
} else { } else {
printStatus('For a more detailed help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.'); printStatus('For a more detailed help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.');
......
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