| 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 /** | 5 /** |
| 6 * Attempts to resolve a set of version constraints for a package dependency | 6 * Attempts to resolve a set of version constraints for a package dependency |
| 7 * graph and select an appropriate set of best specific versions for all | 7 * graph and select an appropriate set of best specific versions for all |
| 8 * dependent packages. It works iteratively and tries to reach a stable | 8 * dependent packages. It works iteratively and tries to reach a stable |
| 9 * solution where the constraints of all dependencies are met. If it fails to | 9 * solution where the constraints of all dependencies are met. If it fails to |
| 10 * reach a solution after a certain number of iterations, it assumes the | 10 * reach a solution after a certain number of iterations, it assumes the |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // use that. This allows e.g. Git to ensure that the same commit is used. | 212 // use that. This allows e.g. Git to ensure that the same commit is used. |
| 213 var lockedPackage = lockFile.packages[dep.name]; | 213 var lockedPackage = lockFile.packages[dep.name]; |
| 214 if (lockedPackage != null && lockedPackage.version == dep.version && | 214 if (lockedPackage != null && lockedPackage.version == dep.version && |
| 215 lockedPackage.source.name == dep.source.name && | 215 lockedPackage.source.name == dep.source.name && |
| 216 dep.source.descriptionsEqual( | 216 dep.source.descriptionsEqual( |
| 217 description, lockedPackage.description)) { | 217 description, lockedPackage.description)) { |
| 218 description = lockedPackage.description; | 218 description = lockedPackage.description; |
| 219 } | 219 } |
| 220 | 220 |
| 221 return new PackageId(dep.name, dep.source, dep.version, description); | 221 return new PackageId(dep.name, dep.source, dep.version, description); |
| 222 }); | 222 }) |
| 223 .toList(); |
| 223 } | 224 } |
| 224 } | 225 } |
| 225 | 226 |
| 226 /** | 227 /** |
| 227 * The constraint solver works by iteratively processing a queue of work items. | 228 * The constraint solver works by iteratively processing a queue of work items. |
| 228 * Each item is a single atomic change to the dependency graph. Handling them | 229 * Each item is a single atomic change to the dependency graph. Handling them |
| 229 * in a queue lets us handle asynchrony (resolving versions requires information | 230 * in a queue lets us handle asynchrony (resolving versions requires information |
| 230 * from servers) as well as avoid deeply nested recursion. | 231 * from servers) as well as avoid deeply nested recursion. |
| 231 */ | 232 */ |
| 232 abstract class WorkItem { | 233 abstract class WorkItem { |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 final description1; | 726 final description1; |
| 726 final description2; | 727 final description2; |
| 727 | 728 |
| 728 DescriptionMismatchException(this.package, this.description1, | 729 DescriptionMismatchException(this.package, this.description1, |
| 729 this.description2); | 730 this.description2); |
| 730 | 731 |
| 731 // TODO(nweiz): Dump to YAML when that's supported | 732 // TODO(nweiz): Dump to YAML when that's supported |
| 732 String toString() => "Package '$package' has conflicting descriptions " | 733 String toString() => "Package '$package' has conflicting descriptions " |
| 733 "'${json.stringify(description1)}' and '${json.stringify(description2)}'"; | 734 "'${json.stringify(description1)}' and '${json.stringify(description2)}'"; |
| 734 } | 735 } |
| OLD | NEW |