| 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 /// Attempts to resolve a set of version constraints for a package dependency | 5 /// Attempts to resolve a set of version constraints for a package dependency |
| 6 /// graph and select an appropriate set of best specific versions for all | 6 /// graph and select an appropriate set of best specific versions for all |
| 7 /// dependent packages. It works iteratively and tries to reach a stable | 7 /// dependent packages. It works iteratively and tries to reach a stable |
| 8 /// solution where the constraints of all dependencies are met. If it fails to | 8 /// solution where the constraints of all dependencies are met. If it fails to |
| 9 /// reach a solution after a certain number of iterations, it assumes the | 9 /// reach a solution after a certain number of iterations, it assumes the |
| 10 /// dependency graph is unstable and reports and error. | 10 /// dependency graph is unstable and reports and error. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 Future process(VersionSolver solver) { | 248 Future process(VersionSolver solver) { |
| 249 log.fine("Changing $package to version $version."); | 249 log.fine("Changing $package to version $version."); |
| 250 | 250 |
| 251 var dependency = solver.getDependency(package); | 251 var dependency = solver.getDependency(package); |
| 252 var oldVersion = dependency.version; | 252 var oldVersion = dependency.version; |
| 253 solver.setVersion(package, version); | 253 solver.setVersion(package, version); |
| 254 | 254 |
| 255 // The dependencies between the old and new version may be different. Walk | 255 // The dependencies between the old and new version may be different. Walk |
| 256 // them both and update any constraints that differ between the two. | 256 // them both and update any constraints that differ between the two. |
| 257 return Futures.wait([ | 257 return Future.wait([ |
| 258 getDependencyRefs(solver, oldVersion), | 258 getDependencyRefs(solver, oldVersion), |
| 259 getDependencyRefs(solver, version)]).then((list) { | 259 getDependencyRefs(solver, version)]).then((list) { |
| 260 var oldDependencyRefs = list[0]; | 260 var oldDependencyRefs = list[0]; |
| 261 var newDependencyRefs = list[1]; | 261 var newDependencyRefs = list[1]; |
| 262 | 262 |
| 263 for (var oldRef in oldDependencyRefs.values) { | 263 for (var oldRef in oldDependencyRefs.values) { |
| 264 if (newDependencyRefs.containsKey(oldRef.name)) { | 264 if (newDependencyRefs.containsKey(oldRef.name)) { |
| 265 // The dependency is in both versions of this package, but its | 265 // The dependency is in both versions of this package, but its |
| 266 // constraint may have changed. | 266 // constraint may have changed. |
| 267 var newRef = newDependencyRefs.remove(oldRef.name); | 267 var newRef = newDependencyRefs.remove(oldRef.name); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 700 |
| 701 String toString() { | 701 String toString() { |
| 702 // TODO(nweiz): Dump descriptions to YAML when that's supported. | 702 // TODO(nweiz): Dump descriptions to YAML when that's supported. |
| 703 return "Incompatible dependencies on '$package':\n" | 703 return "Incompatible dependencies on '$package':\n" |
| 704 "- '$depender1' depends on it with description " | 704 "- '$depender1' depends on it with description " |
| 705 "${json.stringify(description1)}\n" | 705 "${json.stringify(description1)}\n" |
| 706 "- '$depender2' depends on it with description " | 706 "- '$depender2' depends on it with description " |
| 707 "${json.stringify(description2)}"; | 707 "${json.stringify(description2)}"; |
| 708 } | 708 } |
| 709 } | 709 } |
| OLD | NEW |