Commit 68e71146 authored by Jason Simmons's avatar Jason Simmons

Run "pub get" if needed in the flutter build command

parent d24a7d3f
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'dart:async'; import 'dart:async';
import '../flx.dart'; import '../flx.dart';
import '../dart/pub.dart';
import '../globals.dart'; import '../globals.dart';
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
import '../toolchain.dart'; import '../toolchain.dart';
...@@ -25,9 +26,22 @@ class BuildCommand extends FlutterCommand { ...@@ -25,9 +26,22 @@ class BuildCommand extends FlutterCommand {
argParser.addOption('snapshot', defaultsTo: defaultSnapshotPath); argParser.addOption('snapshot', defaultsTo: defaultSnapshotPath);
argParser.addOption('depfile', defaultsTo: defaultDepfilePath); argParser.addOption('depfile', defaultsTo: defaultDepfilePath);
argParser.addOption('working-dir', defaultsTo: defaultWorkingDirPath); argParser.addOption('working-dir', defaultsTo: defaultWorkingDirPath);
argParser.addFlag('pub',
defaultsTo: true,
help: 'Whether to run "pub get" before building the app.');
addTargetOption(); addTargetOption();
} }
@override
Future<int> run() async {
if (argResults['pub']) {
int exitCode = await pubGet();
if (exitCode != 0)
return exitCode;
}
return await super.run();
}
Future<int> runInProject() async { Future<int> runInProject() async {
String compilerPath = argResults['compiler']; String compilerPath = argResults['compiler'];
......
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