mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Run pub get if flutter_tools.stamp changes (#3206)
This will help folks run pub get after they upgrade their flutter.git revision.
This commit is contained in:
parent
99e916d0e2
commit
dd5831cb36
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user