Unverified Commit d561fe72 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Migrate flutter_device_manager to null safety (#95657)

parent 64ff96c2
......@@ -204,6 +204,7 @@ Future<T> runInContext<T>(
platform: globals.platform,
featureFlags: featureFlags,
),
fuchsiaSdk: globals.fuchsiaSdk,
operatingSystemUtils: globals.os,
terminal: globals.terminal,
customDevicesConfig: globals.customDevicesConfig,
......
......@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:meta/meta.dart';
import 'package:process/process.dart';
import 'android/android_device_discovery.dart';
......@@ -42,26 +39,27 @@ import 'windows/windows_workflow.dart';
/// A provider for all of the device discovery instances.
class FlutterDeviceManager extends DeviceManager {
FlutterDeviceManager({
@required Logger logger,
@required Platform platform,
@required ProcessManager processManager,
@required FileSystem fileSystem,
@required AndroidSdk androidSdk,
@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 UserMessages userMessages,
@required OperatingSystemUtils operatingSystemUtils,
@required WindowsWorkflow windowsWorkflow,
@required Terminal terminal,
@required CustomDevicesConfig customDevicesConfig,
@required UwpTool uwptool,
required Logger logger,
required Platform platform,
required ProcessManager processManager,
required FileSystem fileSystem,
required AndroidSdk androidSdk,
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,
required UserMessages userMessages,
required OperatingSystemUtils operatingSystemUtils,
required WindowsWorkflow windowsWorkflow,
required Terminal terminal,
required CustomDevicesConfig customDevicesConfig,
required UwpTool uwptool,
}) : deviceDiscoverers = <DeviceDiscovery>[
AndroidDevices(
logger: logger,
......
......@@ -16,7 +16,6 @@ import '../globals.dart' as globals;
import '../project.dart';
import 'fuchsia_pm.dart';
import 'fuchsia_sdk.dart';
Future<void> _timedBuildStep(String name, Future<void> Function() action) async {
final Stopwatch sw = Stopwatch()..start();
......@@ -55,7 +54,7 @@ Future<void> buildFuchsia({
}
await _timedBuildStep('fuchsia-kernel-compile',
() => fuchsiaSdk!.fuchsiaKernelCompiler.build(
() => globals.fuchsiaSdk!.fuchsiaKernelCompiler.build(
fuchsiaProject: fuchsiaProject, target: targetPath, buildInfo: buildInfo));
if (buildInfo.usesAot) {
......@@ -214,7 +213,7 @@ Future<void> _buildPackage(
manifestFile.writeAsStringSync('meta/package=$pkgDir/meta/package\n',
mode: FileMode.append);
final FuchsiaPM? fuchsiaPM = fuchsiaSdk?.fuchsiaPM;
final FuchsiaPM? fuchsiaPM = globals.fuchsiaSdk?.fuchsiaPM;
if (fuchsiaPM == null) {
return;
}
......
......@@ -83,7 +83,7 @@ class _FuchsiaLogReader extends DeviceLogReader {
Stream<String>? _logLines;
@override
Stream<String> get logLines {
final Stream<String>? logStream = fuchsiaSdk?.syslogs(_device.id);
final Stream<String>? logStream = globals.fuchsiaSdk?.syslogs(_device.id);
_logLines ??= _processLogs(logStream);
return _logLines ?? const Stream<String>.empty();
}
......
......@@ -10,8 +10,6 @@ import '../base/process.dart';
import '../convert.dart';
import '../globals.dart' as globals;
import 'fuchsia_sdk.dart';
/// This is a basic wrapper class for the Fuchsia SDK's `pm` tool.
class FuchsiaPM {
/// Initializes the staging area at [buildPath] for creating the Fuchsia
......@@ -199,7 +197,7 @@ class FuchsiaPackageServer {
return false;
}
// initialize a new repo.
final FuchsiaPM? fuchsiaPM = fuchsiaSdk?.fuchsiaPM;
final FuchsiaPM? fuchsiaPM = globals.fuchsiaSdk?.fuchsiaPM;
if (fuchsiaPM == null || !await fuchsiaPM.newrepo(_repo)) {
globals.printError('Failed to create a new package server repo');
return false;
......@@ -232,7 +230,7 @@ class FuchsiaPackageServer {
if (_process == null) {
return false;
}
return (await fuchsiaSdk?.fuchsiaPM.publish(_repo, package.path)) == true;
return (await globals.fuchsiaSdk?.fuchsiaPM.publish(_repo, package.path)) == true;
}
@override
......
......@@ -4,7 +4,6 @@
import 'dart:async';
import '../base/context.dart';
import '../base/file_system.dart';
import '../base/io.dart';
import '../base/platform.dart';
......@@ -15,9 +14,6 @@ import 'fuchsia_ffx.dart';
import 'fuchsia_kernel_compiler.dart';
import 'fuchsia_pm.dart';
/// The [FuchsiaSdk] instance.
FuchsiaSdk? get fuchsiaSdk => context.get<FuchsiaSdk>();
/// Returns [true] if the current platform supports Fuchsia targets.
bool isFuchsiaSupportedPlatform(Platform platform) {
return platform.isLinux || platform.isMacOS;
......
......@@ -66,6 +66,7 @@ AndroidStudio? get androidStudio => context.get<AndroidStudio>();
AndroidSdk? get androidSdk => context.get<AndroidSdk>();
FlutterVersion get flutterVersion => context.get<FlutterVersion>()!;
FuchsiaArtifacts? get fuchsiaArtifacts => context.get<FuchsiaArtifacts>();
FuchsiaSdk? get fuchsiaSdk => context.get<FuchsiaSdk>();
Usage get flutterUsage => context.get<Usage>()!;
XcodeProjectInterpreter? get xcodeProjectInterpreter => context.get<XcodeProjectInterpreter>();
XCDevice? get xcdevice => context.get<XCDevice>();
......
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