| 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 source; | 5 library source; |
| 6 | 6 |
| 7 import 'io.dart'; | 7 import 'io.dart'; |
| 8 import 'package.dart'; | 8 import 'package.dart'; |
| 9 import 'pubspec.dart'; | 9 import 'pubspec.dart'; |
| 10 import 'system_cache.dart'; | 10 import 'system_cache.dart'; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 * [fromLockFile] is true when the description comes from a [LockFile], to | 157 * [fromLockFile] is true when the description comes from a [LockFile], to |
| 158 * allow the source to use lockfile-specific descriptions via [resolveId]. | 158 * allow the source to use lockfile-specific descriptions via [resolveId]. |
| 159 */ | 159 */ |
| 160 void validateDescription(description, {bool fromLockFile: false}) {} | 160 void validateDescription(description, {bool fromLockFile: false}) {} |
| 161 | 161 |
| 162 /** | 162 /** |
| 163 * Returns whether or not [description1] describes the same package as | 163 * Returns whether or not [description1] describes the same package as |
| 164 * [description2] for this source. This method should be light-weight. It | 164 * [description2] for this source. This method should be light-weight. It |
| 165 * doesn't need to validate that either package exists. | 165 * doesn't need to validate that either package exists. |
| 166 * | 166 * |
| 167 * By default, this assumes both descriptions are strings and compares them | 167 * By default, just uses regular equality. |
| 168 * for equality. | |
| 169 */ | 168 */ |
| 170 bool descriptionsEqual(description1, description2) => | 169 bool descriptionsEqual(description1, description2) => |
| 171 description1 == description2; | 170 description1 == description2; |
| 172 | 171 |
| 173 /** | 172 /** |
| 174 * For some sources, [PackageId]s can point to different chunks of code at | 173 * For some sources, [PackageId]s can point to different chunks of code at |
| 175 * different times. This takes such an [id] and returns a future that | 174 * different times. This takes such an [id] and returns a future that |
| 176 * completes to a [PackageId] that will uniquely specify a single chunk of | 175 * completes to a [PackageId] that will uniquely specify a single chunk of |
| 177 * code forever. | 176 * code forever. |
| 178 * | 177 * |
| (...skipping 10 matching lines...) Expand all Loading... |
| 189 * to JSON and YAML. It must also be equal to [id] according to | 188 * to JSON and YAML. It must also be equal to [id] according to |
| 190 * [descriptionsEqual]. | 189 * [descriptionsEqual]. |
| 191 * | 190 * |
| 192 * By default, this just returns [id]. | 191 * By default, this just returns [id]. |
| 193 */ | 192 */ |
| 194 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); | 193 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); |
| 195 | 194 |
| 196 /// Returns the source's name. | 195 /// Returns the source's name. |
| 197 String toString() => name; | 196 String toString() => name; |
| 198 } | 197 } |
| OLD | NEW |