Inject iOS, Android workflows via context (#10750)
Eliminates the need for the device/daemon code to get at the iOS/Android tooling indirectly via Doctor. In tests, we now inject the workflow objects (or mocks) directly.
This commit is contained in:
@@ -6,6 +6,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import '../android/android_sdk.dart';
|
||||
import '../android/android_workflow.dart';
|
||||
import '../application_package.dart';
|
||||
import '../base/common.dart' show throwToolExit;
|
||||
import '../base/file_system.dart';
|
||||
@@ -17,7 +18,6 @@ import '../base/process_manager.dart';
|
||||
import '../build_info.dart';
|
||||
import '../commands/build_apk.dart';
|
||||
import '../device.dart';
|
||||
import '../doctor.dart';
|
||||
import '../globals.dart';
|
||||
import '../protocol_discovery.dart';
|
||||
|
||||
@@ -45,7 +45,7 @@ class AndroidDevices extends PollingDeviceDiscovery {
|
||||
bool get supportsPlatform => true;
|
||||
|
||||
@override
|
||||
bool get canListAnything => doctor.androidWorkflow.canListDevices;
|
||||
bool get canListAnything => androidWorkflow.canListDevices;
|
||||
|
||||
@override
|
||||
List<Device> pollingGetDevices() => getAdbDevices();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import '../base/context.dart';
|
||||
import '../base/file_system.dart';
|
||||
import '../base/io.dart';
|
||||
import '../base/os.dart';
|
||||
@@ -15,6 +16,8 @@ import '../globals.dart';
|
||||
import 'android_sdk.dart';
|
||||
import 'android_studio.dart' as android_studio;
|
||||
|
||||
AndroidWorkflow get androidWorkflow => context.putIfAbsent(AndroidWorkflow, () => new AndroidWorkflow());
|
||||
|
||||
class AndroidWorkflow extends DoctorValidator implements Workflow {
|
||||
AndroidWorkflow() : super('Android toolchain - develop for Android devices');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user