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

Unified Diff: utils/pub/system_cache.dart

Issue 12171002: Tweak SDK constraint checking a bit. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up Package and Pubspec a bit. Created 7 years, 11 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 | « utils/pub/source.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/system_cache.dart
diff --git a/utils/pub/system_cache.dart b/utils/pub/system_cache.dart
index 2fec00262e77ce2ee2baa039a81240b1ed755fa1..4041e40d8ac743faf18ef7e4770c3acd329305d2 100644
--- a/utils/pub/system_cache.dart
+++ b/utils/pub/system_cache.dart
@@ -62,22 +62,17 @@ class SystemCache {
/// Gets the package identified by [id]. If the package is already cached,
/// reads it from the cache. Otherwise, requests it from the source.
- Future<Package> describe(PackageId id) {
- Future<Package> getUncached() {
- // Not cached, so get it from the source.
- return id.describe().then((pubspec) => new Package.inMemory(pubspec));
- }
-
+ Future<Pubspec> describe(PackageId id) {
// Try to get it from the system cache first.
if (id.source.shouldCache) {
return id.systemCacheDirectory.then((packageDir) {
- if (!dirExists(packageDir)) return getUncached();
- return new Package(id.name, packageDir, sources);
+ if (!dirExists(packageDir)) return id.describe();
+ return new Pubspec.load(id.name, packageDir, sources);
});
}
// Not cached, so get it from the source.
- return getUncached();
+ return id.describe();
}
/// Ensures that the package identified by [id] is installed to the cache,
« no previous file with comments | « utils/pub/source.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698