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