From 556e374e02b5a2dfb622f2f952477736f6191679 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 2 Jul 2019 17:40:55 -0700 Subject: [PATCH] fix default artifacts to exclude ios and android (#35303) --- packages/flutter_tools/lib/src/commands/doctor.dart | 11 +++++++++++ .../flutter_tools/lib/src/runner/flutter_command.dart | 5 +---- .../flutter_tools/test/commands/install_test.dart | 11 +++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/doctor.dart b/packages/flutter_tools/lib/src/commands/doctor.dart index 84480a8174..b2d2b516f3 100644 --- a/packages/flutter_tools/lib/src/commands/doctor.dart +++ b/packages/flutter_tools/lib/src/commands/doctor.dart @@ -30,6 +30,17 @@ class DoctorCommand extends FlutterCommand { @override final String description = 'Show information about the installed tooling.'; + @override + Future> get requiredArtifacts async { + return { + DevelopmentArtifact.universal, + // This is required because we use gen_snapshot to check if the host + // machine can execute the provided artifacts. See `_genSnapshotRuns` + // in `doctor.dart`. + DevelopmentArtifact.android, + }; + } + @override Future runCommand() async { if (argResults.wasParsed('check-for-remote-artifacts')) { diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index 788114836d..dc48eab974 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -479,12 +479,9 @@ abstract class FlutterCommand extends Command { /// The set of development artifacts required for this command. /// - /// Defaults to [DevelopmentArtifact.universal], - /// [DevelopmentArtifact.android], and [DevelopmentArtifact.iOS]. + /// Defaults to [DevelopmentArtifact.universal]. Future> get requiredArtifacts async => const { DevelopmentArtifact.universal, - DevelopmentArtifact.iOS, - DevelopmentArtifact.android, }; /// Subclasses must implement this to execute the command. diff --git a/packages/flutter_tools/test/commands/install_test.dart b/packages/flutter_tools/test/commands/install_test.dart index 1f56cb0900..fa2e217a5e 100644 --- a/packages/flutter_tools/test/commands/install_test.dart +++ b/packages/flutter_tools/test/commands/install_test.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/commands/install.dart'; import 'package:mockito/mockito.dart'; @@ -11,6 +12,10 @@ import '../src/mocks.dart'; void main() { group('install', () { + setUpAll(() { + Cache.disableLocking(); + }); + testUsingContext('returns 0 when Android is connected and ready for an install', () async { final InstallCommand command = InstallCommand(); applyMocksToCommand(command); @@ -21,6 +26,8 @@ void main() { testDeviceManager.addDevice(device); await createTestCommandRunner(command).run(['install']); + }, overrides: { + Cache: () => MockCache(), }); testUsingContext('returns 0 when iOS is connected and ready for an install', () async { @@ -33,6 +40,10 @@ void main() { testDeviceManager.addDevice(device); await createTestCommandRunner(command).run(['install']); + }, overrides: { + Cache: () => MockCache(), }); }); } + +class MockCache extends Mock implements Cache {}