OLD | NEW |
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 pub.source; | 5 library pub.source; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
10 | 10 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 /// It should return if a (possibly modified) valid description, or throw a | 220 /// It should return if a (possibly modified) valid description, or throw a |
221 /// [FormatException] if not valid. | 221 /// [FormatException] if not valid. |
222 /// | 222 /// |
223 /// [fromLockFile] is true when the description comes from a [LockFile], to | 223 /// [fromLockFile] is true when the description comes from a [LockFile], to |
224 /// allow the source to use lockfile-specific descriptions via [resolveId]. | 224 /// allow the source to use lockfile-specific descriptions via [resolveId]. |
225 dynamic parseDescription(String containingPath, description, | 225 dynamic parseDescription(String containingPath, description, |
226 {bool fromLockFile: false}) { | 226 {bool fromLockFile: false}) { |
227 return description; | 227 return description; |
228 } | 228 } |
229 | 229 |
| 230 /// When a [LockFile] is serialized, it uses this method to get the |
| 231 /// [description] in the right format. [containingPath] references the |
| 232 /// containing directory of the root package. |
| 233 dynamic serializeDescription(String containingPath, description) { |
| 234 return description; |
| 235 } |
| 236 |
230 /// Returns whether or not [description1] describes the same package as | 237 /// Returns whether or not [description1] describes the same package as |
231 /// [description2] for this source. This method should be light-weight. It | 238 /// [description2] for this source. This method should be light-weight. It |
232 /// doesn't need to validate that either package exists. | 239 /// doesn't need to validate that either package exists. |
233 /// | 240 /// |
234 /// By default, just uses regular equality. | 241 /// By default, just uses regular equality. |
235 bool descriptionsEqual(description1, description2) => | 242 bool descriptionsEqual(description1, description2) => |
236 description1 == description2; | 243 description1 == description2; |
237 | 244 |
238 /// For some sources, [PackageId]s can point to different chunks of code at | 245 /// For some sources, [PackageId]s can point to different chunks of code at |
239 /// different times. This takes such an [id] and returns a future that | 246 /// different times. This takes such an [id] and returns a future that |
(...skipping 18 matching lines...) Expand all Loading... |
258 /// Returns the [Package]s that have been downloaded to the system cache. | 265 /// Returns the [Package]s that have been downloaded to the system cache. |
259 List<Package> getCachedPackages() { | 266 List<Package> getCachedPackages() { |
260 if (shouldCache) { | 267 if (shouldCache) { |
261 throw new UnimplementedError("Source $name must implement this."); | 268 throw new UnimplementedError("Source $name must implement this."); |
262 } | 269 } |
263 } | 270 } |
264 | 271 |
265 /// Returns the source's name. | 272 /// Returns the source's name. |
266 String toString() => name; | 273 String toString() => name; |
267 } | 274 } |
OLD | NEW |