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

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

Issue 136063005: Add a "cache add" command to download packages to the cache. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 10 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/source.dart ('k') | sdk/lib/_internal/pub/lib/src/version.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/system_cache.dart
diff --git a/sdk/lib/_internal/pub/lib/src/system_cache.dart b/sdk/lib/_internal/pub/lib/src/system_cache.dart
index bfc6cea5b8d81d387f22201cb5d6e99e803a4c5e..4e011dd8f2047c8a9cc86733aee02724125f7230 100644
--- a/sdk/lib/_internal/pub/lib/src/system_cache.dart
+++ b/sdk/lib/_internal/pub/lib/src/system_cache.dart
@@ -66,6 +66,17 @@ class SystemCache {
sources.register(source);
}
+ /// Determines if the system cache contains the package identified by [id].
+ Future<bool> contains(PackageId id) {
+ var source = sources[id.source];
+
+ if (!source.shouldCache) {
+ throw new ArgumentError("Package $id is not cacheable.");
+ }
+
+ return source.isInSystemCache(id);
+ }
+
/// Ensures that the package identified by [id] is downloaded to the cache,
/// loads it, and returns it.
///
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/source.dart ('k') | sdk/lib/_internal/pub/lib/src/version.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698