Commit c1a3100e authored by John McCutchan's avatar John McCutchan Committed by GitHub

Remove all the Android specific special cases from the runners (#6957)

- [x] Make iOS and Android application startup paths consisitent.
- [x] Remove the now unncessary Android specific special cases from the runners.
parent 3f600e99
......@@ -12,9 +12,11 @@ import '../base/os.dart';
import '../base/logger.dart';
import '../base/process.dart';
import '../build_info.dart';
import '../commands/build_apk.dart';
import '../device.dart';
import '../globals.dart';
import '../protocol_discovery.dart';
import 'adb.dart';
import 'android.dart';
import 'android_sdk.dart';
......@@ -282,6 +284,29 @@ class AndroidDevice extends Device {
if (!_checkForSupportedAdbVersion() || !_checkForSupportedAndroidVersion())
return new LaunchResult.failed();
printTrace("Stopping app '${package.name}' on $name.");
await stopApp(package);
if (!prebuiltApplication) {
printTrace('Building APK');
await buildApk(platform,
target: mainPath,
buildMode: debuggingOptions.buildMode
);
}
if (isAppInstalled(package)) {
printStatus('Uninstalling old version...');
if (!uninstallApp(package))
printError('Warning: uninstalling old version failed');
}
printTrace('Installing APK.');
if (!installApp(package)) {
printTrace('Error: Failed to install APK.');
return new LaunchResult.failed();
}
final bool traceStartup = platformArgs['trace-startup'] ?? false;
final AndroidApk apk = package;
printTrace('$this startApp');
......
......@@ -18,8 +18,6 @@ import 'base/process.dart';
import 'base/utils.dart';
import 'build_info.dart';
import 'cache.dart';
import 'commands/build_apk.dart';
import 'commands/install.dart';
import 'dart/package_map.dart';
import 'devfs.dart';
import 'device.dart';
......@@ -201,29 +199,6 @@ class HotRunner extends ResidentRunner {
return 1;
}
// TODO(devoncarew): We shouldn't have to do type checks here.
if (shouldBuild && device is AndroidDevice) {
printTrace('Running build command.');
await buildApk(
device.platform,
target: target,
buildMode: debuggingOptions.buildMode
);
}
// TODO(devoncarew): Move this into the device.startApp() impls.
if (_package != null) {
printTrace("Stopping app '${_package.name}' on ${device.name}.");
await device.stopApp(_package);
}
if (prebuiltMode || device is AndroidDevice) {
printTrace('Running install command.');
if (!(installApp(device, _package, uninstall: false)))
return 1;
}
Map<String, dynamic> platformArgs = new Map<String, dynamic>();
await startEchoingDeviceLog(_package);
......
......@@ -10,8 +10,6 @@ import 'package:stack_trace/stack_trace.dart';
import 'application_package.dart';
import 'base/utils.dart';
import 'commands/build_apk.dart';
import 'commands/install.dart';
import 'commands/trace.dart';
import 'device.dart';
import 'globals.dart';
......@@ -91,30 +89,6 @@ class RunAndStayResident extends ResidentRunner {
Stopwatch startTime = new Stopwatch()..start();
// TODO(devoncarew): We shouldn't have to do type checks here.
if (shouldBuild && device is AndroidDevice) {
printTrace('Running build command.');
await buildApk(
device.platform,
target: target,
buildMode: debuggingOptions.buildMode
);
}
// TODO(devoncarew): Move this into the device.startApp() impls.
if (_package != null) {
printTrace('Stopping app "${_package.name}" on ${device.name}.');
await device.stopApp(_package);
}
// TODO(devoncarew): This fails for ios devices - we haven't built yet.
if (prebuiltMode || device is AndroidDevice) {
printTrace('Running install command.');
if (!(installApp(device, _package, uninstall: false)))
return 1;
}
Map<String, dynamic> platformArgs;
if (traceStartup != null)
platformArgs = <String, dynamic>{ 'trace-startup': traceStartup };
......
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