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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 solver.enqueue(new AddConstraint(package, newRef)); | 276 solver.enqueue(new AddConstraint(package, newRef)); |
277 } | 277 } |
278 }); | 278 }); |
279 } | 279 } |
280 | 280 |
281 /// Get the dependencies at [version] of the package being changed. | 281 /// Get the dependencies at [version] of the package being changed. |
282 Future<Map<String, PackageRef>> getDependencyRefs(VersionSolver solver, | 282 Future<Map<String, PackageRef>> getDependencyRefs(VersionSolver solver, |
283 Version version) { | 283 Version version) { |
284 // If there is no version, it means no package, so no dependencies. | 284 // If there is no version, it means no package, so no dependencies. |
285 if (version == null) { | 285 if (version == null) { |
286 return | 286 return new Future<Map<String, PackageRef>>.immediate( |
287 new Future<Map<String, PackageRef>>.immediate(<String, PackageRef>{}); | 287 <String, PackageRef>{}); |
288 } | 288 } |
289 | 289 |
290 var id = new PackageId(package, source, version, description); | 290 var id = new PackageId(package, source, version, description); |
291 return solver._pubspecs.load(id).then((pubspec) { | 291 return solver._pubspecs.load(id).then((pubspec) { |
292 var dependencies = <String, PackageRef>{}; | 292 var dependencies = <String, PackageRef>{}; |
293 for (var dependency in pubspec.dependencies) { | 293 for (var dependency in pubspec.dependencies) { |
294 dependencies[dependency.name] = dependency; | 294 dependencies[dependency.name] = dependency; |
295 } | 295 } |
| 296 |
| 297 // Include dev dependencies only from the root package. |
| 298 if (id.isRoot) { |
| 299 for (var dependency in pubspec.devDependencies) { |
| 300 dependencies[dependency.name] = dependency; |
| 301 } |
| 302 } |
| 303 |
296 return dependencies; | 304 return dependencies; |
297 }); | 305 }); |
298 } | 306 } |
299 } | 307 } |
300 | 308 |
301 /// A constraint that a depending package places on a dependent package has | 309 /// A constraint that a depending package places on a dependent package has |
302 /// changed. | 310 /// changed. |
303 /// | 311 /// |
304 /// This is an abstract class that contains logic for updating the dependency | 312 /// This is an abstract class that contains logic for updating the dependency |
305 /// graph once a dependency has changed. Changing the dependency is the | 313 /// graph once a dependency has changed. Changing the dependency is the |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 705 |
698 String toString() { | 706 String toString() { |
699 // TODO(nweiz): Dump descriptions to YAML when that's supported. | 707 // TODO(nweiz): Dump descriptions to YAML when that's supported. |
700 return "Incompatible dependencies on '$package':\n" | 708 return "Incompatible dependencies on '$package':\n" |
701 "- '$depender1' depends on it with description " | 709 "- '$depender1' depends on it with description " |
702 "${json.stringify(description1)}\n" | 710 "${json.stringify(description1)}\n" |
703 "- '$depender2' depends on it with description " | 711 "- '$depender2' depends on it with description " |
704 "${json.stringify(description2)}"; | 712 "${json.stringify(description2)}"; |
705 } | 713 } |
706 } | 714 } |
OLD | NEW |