Commit dff0edbc authored by Adam Barth's avatar Adam Barth

init command errors out

We were checking for a pubspec.yaml too early.
parent abe69c7f
...@@ -85,7 +85,14 @@ class FlutterCommandRunner extends CommandRunner { ...@@ -85,7 +85,14 @@ class FlutterCommandRunner extends CommandRunner {
help: 'Path to your packages directory.', defaultsTo: 'packages'); help: 'Path to your packages directory.', defaultsTo: 'packages');
} }
List<BuildConfiguration> buildConfigurations; List<BuildConfiguration> get buildConfigurations {
if (_buildConfigurations == null)
_buildConfigurations = _createBuildConfigurations(_globalResults);
return _buildConfigurations;
}
List<BuildConfiguration> _buildConfigurations;
ArgResults _globalResults;
Future<int> runCommand(ArgResults globalResults) async { Future<int> runCommand(ArgResults globalResults) async {
if (globalResults['verbose']) if (globalResults['verbose'])
...@@ -94,6 +101,11 @@ class FlutterCommandRunner extends CommandRunner { ...@@ -94,6 +101,11 @@ class FlutterCommandRunner extends CommandRunner {
if (globalResults['very-verbose']) if (globalResults['very-verbose'])
Logger.root.level = Level.FINE; Logger.root.level = Level.FINE;
_globalResults = globalResults;
return super.runCommand(globalResults);
}
List<BuildConfiguration> _createBuildConfigurations(ArgResults globalResults) {
ArtifactStore.packageRoot = globalResults['package-root']; ArtifactStore.packageRoot = globalResults['package-root'];
if (!FileSystemEntity.isDirectorySync(ArtifactStore.packageRoot)) { if (!FileSystemEntity.isDirectorySync(ArtifactStore.packageRoot)) {
String message = '${ArtifactStore.packageRoot} is not a valid directory.'; String message = '${ArtifactStore.packageRoot} is not a valid directory.';
...@@ -104,15 +116,9 @@ class FlutterCommandRunner extends CommandRunner { ...@@ -104,15 +116,9 @@ class FlutterCommandRunner extends CommandRunner {
message += '\nDid you run this command from the same directory as your pubspec.yaml file?'; message += '\nDid you run this command from the same directory as your pubspec.yaml file?';
} }
_logging.severe(message); _logging.severe(message);
return 2; exit(2);
} }
buildConfigurations = _createBuildConfigurations(globalResults);
return super.runCommand(globalResults);
}
List<BuildConfiguration> _createBuildConfigurations(ArgResults globalResults) {
String enginePath = globalResults['engine-src-path']; String enginePath = globalResults['engine-src-path'];
bool isDebug = globalResults['debug']; bool isDebug = globalResults['debug'];
bool isRelease = globalResults['release']; bool isRelease = globalResults['release'];
......
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