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
This commit is contained in:
Jason Simmons
2016-04-08 09:34:42 -07:00
parent 412ce9d295
commit f7b1799a62
2 changed files with 7 additions and 15 deletions

View File

@@ -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<int> run() async {
if (argResults['pub']) {
int exitCode = await pubGet();
if (exitCode != 0)
return exitCode;
}
return await super.run();
}
@override
Future<int> runInProject() async {
bool clearLogs = argResults['clear-logs'];

View File

@@ -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;