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

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

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added co19 issue number. Created 7 years, 8 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/pub.dart ('k') | utils/pub/utils.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 source; 5 library source;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:pathos/path.dart' as path; 9 import 'package:pathos/path.dart' as path;
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // If we got here, it's OK. 147 // If we got here, it's OK.
148 return false; 148 return false;
149 } 149 }
150 150
151 /// Returns the directory in the system cache that the package identified by 151 /// Returns the directory in the system cache that the package identified by
152 /// [id] should be installed to. This should return a path to a subdirectory 152 /// [id] should be installed to. This should return a path to a subdirectory
153 /// of [systemCacheRoot]. 153 /// of [systemCacheRoot].
154 /// 154 ///
155 /// This doesn't need to be implemented if [shouldCache] is false. 155 /// This doesn't need to be implemented if [shouldCache] is false.
156 Future<String> systemCacheDirectory(PackageId id) { 156 Future<String> systemCacheDirectory(PackageId id) {
157 return new Future.immediateError( 157 return new Future.error(
158 "systemCacheDirectory() must be implemented if shouldCache is true."); 158 "systemCacheDirectory() must be implemented if shouldCache is true.");
159 } 159 }
160 160
161 /// When a [Pubspec] or [LockFile] is parsed, it reads in the description for 161 /// When a [Pubspec] or [LockFile] is parsed, it reads in the description for
162 /// each dependency. It is up to the dependency's [Source] to determine how 162 /// each dependency. It is up to the dependency's [Source] to determine how
163 /// that should be interpreted. This will be called during parsing to validate 163 /// that should be interpreted. This will be called during parsing to validate
164 /// that the given [description] is well-formed according to this source, and 164 /// that the given [description] is well-formed according to this source, and
165 /// to give the source a chance to canonicalize the description. 165 /// to give the source a chance to canonicalize the description.
166 /// 166 ///
167 /// [containingPath] is the path to the local file (pubspec or lockfile) 167 /// [containingPath] is the path to the local file (pubspec or lockfile)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 /// This will be called after the package identified by [id] is installed, so 199 /// This will be called after the package identified by [id] is installed, so
200 /// the source can use the installed package to determine information about 200 /// the source can use the installed package to determine information about
201 /// the resolved id. 201 /// the resolved id.
202 /// 202 ///
203 /// The returned [PackageId] may have a description field that's invalid 203 /// The returned [PackageId] may have a description field that's invalid
204 /// according to [parseDescription], although it must still be serializable 204 /// according to [parseDescription], although it must still be serializable
205 /// to JSON and YAML. It must also be equal to [id] according to 205 /// to JSON and YAML. It must also be equal to [id] according to
206 /// [descriptionsEqual]. 206 /// [descriptionsEqual].
207 /// 207 ///
208 /// By default, this just returns [id]. 208 /// By default, this just returns [id].
209 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); 209 Future<PackageId> resolveId(PackageId id) => new Future.value(id);
210 210
211 /// Returns the [Package]s that have been installed in the system cache. 211 /// Returns the [Package]s that have been installed in the system cache.
212 List<Package> getCachedPackages() { 212 List<Package> getCachedPackages() {
213 if (shouldCache) throw "Source $name must implement this."; 213 if (shouldCache) throw "Source $name must implement this.";
214 } 214 }
215 215
216 /// Returns the source's name. 216 /// Returns the source's name.
217 String toString() => name; 217 String toString() => name;
218 } 218 }
OLDNEW
« no previous file with comments | « utils/pub/pub.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698