remove the --checked option (#3799)

This commit is contained in:
Devon Carew 2016-05-09 10:58:47 -07:00
parent 40152c5593
commit a5b198e9b9
4 changed files with 19 additions and 16 deletions

View File

@ -13,6 +13,7 @@ import '../application_package.dart';
import '../base/file_system.dart'; import '../base/file_system.dart';
import '../base/common.dart'; import '../base/common.dart';
import '../base/os.dart'; import '../base/os.dart';
import '../build_configuration.dart';
import '../device.dart'; import '../device.dart';
import '../globals.dart'; import '../globals.dart';
import '../ios/simulators.dart' show SimControl, IOSSimulatorUtils; import '../ios/simulators.dart' show SimControl, IOSSimulatorUtils;
@ -99,7 +100,7 @@ class DriveCommand extends RunCommandBase {
if (!argResults['use-existing-app']) { if (!argResults['use-existing-app']) {
printStatus('Starting application: ${argResults["target"]}'); printStatus('Starting application: ${argResults["target"]}');
int result = await appStarter(this); int result = await appStarter(this, getBuildMode());
if (result != 0) { if (result != 0) {
printError('Application failed to start. Will not run test. Quitting.'); printError('Application failed to start. Will not run test. Quitting.');
return result; return result;
@ -228,13 +229,14 @@ Future<Device> findTargetDevice() async {
} }
/// Starts the application on the device given command configuration. /// Starts the application on the device given command configuration.
typedef Future<int> AppStarter(DriveCommand command); typedef Future<int> AppStarter(DriveCommand command, BuildMode buildMode);
AppStarter appStarter = startApp; AppStarter appStarter = startApp;
void restoreAppStarter() { void restoreAppStarter() {
appStarter = startApp; appStarter = startApp;
} }
Future<int> startApp(DriveCommand command) async { Future<int> startApp(DriveCommand command, BuildMode buildMode) async {
String mainPath = findMainDartFile(command.target); String mainPath = findMainDartFile(command.target);
if (await fs.type(mainPath) != FileSystemEntityType.FILE) { if (await fs.type(mainPath) != FileSystemEntityType.FILE) {
printError('Tried to run $mainPath, but that file does not exist.'); printError('Tried to run $mainPath, but that file does not exist.');
@ -269,7 +271,7 @@ Future<int> startApp(DriveCommand command) async {
mainPath: mainPath, mainPath: mainPath,
route: command.route, route: command.route,
debuggingOptions: new DebuggingOptions.enabled( debuggingOptions: new DebuggingOptions.enabled(
checked: command.checked, checked: buildMode == BuildMode.debug,
startPaused: true, startPaused: true,
observatoryPort: command.debugPort observatoryPort: command.debugPort
), ),

View File

@ -8,6 +8,7 @@ import 'dart:io';
import '../base/os.dart'; import '../base/os.dart';
import '../base/process.dart'; import '../base/process.dart';
import '../device.dart'; import '../device.dart';
import '../build_configuration.dart';
import '../globals.dart'; import '../globals.dart';
import 'run.dart'; import 'run.dart';
@ -63,7 +64,7 @@ class ListenCommand extends RunCommandBase {
target: target, target: target,
install: firstTime, install: firstTime,
stop: true, stop: true,
debuggingOptions: new DebuggingOptions.enabled(checked: checked), debuggingOptions: new DebuggingOptions.enabled(checked: getBuildMode() == BuildMode.debug),
traceStartup: traceStartup, traceStartup: traceStartup,
route: route route: route
); );

View File

@ -20,10 +20,12 @@ import 'install.dart';
abstract class RunCommandBase extends FlutterCommand { abstract class RunCommandBase extends FlutterCommand {
RunCommandBase() { RunCommandBase() {
argParser.addFlag('checked', addBuildModeFlags();
negatable: true,
defaultsTo: true, // TODO(devoncarew): This flag is ignored, and should be removed once tools
help: 'Toggle Dart\'s checked mode.'); // no longer pass in `--checked`.
argParser.addFlag('checked', negatable: true, hide: true);
argParser.addFlag('trace-startup', argParser.addFlag('trace-startup',
negatable: true, negatable: true,
defaultsTo: false, defaultsTo: false,
@ -33,7 +35,6 @@ abstract class RunCommandBase extends FlutterCommand {
usesTargetOption(); usesTargetOption();
} }
bool get checked => argResults['checked'];
bool get traceStartup => argResults['trace-startup']; bool get traceStartup => argResults['trace-startup'];
String get target => argResults['target']; String get target => argResults['target'];
String get route => argResults['route']; String get route => argResults['route'];
@ -50,7 +51,6 @@ class RunCommand extends RunCommandBase {
final List<String> aliases = <String>['start']; final List<String> aliases = <String>['start'];
RunCommand() { RunCommand() {
addBuildModeFlags();
argParser.addFlag('full-restart', argParser.addFlag('full-restart',
defaultsTo: true, defaultsTo: true,
help: 'Stop any currently running application process before running the app.'); help: 'Stop any currently running application process before running the app.');
@ -105,7 +105,7 @@ class RunCommand extends RunCommandBase {
options = new DebuggingOptions.disabled(); options = new DebuggingOptions.disabled();
} else { } else {
options = new DebuggingOptions.enabled( options = new DebuggingOptions.enabled(
checked: checked, checked: getBuildMode() == BuildMode.debug,
startPaused: argResults['start-paused'], startPaused: argResults['start-paused'],
observatoryPort: debugPort observatoryPort: debugPort
); );

View File

@ -38,7 +38,7 @@ void main() {
targetDeviceFinder = () { targetDeviceFinder = () {
throw 'Unexpected call to targetDeviceFinder'; throw 'Unexpected call to targetDeviceFinder';
}; };
appStarter = (_) { appStarter = (_, __) {
throw 'Unexpected call to appStarter'; throw 'Unexpected call to appStarter';
}; };
testRunner = (_) { testRunner = (_) {
@ -75,7 +75,7 @@ void main() {
testUsingContext('returns 1 when app fails to run', () async { testUsingContext('returns 1 when app fails to run', () async {
withMockDevice(); withMockDevice();
appStarter = expectAsync((_) async => 1); appStarter = expectAsync((_, __) async => 1);
String testApp = '/some/app/test_driver/e2e.dart'; String testApp = '/some/app/test_driver/e2e.dart';
String testFile = '/some/app/test_driver/e2e_test.dart'; String testFile = '/some/app/test_driver/e2e_test.dart';
@ -140,7 +140,7 @@ void main() {
String testApp = '/some/app/test/e2e.dart'; String testApp = '/some/app/test/e2e.dart';
String testFile = '/some/app/test_driver/e2e_test.dart'; String testFile = '/some/app/test_driver/e2e_test.dart';
appStarter = expectAsync((_) { appStarter = expectAsync((_, __) {
return new Future<int>.value(0); return new Future<int>.value(0);
}); });
testRunner = expectAsync((List<String> testArgs) { testRunner = expectAsync((List<String> testArgs) {
@ -172,7 +172,7 @@ void main() {
String testApp = '/some/app/test/e2e.dart'; String testApp = '/some/app/test/e2e.dart';
String testFile = '/some/app/test_driver/e2e_test.dart'; String testFile = '/some/app/test_driver/e2e_test.dart';
appStarter = expectAsync((_) { appStarter = expectAsync((_, __) {
return new Future<int>.value(0); return new Future<int>.value(0);
}); });
testRunner = expectAsync((_) { testRunner = expectAsync((_) {