forked from firka/flutter
Resolve TODOs to migrate from OperatingSystemUtils to Platform (#8314)
This commit is contained in:
@@ -100,7 +100,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
|
||||
String configuredStudio = config.getValue('android-studio-dir');
|
||||
if (configuredStudio != null) {
|
||||
String configuredStudioPath = configuredStudio;
|
||||
if (os.isMacOS && !configuredStudioPath.endsWith('Contents'))
|
||||
if (platform.isMacOS && !configuredStudioPath.endsWith('Contents'))
|
||||
configuredStudioPath = fs.path.join(configuredStudioPath, 'Contents');
|
||||
return new AndroidStudio(configuredStudioPath,
|
||||
configured: configuredStudio);
|
||||
|
||||
@@ -27,13 +27,6 @@ abstract class OperatingSystemUtils {
|
||||
|
||||
OperatingSystemUtils._private();
|
||||
|
||||
|
||||
// TODO(tvolkert): Remove these and migrate callers to Platform
|
||||
String get operatingSystem => platform.operatingSystem;
|
||||
bool get isMacOS => operatingSystem == 'macos';
|
||||
bool get isWindows => operatingSystem == 'windows';
|
||||
bool get isLinux => operatingSystem == 'linux';
|
||||
|
||||
/// Make the given file executable. This may be a no-op on some platforms.
|
||||
ProcessResult makeExecutable(File file);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import '../android/android_device.dart' show AndroidDevice;
|
||||
import '../application_package.dart';
|
||||
import '../base/file_system.dart';
|
||||
import '../base/common.dart';
|
||||
import '../base/os.dart';
|
||||
import '../base/platform.dart';
|
||||
import '../base/process.dart';
|
||||
import '../build_info.dart';
|
||||
import '../cache.dart';
|
||||
@@ -199,7 +199,7 @@ Future<Device> findTargetDevice() async {
|
||||
}
|
||||
|
||||
|
||||
if (os.isMacOS) {
|
||||
if (platform.isMacOS) {
|
||||
// On Mac we look for the iOS Simulator. If available, we use that. Then
|
||||
// we look for an Android device. If there's one, we use that. Otherwise,
|
||||
// we launch a new iOS Simulator.
|
||||
@@ -225,7 +225,7 @@ Future<Device> findTargetDevice() async {
|
||||
printError('Failed to start iOS Simulator.');
|
||||
return null;
|
||||
}
|
||||
} else if (os.isLinux || os.isWindows) {
|
||||
} else if (platform.isLinux || platform.isWindows) {
|
||||
// On Linux and Windows, for now, we just grab the first connected device we can find.
|
||||
if (devices.isEmpty) {
|
||||
printError('No devices found.');
|
||||
|
||||
@@ -11,8 +11,9 @@ import '../base/common.dart';
|
||||
import '../base/file_system.dart';
|
||||
import '../base/io.dart';
|
||||
import '../base/logger.dart';
|
||||
import '../base/process_manager.dart';
|
||||
import '../base/os.dart';
|
||||
import '../base/platform.dart';
|
||||
import '../base/process_manager.dart';
|
||||
import '../cache.dart';
|
||||
import '../dart/package_map.dart';
|
||||
import '../globals.dart';
|
||||
@@ -112,7 +113,7 @@ class TestCommand extends FlutterCommand {
|
||||
|
||||
String baseCoverageData = 'coverage/lcov.base.info';
|
||||
if (mergeCoverageData) {
|
||||
if (!os.isLinux) {
|
||||
if (!platform.isLinux) {
|
||||
printError(
|
||||
'Merging coverage data is supported only on Linux because it '
|
||||
'requires the "lcov" tool.'
|
||||
@@ -127,9 +128,9 @@ class TestCommand extends FlutterCommand {
|
||||
|
||||
if (os.which('lcov') == null) {
|
||||
String installMessage = 'Please install lcov.';
|
||||
if (os.isLinux)
|
||||
if (platform.isLinux)
|
||||
installMessage = 'Consider running "sudo apt-get install lcov".';
|
||||
else if (os.isMacOS)
|
||||
else if (platform.isMacOS)
|
||||
installMessage = 'Consider running "brew install lcov".';
|
||||
printError('Missing "lcov" tool. Unable to merge coverage data.\n$installMessage');
|
||||
return false;
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'base/common.dart';
|
||||
import 'base/file_system.dart';
|
||||
import 'base/io.dart';
|
||||
import 'base/logger.dart';
|
||||
import 'base/os.dart';
|
||||
import 'base/platform.dart';
|
||||
import 'base/utils.dart';
|
||||
import 'build_info.dart';
|
||||
import 'dart/dependencies.dart';
|
||||
@@ -157,7 +157,7 @@ abstract class ResidentRunner {
|
||||
void registerSignalHandlers() {
|
||||
assert(stayResident);
|
||||
ProcessSignal.SIGINT.watch().listen(_cleanUpAndExit);
|
||||
if (!os.isWindows) // TODO(goderbauer): enable on Windows when https://github.com/dart-lang/sdk/issues/28603 is fixed
|
||||
if (!platform.isWindows) // TODO(goderbauer): enable on Windows when https://github.com/dart-lang/sdk/issues/28603 is fixed
|
||||
ProcessSignal.SIGTERM.watch().listen(_cleanUpAndExit);
|
||||
if (!supportsServiceProtocol || !supportsRestart)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user