mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Merge pull request #2623 from jason-simmons/build_pub_get
Run "pub get" if needed in the flutter build command
This commit is contained in:
commit
a4453231f9
@ -5,6 +5,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import '../flx.dart';
|
||||
import '../dart/pub.dart';
|
||||
import '../globals.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
import '../toolchain.dart';
|
||||
@ -25,9 +26,22 @@ class BuildCommand extends FlutterCommand {
|
||||
argParser.addOption('snapshot', defaultsTo: defaultSnapshotPath);
|
||||
argParser.addOption('depfile', defaultsTo: defaultDepfilePath);
|
||||
argParser.addOption('working-dir', defaultsTo: defaultWorkingDirPath);
|
||||
argParser.addFlag('pub',
|
||||
defaultsTo: true,
|
||||
help: 'Whether to run "pub get" before building the app.');
|
||||
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 {
|
||||
String compilerPath = argResults['compiler'];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user