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

Side by Side Diff: utils/pub/system_cache.dart

Issue 12208138: Take Sam Elkhateeb's path for "path" dependencies and clean it up some. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/path_source.dart ('k') | utils/pub/validator/dependency.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library system_cache; 5 library system_cache;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:async'; 8 import 'dart:async';
9 9
10 import 'git_source.dart'; 10 import 'git_source.dart';
11 import 'hosted_source.dart'; 11 import 'hosted_source.dart';
12 import 'io.dart'; 12 import 'io.dart';
13 import 'io.dart' as io show createTempDir; 13 import 'io.dart' as io show createTempDir;
14 import 'log.dart' as log; 14 import 'log.dart' as log;
15 import 'package.dart'; 15 import 'package.dart';
16 import 'path_source.dart';
16 import 'pubspec.dart'; 17 import 'pubspec.dart';
17 import 'sdk_source.dart'; 18 import 'sdk_source.dart';
18 import 'source.dart'; 19 import 'source.dart';
19 import 'source_registry.dart'; 20 import 'source_registry.dart';
20 import 'utils.dart'; 21 import 'utils.dart';
21 import 'version.dart'; 22 import 'version.dart';
22 23
23 /// The system-wide cache of installed packages. 24 /// The system-wide cache of installed packages.
24 /// 25 ///
25 /// This cache contains all packages that are downloaded from the internet. 26 /// This cache contains all packages that are downloaded from the internet.
(...skipping 13 matching lines...) Expand all
39 40
40 /// Creates a new package cache which is backed by the given directory on the 41 /// Creates a new package cache which is backed by the given directory on the
41 /// user's file system. 42 /// user's file system.
42 SystemCache(this.rootDir) 43 SystemCache(this.rootDir)
43 : _pendingInstalls = new Map<PackageId, Future<Package>>(), 44 : _pendingInstalls = new Map<PackageId, Future<Package>>(),
44 sources = new SourceRegistry(); 45 sources = new SourceRegistry();
45 46
46 /// Creates a system cache and registers the standard set of sources. 47 /// Creates a system cache and registers the standard set of sources.
47 factory SystemCache.withSources(String rootDir) { 48 factory SystemCache.withSources(String rootDir) {
48 var cache = new SystemCache(rootDir); 49 var cache = new SystemCache(rootDir);
49 cache.register(new SdkSource());
50 cache.register(new GitSource()); 50 cache.register(new GitSource());
51 cache.register(new HostedSource()); 51 cache.register(new HostedSource());
52 cache.register(new PathSource());
53 cache.register(new SdkSource());
52 cache.sources.setDefault('hosted'); 54 cache.sources.setDefault('hosted');
53 return cache; 55 return cache;
54 } 56 }
55 57
56 /// Registers a new source. This source must not have the same name as a 58 /// Registers a new source. This source must not have the same name as a
57 /// source that's already been registered. 59 /// source that's already been registered.
58 void register(Source source) { 60 void register(Source source) {
59 source.bind(this); 61 source.bind(this);
60 sources.register(source); 62 sources.register(source);
61 } 63 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 110
109 /// Delete's the system cache's internal temp directory. 111 /// Delete's the system cache's internal temp directory.
110 Future deleteTempDir() { 112 Future deleteTempDir() {
111 log.fine('Clean up system cache temp directory $tempDir.'); 113 log.fine('Clean up system cache temp directory $tempDir.');
112 return defer(() { 114 return defer(() {
113 if (!dirExists(tempDir)) return; 115 if (!dirExists(tempDir)) return;
114 return deleteDir(tempDir); 116 return deleteDir(tempDir);
115 }); 117 });
116 } 118 }
117 } 119 }
OLDNEW
« no previous file with comments | « utils/pub/path_source.dart ('k') | utils/pub/validator/dependency.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698