Commit a5b198e9 authored by Devon Carew's avatar Devon Carew

remove the --checked option (#3799)

parent 40152c55
......@@ -13,6 +13,7 @@ import '../application_package.dart';
import '../base/file_system.dart';
import '../base/common.dart';
import '../base/os.dart';
import '../build_configuration.dart';
import '../device.dart';
import '../globals.dart';
import '../ios/simulators.dart' show SimControl, IOSSimulatorUtils;
......@@ -99,7 +100,7 @@ class DriveCommand extends RunCommandBase {
if (!argResults['use-existing-app']) {
printStatus('Starting application: ${argResults["target"]}');
int result = await appStarter(this);
int result = await appStarter(this, getBuildMode());
if (result != 0) {
printError('Application failed to start. Will not run test. Quitting.');
return result;
......@@ -228,13 +229,14 @@ Future<Device> findTargetDevice() async {
}
/// 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;
void restoreAppStarter() {
appStarter = startApp;
}
Future<int> startApp(DriveCommand command) async {
Future<int> startApp(DriveCommand command, BuildMode buildMode) async {
String mainPath = findMainDartFile(command.target);
if (await fs.type(mainPath) != FileSystemEntityType.FILE) {
printError('Tried to run $mainPath, but that file does not exist.');
......@@ -269,7 +271,7 @@ Future<int> startApp(DriveCommand command) async {
mainPath: mainPath,
route: command.route,
debuggingOptions: new DebuggingOptions.enabled(
checked: command.checked,
checked: buildMode == BuildMode.debug,
startPaused: true,
observatoryPort: command.debugPort
),
......
......@@ -8,6 +8,7 @@ import 'dart:io';
import '../base/os.dart';
import '../base/process.dart';
import '../device.dart';
import '../build_configuration.dart';
import '../globals.dart';
import 'run.dart';
......@@ -63,7 +64,7 @@ class ListenCommand extends RunCommandBase {
target: target,
install: firstTime,
stop: true,
debuggingOptions: new DebuggingOptions.enabled(checked: checked),
debuggingOptions: new DebuggingOptions.enabled(checked: getBuildMode() == BuildMode.debug),
traceStartup: traceStartup,
route: route
);
......
......@@ -20,10 +20,12 @@ import 'install.dart';
abstract class RunCommandBase extends FlutterCommand {
RunCommandBase() {
argParser.addFlag('checked',
negatable: true,
defaultsTo: true,
help: 'Toggle Dart\'s checked mode.');
addBuildModeFlags();
// TODO(devoncarew): This flag is ignored, and should be removed once tools
// no longer pass in `--checked`.
argParser.addFlag('checked', negatable: true, hide: true);
argParser.addFlag('trace-startup',
negatable: true,
defaultsTo: false,
......@@ -33,7 +35,6 @@ abstract class RunCommandBase extends FlutterCommand {
usesTargetOption();
}
bool get checked => argResults['checked'];
bool get traceStartup => argResults['trace-startup'];
String get target => argResults['target'];
String get route => argResults['route'];
......@@ -50,7 +51,6 @@ class RunCommand extends RunCommandBase {
final List<String> aliases = <String>['start'];
RunCommand() {
addBuildModeFlags();
argParser.addFlag('full-restart',
defaultsTo: true,
help: 'Stop any currently running application process before running the app.');
......@@ -105,7 +105,7 @@ class RunCommand extends RunCommandBase {
options = new DebuggingOptions.disabled();
} else {
options = new DebuggingOptions.enabled(
checked: checked,
checked: getBuildMode() == BuildMode.debug,
startPaused: argResults['start-paused'],
observatoryPort: debugPort
);
......
......@@ -38,7 +38,7 @@ void main() {
targetDeviceFinder = () {
throw 'Unexpected call to targetDeviceFinder';
};
appStarter = (_) {
appStarter = (_, __) {
throw 'Unexpected call to appStarter';
};
testRunner = (_) {
......@@ -75,7 +75,7 @@ void main() {
testUsingContext('returns 1 when app fails to run', () async {
withMockDevice();
appStarter = expectAsync((_) async => 1);
appStarter = expectAsync((_, __) async => 1);
String testApp = '/some/app/test_driver/e2e.dart';
String testFile = '/some/app/test_driver/e2e_test.dart';
......@@ -140,7 +140,7 @@ void main() {
String testApp = '/some/app/test/e2e.dart';
String testFile = '/some/app/test_driver/e2e_test.dart';
appStarter = expectAsync((_) {
appStarter = expectAsync((_, __) {
return new Future<int>.value(0);
});
testRunner = expectAsync((List<String> testArgs) {
......@@ -172,7 +172,7 @@ void main() {
String testApp = '/some/app/test/e2e.dart';
String testFile = '/some/app/test_driver/e2e_test.dart';
appStarter = expectAsync((_) {
appStarter = expectAsync((_, __) {
return new Future<int>.value(0);
});
testRunner = expectAsync((_) {
......
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