Refactor hot/cold/drive runners a little (#7694)

Move the drive/run common stuff to RunCommandBase, rather than the
superclass which applies to everything.

Implement --no-resident (fixes
https://github.com/flutter/flutter/issues/5448). This is particularly
useful when running flutter from scripts.

Rename RunAndStayResident to ColdRunner.
This commit is contained in:
Ian Hickson
2017-01-27 01:03:04 -08:00
committed by GitHub
parent 56eca97a75
commit f888bbed48
7 changed files with 88 additions and 73 deletions

View File

@@ -63,41 +63,6 @@ abstract class FlutterCommand extends Command<Null> {
_usesPubOption = true;
}
void usesPortOptions() {
argParser.addOption('observatory-port',
help: 'Listen to the given port for an observatory debugger connection.\n'
'Specifying port 0 will find a random free port.\n'
'Defaults to the first available port after $kDefaultObservatoryPort.'
);
argParser.addOption('diagnostic-port',
help: 'Listen to the given port for a diagnostic connection.\n'
'Specifying port 0 will find a random free port.\n'
'Defaults to the first available port after $kDefaultDiagnosticPort.'
);
}
int get observatoryPort {
if (argResults['observatory-port'] != null) {
try {
return int.parse(argResults['observatory-port']);
} catch (error) {
throwToolExit('Invalid port for `--observatory-port`: $error');
}
}
return null;
}
int get diagnosticPort {
if (argResults['diagnostic-port'] != null) {
try {
return int.parse(argResults['diagnostic-port']);
} catch (error) {
throwToolExit('Invalid port for `--diagnostic-port`: $error');
}
}
return null;
}
void addBuildModeFlags({ bool defaultToRelease: true }) {
defaultBuildMode = defaultToRelease ? BuildMode.release : BuildMode.debug;