From f7b1799a620cab1f3c76967ebd293baa88ab3416 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 8 Apr 2016 09:34:42 -0700 Subject: [PATCH] Do not check for an existing package map if a command is going to run "pub get" to update the package map (#3202) Also remove a redundant check for the --pub option in the run command --- packages/flutter_tools/lib/src/commands/run.dart | 11 ----------- .../flutter_tools/lib/src/runner/flutter_command.dart | 11 +++++++---- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart index 88ddcb7b5e..e78f11c184 100644 --- a/packages/flutter_tools/lib/src/commands/run.dart +++ b/packages/flutter_tools/lib/src/commands/run.dart @@ -10,7 +10,6 @@ import 'package:path/path.dart' as path; import '../application_package.dart'; import '../base/common.dart'; import '../build_configuration.dart'; -import '../dart/pub.dart'; import '../device.dart'; import '../globals.dart'; import '../runner/flutter_command.dart'; @@ -82,16 +81,6 @@ class RunCommand extends RunCommandBase { @override bool get requiresDevice => true; - @override - Future run() async { - if (argResults['pub']) { - int exitCode = await pubGet(); - if (exitCode != 0) - return exitCode; - } - return await super.run(); - } - @override Future runInProject() async { bool clearLogs = argResults['clear-logs']; diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index 876c83287f..73bc0c4c23 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -154,10 +154,13 @@ abstract class FlutterCommand extends Command { } } - String error = PackageMap.instance.checkValid(); - if (error != null) { - printError(error); - return false; + // Validate the current package map only if we will not be running "pub get" later. + if (!(_usesPubOption && argResults['pub'])) { + String error = PackageMap.instance.checkValid(); + if (error != null) { + printError(error); + return false; + } } return true;