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 /// A back-tracking depth-first solver. | 5 /// A back-tracking depth-first solver. |
6 /// | 6 /// |
7 /// Attempts to find the best solution for a root package's transitive | 7 /// Attempts to find the best solution for a root package's transitive |
8 /// dependency graph, where a "solution" is a set of concrete package versions. | 8 /// dependency graph, where a "solution" is a set of concrete package versions. |
9 /// A valid solution will select concrete versions for every package reached | 9 /// A valid solution will select concrete versions for every package reached |
10 /// from the root package's dependency graph, and each of those packages will | 10 /// from the root package's dependency graph, and each of those packages will |
(...skipping 20 matching lines...) Expand all Loading... |
31 /// recent speculative version choice and try the next one. That becomes the | 31 /// recent speculative version choice and try the next one. That becomes the |
32 /// new in-progress solution and it tries to proceed from there. It will keep | 32 /// new in-progress solution and it tries to proceed from there. It will keep |
33 /// doing this, traversing and then backtracking when it meets a failure until | 33 /// doing this, traversing and then backtracking when it meets a failure until |
34 /// a valid solution has been found or until all possible options for all | 34 /// a valid solution has been found or until all possible options for all |
35 /// speculative choices have been exhausted. | 35 /// speculative choices have been exhausted. |
36 library pub.solver.backtracking_solver; | 36 library pub.solver.backtracking_solver; |
37 | 37 |
38 import 'dart:async'; | 38 import 'dart:async'; |
39 import 'dart:collection' show Queue; | 39 import 'dart:collection' show Queue; |
40 | 40 |
| 41 import 'package:pub_semver/pub_semver.dart'; |
| 42 |
41 import '../barback.dart' as barback; | 43 import '../barback.dart' as barback; |
42 import '../exceptions.dart'; | 44 import '../exceptions.dart'; |
43 import '../lock_file.dart'; | 45 import '../lock_file.dart'; |
44 import '../log.dart' as log; | 46 import '../log.dart' as log; |
45 import '../package.dart'; | 47 import '../package.dart'; |
46 import '../pubspec.dart'; | 48 import '../pubspec.dart'; |
47 import '../sdk.dart' as sdk; | 49 import '../sdk.dart' as sdk; |
48 import '../source_registry.dart'; | 50 import '../source_registry.dart'; |
49 import '../source/unknown.dart'; | 51 import '../source/unknown.dart'; |
50 import '../utils.dart'; | 52 import '../utils.dart'; |
51 import '../version.dart'; | |
52 import 'dependency_queue.dart'; | 53 import 'dependency_queue.dart'; |
53 import 'version_queue.dart'; | 54 import 'version_queue.dart'; |
54 import 'version_solver.dart'; | 55 import 'version_solver.dart'; |
55 | 56 |
56 /// The top-level solver. | 57 /// The top-level solver. |
57 /// | 58 /// |
58 /// Keeps track of the current potential solution, and the other possible | 59 /// Keeps track of the current potential solution, and the other possible |
59 /// versions for speculative package selections. Backtracks and advances to the | 60 /// versions for speculative package selections. Backtracks and advances to the |
60 /// next potential solution in the case of a failure. | 61 /// next potential solution in the case of a failure. |
61 class BacktrackingSolver { | 62 class BacktrackingSolver { |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 /// | 775 /// |
775 /// Throws a [SolveFailure] if not. | 776 /// Throws a [SolveFailure] if not. |
776 void _validateSdkConstraint(Pubspec pubspec) { | 777 void _validateSdkConstraint(Pubspec pubspec) { |
777 if (pubspec.environment.sdkVersion.allows(sdk.version)) return; | 778 if (pubspec.environment.sdkVersion.allows(sdk.version)) return; |
778 | 779 |
779 throw new BadSdkVersionException(pubspec.name, | 780 throw new BadSdkVersionException(pubspec.name, |
780 'Package ${pubspec.name} requires SDK version ' | 781 'Package ${pubspec.name} requires SDK version ' |
781 '${pubspec.environment.sdkVersion} but the current SDK is ' | 782 '${pubspec.environment.sdkVersion} but the current SDK is ' |
782 '${sdk.version}.'); | 783 '${sdk.version}.'); |
783 } | 784 } |
OLD | NEW |