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

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

Issue 16854005: First pass at build dependency graph for barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
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 63de5dc59899e0acff87082e84ad415d82eebbf1..adca55591e3647c02f3435cb1d0321abedfe55b4 100644
--- a/sdk/lib/_internal/pub/lib/src/system_cache.dart
+++ b/sdk/lib/_internal/pub/lib/src/system_cache.dart
@@ -41,15 +41,25 @@ class SystemCache {
/// Creates a new package cache which is backed by the given directory on the
/// user's file system.
- SystemCache(this.rootDir)
- : _pendingInstalls = new Map<PackageId, Future<Package>>(),
- sources = new SourceRegistry();
+ factory SystemCache() {
+ var cacheDir;
+ if (Platform.environment.containsKey('PUB_CACHE')) {
+ cacheDir = Platform.environment['PUB_CACHE'];
+ } else if (Platform.operatingSystem == 'windows') {
+ var appData = Platform.environment['APPDATA'];
+ cacheDir = path.join(appData, 'Pub', 'Cache');
+ } else {
+ cacheDir = '${Platform.environment['HOME']}/.pub-cache';
+ }
+
+ return new SystemCache._(cacheDir);
+ }
/// Creates a system cache and registers the standard set of sources. If
/// [isOffline] is `true`, then the offline hosted source will be used.
/// Defaults to `false`.
- factory SystemCache.withSources(String rootDir, {bool isOffline: false}) {
- var cache = new SystemCache(rootDir);
+ factory SystemCache.withSources({bool isOffline: false}) {
+ var cache = new SystemCache();
cache.register(new GitSource());
if (isOffline) {
@@ -63,6 +73,10 @@ class SystemCache {
return cache;
}
+ SystemCache._(this.rootDir)
+ : _pendingInstalls = new Map<PackageId, Future<Package>>(),
+ sources = new SourceRegistry();
+
/// Registers a new source. This source must not have the same name as a
/// source that's already been registered.
void register(Source source) {
« pkg/barback/test/test_all.dart ('K') | « sdk/lib/_internal/pub/lib/src/source.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698