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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 }); | 213 }); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 /** | 217 /** |
218 * The constraint solver works by iteratively processing a queue of work items. | 218 * The constraint solver works by iteratively processing a queue of work items. |
219 * Each item is a single atomic change to the dependency graph. Handling them | 219 * Each item is a single atomic change to the dependency graph. Handling them |
220 * in a queue lets us handle asynchrony (resolving versions requires information | 220 * in a queue lets us handle asynchrony (resolving versions requires information |
221 * from servers) as well as avoid deeply nested recursion. | 221 * from servers) as well as avoid deeply nested recursion. |
222 */ | 222 */ |
223 interface WorkItem { | 223 abstract class WorkItem { |
224 /** | 224 /** |
225 * Processes this work item. Returns a future that completes when the work is | 225 * Processes this work item. Returns a future that completes when the work is |
226 * done. If `null` is returned, that means the work has completed | 226 * done. If `null` is returned, that means the work has completed |
227 * synchronously and the next item can be started immediately. | 227 * synchronously and the next item can be started immediately. |
228 */ | 228 */ |
229 Future process(VersionSolver solver); | 229 Future process(VersionSolver solver); |
230 } | 230 } |
231 | 231 |
232 /** | 232 /** |
233 * The best selected version for a package has changed to [version]. If the | 233 * The best selected version for a package has changed to [version]. If the |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 final description1; | 700 final description1; |
701 final description2; | 701 final description2; |
702 | 702 |
703 DescriptionMismatchException(this.package, this.description1, | 703 DescriptionMismatchException(this.package, this.description1, |
704 this.description2); | 704 this.description2); |
705 | 705 |
706 // TODO(nweiz): Dump to YAML when that's supported | 706 // TODO(nweiz): Dump to YAML when that's supported |
707 String toString() => "Package '$package' has conflicting descriptions " | 707 String toString() => "Package '$package' has conflicting descriptions " |
708 "'${JSON.stringify(description1)}' and '${JSON.stringify(description2)}'"; | 708 "'${JSON.stringify(description1)}' and '${JSON.stringify(description2)}'"; |
709 } | 709 } |
OLD | NEW |