flutter_device_manager.dart 4.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:process/process.dart';

import 'android/android_device_discovery.dart';
import 'android/android_sdk.dart';
import 'android/android_workflow.dart';
import 'artifacts.dart';
import 'base/file_system.dart';
import 'base/os.dart';
import 'base/platform.dart';
14 15
import 'custom_devices/custom_device.dart';
import 'custom_devices/custom_devices_config.dart';
16 17 18 19 20 21 22 23 24 25
import 'device.dart';
import 'features.dart';
import 'fuchsia/fuchsia_device.dart';
import 'fuchsia/fuchsia_sdk.dart';
import 'fuchsia/fuchsia_workflow.dart';
import 'ios/devices.dart';
import 'ios/ios_workflow.dart';
import 'ios/simulators.dart';
import 'linux/linux_device.dart';
import 'macos/macos_device.dart';
26
import 'macos/macos_ipad_device.dart';
27
import 'macos/macos_workflow.dart';
28
import 'macos/xcdevice.dart';
29 30 31
import 'tester/flutter_tester.dart';
import 'version.dart';
import 'web/web_device.dart';
32

33 34 35 36 37 38
import 'windows/windows_device.dart';
import 'windows/windows_workflow.dart';

/// A provider for all of the device discovery instances.
class FlutterDeviceManager extends DeviceManager {
  FlutterDeviceManager({
39
    required super.logger,
40 41 42
    required Platform platform,
    required ProcessManager processManager,
    required FileSystem fileSystem,
43
    required AndroidSdk? androidSdk,
44 45 46 47 48 49 50 51 52 53
    required FeatureFlags featureFlags,
    required IOSSimulatorUtils iosSimulatorUtils,
    required XCDevice xcDevice,
    required AndroidWorkflow androidWorkflow,
    required IOSWorkflow iosWorkflow,
    required FuchsiaWorkflow fuchsiaWorkflow,
    required FlutterVersion flutterVersion,
    required Artifacts artifacts,
    required MacOSWorkflow macOSWorkflow,
    required FuchsiaSdk fuchsiaSdk,
54
    required super.userMessages,
55 56
    required OperatingSystemUtils operatingSystemUtils,
    required WindowsWorkflow windowsWorkflow,
57
    required super.terminal,
58
    required CustomDevicesConfig customDevicesConfig,
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
  }) : deviceDiscoverers =  <DeviceDiscovery>[
    AndroidDevices(
      logger: logger,
      androidSdk: androidSdk,
      androidWorkflow: androidWorkflow,
      processManager: processManager,
      fileSystem: fileSystem,
      platform: platform,
      userMessages: userMessages,
    ),
    IOSDevices(
      platform: platform,
      xcdevice: xcDevice,
      iosWorkflow: iosWorkflow,
      logger: logger,
    ),
    IOSSimulators(
      iosSimulatorUtils: iosSimulatorUtils,
    ),
    FuchsiaDevices(
      fuchsiaSdk: fuchsiaSdk,
      logger: logger,
      fuchsiaWorkflow: fuchsiaWorkflow,
      platform: platform,
    ),
    FlutterTesterDevices(
      fileSystem: fileSystem,
      flutterVersion: flutterVersion,
      processManager: processManager,
      logger: logger,
      artifacts: artifacts,
      operatingSystemUtils: operatingSystemUtils,
    ),
    MacOSDevices(
      processManager: processManager,
      macOSWorkflow: macOSWorkflow,
      logger: logger,
      platform: platform,
      fileSystem: fileSystem,
      operatingSystemUtils: operatingSystemUtils,
99 100 101 102 103 104 105 106
    ),
    MacOSDesignedForIPadDevices(
      processManager: processManager,
      iosWorkflow: iosWorkflow,
      logger: logger,
      platform: platform,
      fileSystem: fileSystem,
      operatingSystemUtils: operatingSystemUtils,
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
    ),
    LinuxDevices(
      platform: platform,
      featureFlags: featureFlags,
      processManager: processManager,
      logger: logger,
      fileSystem: fileSystem,
      operatingSystemUtils: operatingSystemUtils,
    ),
    WindowsDevices(
      processManager: processManager,
      operatingSystemUtils: operatingSystemUtils,
      logger: logger,
      fileSystem: fileSystem,
      windowsWorkflow: windowsWorkflow,
    ),
    WebDevices(
      featureFlags: featureFlags,
      fileSystem: fileSystem,
      platform: platform,
      processManager: processManager,
      logger: logger,
    ),
130 131 132 133 134 135
    CustomDevices(
      featureFlags: featureFlags,
      processManager: processManager,
      logger: logger,
      config: customDevicesConfig
    ),
136
  ];
137 138 139 140

  @override
  final List<DeviceDiscovery> deviceDiscoverers;
}