| 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); |
| 153 } | 158 } |
| 154 | 159 |
| 155 /** | 160 /** |
| 156 * A reference to a package. Unlike a [PackageId], a PackageRef may not | 161 * A reference to a package. Unlike a [PackageId], a PackageRef may not |
| 157 * unambiguously refer to a single package. It may describe a range of allowed | 162 * unambiguously refer to a single package. It may describe a range of allowed |
| 158 * packages. | 163 * packages. |
| 159 */ | 164 */ |
| 160 class PackageRef { | 165 class PackageRef { |
| 161 /** | 166 /** |
| 162 * The [Source] used to look up the package. | 167 * The [Source] used to look up the package. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 183 | 188 |
| 184 String toString() => "$name $constraint from $source ($description)"; | 189 String toString() => "$name $constraint from $source ($description)"; |
| 185 | 190 |
| 186 /** | 191 /** |
| 187 * Returns a [PackageId] generated from this [PackageRef] with the given | 192 * Returns a [PackageId] generated from this [PackageRef] with the given |
| 188 * concrete version. | 193 * concrete version. |
| 189 */ | 194 */ |
| 190 PackageId atVersion(Version version) => | 195 PackageId atVersion(Version version) => |
| 191 new PackageId(source, version, description); | 196 new PackageId(source, version, description); |
| 192 } | 197 } |
| OLD | NEW |