| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 packages, overrides, pubspecs, _getAvailableVersions(packages), | 182 packages, overrides, pubspecs, _getAvailableVersions(packages), |
| 183 _attemptedSolutions); | 183 _attemptedSolutions); |
| 184 } on SolveFailure catch (error) { | 184 } on SolveFailure catch (error) { |
| 185 // Wrap a failure in a result so we can attach some other data. | 185 // Wrap a failure in a result so we can attach some other data. |
| 186 return new SolveResult.failure(systemCache.sources, root, lockFile, | 186 return new SolveResult.failure(systemCache.sources, root, lockFile, |
| 187 overrides, error, _attemptedSolutions); | 187 overrides, error, _attemptedSolutions); |
| 188 } finally { | 188 } finally { |
| 189 // Gather some solving metrics. | 189 // Gather some solving metrics. |
| 190 var buffer = new StringBuffer(); | 190 var buffer = new StringBuffer(); |
| 191 buffer.writeln('${runtimeType} took ${stopwatch.elapsed} seconds.'); | 191 buffer.writeln('${runtimeType} took ${stopwatch.elapsed} seconds.'); |
| 192 buffer.writeln('- Tried $_attemptedSolutions solutions'); |
| 192 buffer.writeln(cache.describeResults()); | 193 buffer.writeln(cache.describeResults()); |
| 193 log.solver(buffer); | 194 log.solver(buffer); |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 | 197 |
| 197 /// Generates a map containing all of the known available versions for each | 198 /// Generates a map containing all of the known available versions for each |
| 198 /// package in [packages]. | 199 /// package in [packages]. |
| 199 /// | 200 /// |
| 200 /// The version list may not always be complete. If the package is the root | 201 /// The version list may not always be complete. If the package is the root |
| 201 /// root package, or if it's a package that we didn't unlock while solving | 202 /// root package, or if it's a package that we didn't unlock while solving |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 void _validateSdkConstraint(Pubspec pubspec) { | 648 void _validateSdkConstraint(Pubspec pubspec) { |
| 648 if (_overrides.containsKey(pubspec.name)) return; | 649 if (_overrides.containsKey(pubspec.name)) return; |
| 649 if (pubspec.environment.sdkVersion.allows(sdk.version)) return; | 650 if (pubspec.environment.sdkVersion.allows(sdk.version)) return; |
| 650 | 651 |
| 651 throw new BadSdkVersionException(pubspec.name, | 652 throw new BadSdkVersionException(pubspec.name, |
| 652 'Package ${pubspec.name} requires SDK version ' | 653 'Package ${pubspec.name} requires SDK version ' |
| 653 '${pubspec.environment.sdkVersion} but the current SDK is ' | 654 '${pubspec.environment.sdkVersion} but the current SDK is ' |
| 654 '${sdk.version}.'); | 655 '${sdk.version}.'); |
| 655 } | 656 } |
| 656 } | 657 } |
| OLD | NEW |