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 import 'dart:async'; | 5 import 'dart:async'; |
6 import "dart:convert"; | 6 import "dart:convert"; |
7 | 7 |
8 import 'package:pub_semver/pub_semver.dart'; | 8 import 'package:pub_semver/pub_semver.dart'; |
9 import 'package:stack_trace/stack_trace.dart'; | 9 import 'package:stack_trace/stack_trace.dart'; |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 /// | 72 /// |
73 /// In other words, one more than the number of times it had to backtrack | 73 /// In other words, one more than the number of times it had to backtrack |
74 /// because it found an invalid solution. | 74 /// because it found an invalid solution. |
75 final int attemptedSolutions; | 75 final int attemptedSolutions; |
76 | 76 |
77 /// The [LockFile] representing the packages selected by this version | 77 /// The [LockFile] representing the packages selected by this version |
78 /// resolution. | 78 /// resolution. |
79 LockFile get lockFile { | 79 LockFile get lockFile { |
80 // Don't factor in overridden dependencies' SDK constraints, because we'll | 80 // Don't factor in overridden dependencies' SDK constraints, because we'll |
81 // accept those packages even if their constraints don't match. | 81 // accept those packages even if their constraints don't match. |
82 var sdkConstraint = new VersionConstraint.intersection(pubspecs.values | 82 var nonOverrides = pubspecs.values |
83 .where((pubspec) => | 83 .where((pubspec) => |
84 !_root.dependencyOverrides.any((dep) => dep.name == pubspec.name)) | 84 !_root.dependencyOverrides.any((dep) => dep.name == pubspec.name)) |
85 .map((pubspec) => pubspec.environment.sdkVersion)); | 85 .toList(); |
86 return new LockFile(packages, sdkConstraint: sdkConstraint); | 86 |
| 87 var dartMerged = new VersionConstraint.intersection(nonOverrides |
| 88 .map((pubspec) => pubspec.dartSdkConstraint)); |
| 89 |
| 90 var flutterConstraints = nonOverrides |
| 91 .map((pubspec) => pubspec.flutterSdkConstraint) |
| 92 .where((constraint) => constraint != null) |
| 93 .toList(); |
| 94 var flutterMerged = flutterConstraints.isEmpty |
| 95 ? null |
| 96 : new VersionConstraint.intersection(flutterConstraints); |
| 97 |
| 98 return new LockFile(packages, |
| 99 dartSdkConstraint: dartMerged, |
| 100 flutterSdkConstraint: flutterMerged); |
87 } | 101 } |
88 | 102 |
89 final SourceRegistry _sources; | 103 final SourceRegistry _sources; |
90 final Package _root; | 104 final Package _root; |
91 final LockFile _previousLockFile; | 105 final LockFile _previousLockFile; |
92 | 106 |
93 /// Returns the names of all packages that were changed. | 107 /// Returns the names of all packages that were changed. |
94 /// | 108 /// |
95 /// This includes packages that were added or removed. | 109 /// This includes packages that were added or removed. |
96 Set<String> get changedPackages { | 110 Set<String> get changedPackages { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 450 |
437 DependencyNotFoundException(String package, this._innerException, | 451 DependencyNotFoundException(String package, this._innerException, |
438 Iterable<Dependency> dependencies) | 452 Iterable<Dependency> dependencies) |
439 : super(package, dependencies); | 453 : super(package, dependencies); |
440 | 454 |
441 /// The failure isn't because of the version of description of the package, | 455 /// The failure isn't because of the version of description of the package, |
442 /// it's the package itself that can't be found, so just show the name and no | 456 /// it's the package itself that can't be found, so just show the name and no |
443 /// descriptive details. | 457 /// descriptive details. |
444 String _describeDependency(PackageDep dep) => ""; | 458 String _describeDependency(PackageDep dep) => ""; |
445 } | 459 } |
OLD | NEW |