| 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('package'); | 5 #library('package'); |
| 6 | 6 |
| 7 #import('io.dart'); | 7 #import('io.dart'); |
| 8 #import('pubspec.dart'); | 8 #import('pubspec.dart'); |
| 9 #import('source.dart'); | 9 #import('source.dart'); |
| 10 #import('source_registry.dart'); | 10 #import('source_registry.dart'); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 var nameComp = name.compareTo(other.name); | 143 var nameComp = name.compareTo(other.name); |
| 144 if (nameComp != 0) return nameComp; | 144 if (nameComp != 0) return nameComp; |
| 145 | 145 |
| 146 return version.compareTo(other.version); | 146 return version.compareTo(other.version); |
| 147 } | 147 } |
| 148 | 148 |
| 149 /** | 149 /** |
| 150 * Returns the pubspec for this package. | 150 * Returns the pubspec for this package. |
| 151 */ | 151 */ |
| 152 Future<Pubspec> describe() => source.describe(this); | 152 Future<Pubspec> describe() => source.describe(this); |
| 153 | |
| 154 /** | |
| 155 * Returns a future that completes to the resovled [PackageId] for this id. | |
| 156 */ | |
| 157 Future<PackageId> get resolved() => source.resolveId(this); | |
| 158 } | 153 } |
| 159 | 154 |
| 160 /** | 155 /** |
| 161 * A reference to a package. Unlike a [PackageId], a PackageRef may not | 156 * A reference to a package. Unlike a [PackageId], a PackageRef may not |
| 162 * unambiguously refer to a single package. It may describe a range of allowed | 157 * unambiguously refer to a single package. It may describe a range of allowed |
| 163 * packages. | 158 * packages. |
| 164 */ | 159 */ |
| 165 class PackageRef { | 160 class PackageRef { |
| 166 /** | 161 /** |
| 167 * The [Source] used to look up the package. | 162 * The [Source] used to look up the package. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 188 | 183 |
| 189 String toString() => "$name $constraint from $source ($description)"; | 184 String toString() => "$name $constraint from $source ($description)"; |
| 190 | 185 |
| 191 /** | 186 /** |
| 192 * Returns a [PackageId] generated from this [PackageRef] with the given | 187 * Returns a [PackageId] generated from this [PackageRef] with the given |
| 193 * concrete version. | 188 * concrete version. |
| 194 */ | 189 */ |
| 195 PackageId atVersion(Version version) => | 190 PackageId atVersion(Version version) => |
| 196 new PackageId(source, version, description); | 191 new PackageId(source, version, description); |
| 197 } | 192 } |
| OLD | NEW |