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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 deps = deps.map((dep) { | 572 deps = deps.map((dep) { |
573 var override = _overrides[dep.name]; | 573 var override = _overrides[dep.name]; |
574 if (override != null) return override; | 574 if (override != null) return override; |
575 | 575 |
576 // Not overridden. | 576 // Not overridden. |
577 return dep; | 577 return dep; |
578 }).toSet(); | 578 }).toSet(); |
579 } else { | 579 } else { |
580 // Ignore any overridden dependencies. | 580 // Ignore any overridden dependencies. |
581 deps.removeWhere((dep) => _overrides.containsKey(dep.name)); | 581 deps.removeWhere((dep) => _overrides.containsKey(dep.name)); |
| 582 |
| 583 // If an overridden dependency depends on the root package, ignore that |
| 584 // dependency. This ensures that users can work on the next version of one |
| 585 // side of a circular dependency easily. |
| 586 if (_overrides.containsKey(id.name)) { |
| 587 deps.removeWhere((dep) => dep.name == root.name); |
| 588 } |
582 } | 589 } |
583 | 590 |
584 // Make sure the package doesn't have any bad dependencies. | 591 // Make sure the package doesn't have any bad dependencies. |
585 for (var dep in deps.toSet()) { | 592 for (var dep in deps.toSet()) { |
586 if (!dep.isRoot && dep.source is UnknownSource) { | 593 if (!dep.isRoot && dep.source is UnknownSource) { |
587 throw new UnknownSourceException(id.name, [new Dependency(id, dep)]); | 594 throw new UnknownSourceException(id.name, [new Dependency(id, dep)]); |
588 } | 595 } |
589 | 596 |
590 if (dep.name == 'barback') { | 597 if (dep.name == 'barback') { |
591 deps.add(new PackageDep.magic('pub itself')); | 598 deps.add(new PackageDep.magic('pub itself')); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 | 669 |
663 if (!pubspec.flutterSdkConstraint.allows(flutter.version)) { | 670 if (!pubspec.flutterSdkConstraint.allows(flutter.version)) { |
664 throw new BadSdkVersionException(pubspec.name, | 671 throw new BadSdkVersionException(pubspec.name, |
665 'Package ${pubspec.name} requires Flutter SDK version ' | 672 'Package ${pubspec.name} requires Flutter SDK version ' |
666 '${pubspec.flutterSdkConstraint} but the current SDK is ' | 673 '${pubspec.flutterSdkConstraint} but the current SDK is ' |
667 '${flutter.version}.'); | 674 '${flutter.version}.'); |
668 } | 675 } |
669 } | 676 } |
670 } | 677 } |
671 } | 678 } |
OLD | NEW |