Commit dd5831cb authored by Adam Barth's avatar Adam Barth

Run `pub get` if flutter_tools.stamp changes (#3206)

This will help folks run pub get after they upgrade their flutter.git
revision.
parent 99e916d0
......@@ -9,8 +9,21 @@ import 'package:path/path.dart' as path;
import '../base/logger.dart';
import '../base/process.dart';
import '../cache.dart';
import '../globals.dart';
bool _shouldRunPubGet({ File pubSpecYaml, File dotPackages }) {
if (!dotPackages.existsSync())
return true;
DateTime dotPackagesLastModified = dotPackages.lastModifiedSync();
if (pubSpecYaml.lastModifiedSync().isAfter(dotPackagesLastModified))
return true;
File flutterToolsStamp = new File(path.join(Cache.instance.getRoot().path, 'flutter_tools.stamp'));
if (flutterToolsStamp.lastModifiedSync().isAfter(dotPackagesLastModified))
return true;
return false;
}
Future<int> pubGet({
String directory,
bool skipIfAbsent: false,
......@@ -30,7 +43,7 @@ Future<int> pubGet({
return 1;
}
if (!checkLastModified || !dotPackages.existsSync() || pubSpecYaml.lastModifiedSync().isAfter(dotPackages.lastModifiedSync())) {
if (!checkLastModified || _shouldRunPubGet(pubSpecYaml: pubSpecYaml, dotPackages: dotPackages)) {
String command = upgrade ? 'upgrade' : 'get';
Status status = logger.startProgress("Running 'pub $command' in ${path.basename(directory)}...");
int code = await runCommandAndStreamOutput(
......
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