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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 return true; | 497 return true; |
498 }); | 498 }); |
499 | 499 |
500 return _visited.toList(); | 500 return _visited.toList(); |
501 } | 501 } |
502 | 502 |
503 Future<DependencyQueue> _dependencyQueueFor(PackageId id) async { | 503 Future<DependencyQueue> _dependencyQueueFor(PackageId id) async { |
504 var pubspec; | 504 var pubspec; |
505 try { | 505 try { |
506 pubspec = await _solver.cache.getPubspec(id); | 506 pubspec = await _solver.cache.getPubspec(id); |
507 } on PackageNotFoundException catch (error) { | 507 } on PackageNotFoundException { |
508 // We can only get here if the lockfile refers to a specific package | 508 // We can only get here if the lockfile refers to a specific package |
509 // version that doesn't exist (probably because it was yanked). | 509 // version that doesn't exist (probably because it was yanked). |
510 throw new NoVersionException(id.name, null, id.version, []); | 510 throw new NoVersionException(id.name, null, id.version, []); |
511 } | 511 } |
512 | 512 |
513 _validateSdkConstraint(pubspec); | 513 _validateSdkConstraint(pubspec); |
514 | 514 |
515 var deps = pubspec.dependencies.toSet(); | 515 var deps = pubspec.dependencies.toSet(); |
516 | 516 |
517 if (id.isRoot) { | 517 if (id.isRoot) { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 /// | 774 /// |
775 /// Throws a [SolveFailure] if not. | 775 /// Throws a [SolveFailure] if not. |
776 void _validateSdkConstraint(Pubspec pubspec) { | 776 void _validateSdkConstraint(Pubspec pubspec) { |
777 if (pubspec.environment.sdkVersion.allows(sdk.version)) return; | 777 if (pubspec.environment.sdkVersion.allows(sdk.version)) return; |
778 | 778 |
779 throw new BadSdkVersionException(pubspec.name, | 779 throw new BadSdkVersionException(pubspec.name, |
780 'Package ${pubspec.name} requires SDK version ' | 780 'Package ${pubspec.name} requires SDK version ' |
781 '${pubspec.environment.sdkVersion} but the current SDK is ' | 781 '${pubspec.environment.sdkVersion} but the current SDK is ' |
782 '${sdk.version}.'); | 782 '${sdk.version}.'); |
783 } | 783 } |
OLD | NEW |