Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: sdk/lib/_internal/pub/lib/src/entrypoint.dart

Issue 21147002: Install before starting the server if the lockfile is out of date. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/serve.dart ('k') | sdk/lib/_internal/pub/lib/src/package.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/entrypoint.dart
diff --git a/sdk/lib/_internal/pub/lib/src/entrypoint.dart b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
index 1f09a3a1caaa9c6fe49bf6281be863d3a72bf962..70888bc632f13075b142ca90d936bb653b3445c2 100644
--- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart
+++ b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
@@ -154,6 +154,36 @@ class Entrypoint {
return new LockFile.load(lockFilePath, cache.sources);
}
+ /// Determines whether or not the lockfile is out of date with respect to the
+ /// pubspec.
+ ///
+ /// This will be `false` if there is no lockfile at all, or if the pubspec
+ /// contains dependencies that are not in the lockfile or that don't match
+ /// what's in there.
+ bool isLockFileUpToDate() {
+ var lockFile = loadLockFile();
+
+ checkDependency(package) {
+ var locked = lockFile.packages[package.name];
+ if (locked == null) return false;
+
+ if (package.source != locked.source) return false;
+ if (!package.constraint.allows(locked.version)) return false;
+
+ var source = cache.sources[package.source];
+ if (!source.descriptionsEqual(package.description, locked.description)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ if (!root.dependencies.every(checkDependency)) return false;
+ if (!root.devDependencies.every(checkDependency)) return false;
+
+ return true;
+ }
+
/// Saves a list of concrete package versions to the `pubspec.lock` file.
void _saveLockFile(List<PackageId> packageIds) {
var lockFile = new LockFile.empty();
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/serve.dart ('k') | sdk/lib/_internal/pub/lib/src/package.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698