Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: utils/pub/version_solver.dart

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Undo change to test-script. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/version.dart ('k') | utils/tests/archive/reader_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// Attempts to resolve a set of version constraints for a package dependency 5 /// Attempts to resolve a set of version constraints for a package dependency
6 /// graph and select an appropriate set of best specific versions for all 6 /// graph and select an appropriate set of best specific versions for all
7 /// dependent packages. It works iteratively and tries to reach a stable 7 /// dependent packages. It works iteratively and tries to reach a stable
8 /// solution where the constraints of all dependencies are met. If it fails to 8 /// solution where the constraints of all dependencies are met. If it fails to
9 /// reach a solution after a certain number of iterations, it assumes the 9 /// reach a solution after a certain number of iterations, it assumes the
10 /// dependency graph is unstable and reports and error. 10 /// dependency graph is unstable and reports and error.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 for (var dependerName in dependency.dependers) { 183 for (var dependerName in dependency.dependers) {
184 var depender = getDependency(dependerName); 184 var depender = getDependency(dependerName);
185 var locked = lockFile.packages[dependerName]; 185 var locked = lockFile.packages[dependerName];
186 if (locked != null && depender.version == locked.version) { 186 if (locked != null && depender.version == locked.version) {
187 enqueue(new UnlockPackage(depender)); 187 enqueue(new UnlockPackage(depender));
188 return true; 188 return true;
189 } 189 }
190 } 190 }
191 191
192 return dependency.dependers.mappedBy(getDependency).any((subdependency) => 192 return dependency.dependers.map(getDependency).any((subdependency) =>
193 tryUnlockDepender(subdependency, seen)); 193 tryUnlockDepender(subdependency, seen));
194 } 194 }
195 195
196 List<PackageId> buildResults() { 196 List<PackageId> buildResults() {
197 return _packages.values.where((dep) => dep.isDependedOn).mappedBy((dep) { 197 return _packages.values.where((dep) => dep.isDependedOn).map((dep) {
198 var description = dep.description; 198 var description = dep.description;
199 199
200 // If the lockfile contains a fully-resolved description for the package, 200 // If the lockfile contains a fully-resolved description for the package,
201 // use that. This allows e.g. Git to ensure that the same commit is used. 201 // use that. This allows e.g. Git to ensure that the same commit is used.
202 var lockedPackage = lockFile.packages[dep.name]; 202 var lockedPackage = lockFile.packages[dep.name];
203 if (lockedPackage != null && lockedPackage.version == dep.version && 203 if (lockedPackage != null && lockedPackage.version == dep.version &&
204 lockedPackage.source.name == dep.source.name && 204 lockedPackage.source.name == dep.source.name &&
205 dep.source.descriptionsEqual( 205 dep.source.descriptionsEqual(
206 description, lockedPackage.description)) { 206 description, lockedPackage.description)) {
207 description = lockedPackage.description; 207 description = lockedPackage.description;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 500
501 /// The names of all the packages that depend on this dependency. 501 /// The names of all the packages that depend on this dependency.
502 Iterable<String> get dependers => _refs.keys; 502 Iterable<String> get dependers => _refs.keys;
503 503
504 /// Gets the overall constraint that all packages are placing on this one. 504 /// Gets the overall constraint that all packages are placing on this one.
505 /// If no packages have a constraint on this one (which can happen when this 505 /// If no packages have a constraint on this one (which can happen when this
506 /// package is in the process of being added to the graph), returns `null`. 506 /// package is in the process of being added to the graph), returns `null`.
507 VersionConstraint get constraint { 507 VersionConstraint get constraint {
508 if (_refs.isEmpty) return null; 508 if (_refs.isEmpty) return null;
509 return new VersionConstraint.intersection( 509 return new VersionConstraint.intersection(
510 _refs.values.mappedBy((ref) => ref.constraint)); 510 _refs.values.map((ref) => ref.constraint));
511 } 511 }
512 512
513 /// The source of this dependency's package. 513 /// The source of this dependency's package.
514 Source get source { 514 Source get source {
515 var canonical = _canonicalRef(); 515 var canonical = _canonicalRef();
516 if (canonical == null) return null; 516 if (canonical == null) return null;
517 return canonical.source; 517 return canonical.source;
518 } 518 }
519 519
520 /// The description of this dependency's package. 520 /// The description of this dependency's package.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 697
698 String toString() { 698 String toString() {
699 // TODO(nweiz): Dump descriptions to YAML when that's supported. 699 // TODO(nweiz): Dump descriptions to YAML when that's supported.
700 return "Incompatible dependencies on '$package':\n" 700 return "Incompatible dependencies on '$package':\n"
701 "- '$depender1' depends on it with description " 701 "- '$depender1' depends on it with description "
702 "${json.stringify(description1)}\n" 702 "${json.stringify(description1)}\n"
703 "- '$depender2' depends on it with description " 703 "- '$depender2' depends on it with description "
704 "${json.stringify(description2)}"; 704 "${json.stringify(description2)}";
705 } 705 }
706 } 706 }
OLDNEW
« no previous file with comments | « utils/pub/version.dart ('k') | utils/tests/archive/reader_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698