| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 * When a [Pubspec] or [LockFile] is parsed, it reads in the description for | 147 * When a [Pubspec] or [LockFile] is parsed, it reads in the description for |
| 148 * each dependency. It is up to the dependency's [Source] to determine how | 148 * each dependency. It is up to the dependency's [Source] to determine how |
| 149 * that should be interpreted. This will be called during parsing to validate | 149 * that should be interpreted. This will be called during parsing to validate |
| 150 * that the given [description] is well-formed according to this source. It | 150 * that the given [description] is well-formed according to this source. It |
| 151 * should return if the description is valid, or throw a [FormatException] if | 151 * should return if the description is valid, or throw a [FormatException] if |
| 152 * not. | 152 * not. |
| 153 * | 153 * |
| 154 * [fromLockFile] is true when the description comes from a [LockFile], to | 154 * [fromLockFile] is true when the description comes from a [LockFile], to |
| 155 * allow the source to use lockfile-specific descriptions via [resolveId]. | 155 * allow the source to use lockfile-specific descriptions via [resolveId]. |
| 156 */ | 156 */ |
| 157 void validateDescription(description, [bool fromLockFile=false]) {} | 157 void validateDescription(description, {bool fromLockFile: false}) {} |
| 158 | 158 |
| 159 /** | 159 /** |
| 160 * Returns whether or not [description1] describes the same package as | 160 * Returns whether or not [description1] describes the same package as |
| 161 * [description2] for this source. This method should be light-weight. It | 161 * [description2] for this source. This method should be light-weight. It |
| 162 * doesn't need to validate that either package exists. | 162 * doesn't need to validate that either package exists. |
| 163 * | 163 * |
| 164 * By default, this assumes both descriptions are strings and compares them | 164 * By default, this assumes both descriptions are strings and compares them |
| 165 * for equality. | 165 * for equality. |
| 166 */ | 166 */ |
| 167 bool descriptionsEqual(description1, description2) => | 167 bool descriptionsEqual(description1, description2) => |
| (...skipping 15 matching lines...) Expand all Loading... |
| 183 * | 183 * |
| 184 * The returned [PackageId] may have a description field that's invalid | 184 * The returned [PackageId] may have a description field that's invalid |
| 185 * according to [validateDescription], although it must still be serializable | 185 * according to [validateDescription], although it must still be serializable |
| 186 * to JSON and YAML. It must also be equal to [id] according to | 186 * to JSON and YAML. It must also be equal to [id] according to |
| 187 * [descriptionsEqual]. | 187 * [descriptionsEqual]. |
| 188 * | 188 * |
| 189 * By default, this just returns [id]. | 189 * By default, this just returns [id]. |
| 190 */ | 190 */ |
| 191 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); | 191 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); |
| 192 } | 192 } |
| OLD | NEW |