| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 * Attempts to select the best concrete versions for all of the transitive | 52 * Attempts to select the best concrete versions for all of the transitive |
| 53 * dependencies of [root] taking into account all of the [VersionConstraint]s | 53 * dependencies of [root] taking into account all of the [VersionConstraint]s |
| 54 * that those dependencies place on each other and the requirements imposed by | 54 * that those dependencies place on each other and the requirements imposed by |
| 55 * [lockFile]. If successful, completes to a [Map] that maps package names to | 55 * [lockFile]. If successful, completes to a [Map] that maps package names to |
| 56 * the selected version for that package. If it fails, the future will complete | 56 * the selected version for that package. If it fails, the future will complete |
| 57 * with a [NoVersionException], [DisjointConstraintException], or | 57 * with a [NoVersionException], [DisjointConstraintException], or |
| 58 * [CouldNotSolveException]. | 58 * [CouldNotSolveException]. |
| 59 */ | 59 */ |
| 60 Future<List<PackageId>> resolveVersions(SourceRegistry sources, Package root, | 60 Future<List<PackageId>> resolveVersions(SourceRegistry sources, Package root, |
| 61 LockFile lockFile) { | 61 LockFile lockFile) { |
| 62 print('Resolving dependencies...'); |
| 62 return new VersionSolver(sources, root, lockFile).solve(); | 63 return new VersionSolver(sources, root, lockFile).solve(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 class VersionSolver { | 66 class VersionSolver { |
| 66 final SourceRegistry _sources; | 67 final SourceRegistry _sources; |
| 67 final Package _root; | 68 final Package _root; |
| 68 final LockFile lockFile; | 69 final LockFile lockFile; |
| 69 final PubspecCache _pubspecs; | 70 final PubspecCache _pubspecs; |
| 70 final Map<String, Dependency> _packages; | 71 final Map<String, Dependency> _packages; |
| 71 final Queue<WorkItem> _work; | 72 final Queue<WorkItem> _work; |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 final description1; | 724 final description1; |
| 724 final description2; | 725 final description2; |
| 725 | 726 |
| 726 DescriptionMismatchException(this.package, this.description1, | 727 DescriptionMismatchException(this.package, this.description1, |
| 727 this.description2); | 728 this.description2); |
| 728 | 729 |
| 729 // TODO(nweiz): Dump to YAML when that's supported | 730 // TODO(nweiz): Dump to YAML when that's supported |
| 730 String toString() => "Package '$package' has conflicting descriptions " | 731 String toString() => "Package '$package' has conflicting descriptions " |
| 731 "'${JSON.stringify(description1)}' and '${JSON.stringify(description2)}'"; | 732 "'${JSON.stringify(description1)}' and '${JSON.stringify(description2)}'"; |
| 732 } | 733 } |
| OLD | NEW |