| 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 library pub.solver.version_solver; | 5 library pub.solver.version_solver; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import "dart:convert"; | 8 import "dart:convert"; |
| 9 | 9 |
| 10 import 'package:pub_semver/pub_semver.dart'; | 10 import 'package:pub_semver/pub_semver.dart'; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 var ids; | 189 var ids; |
| 190 try { | 190 try { |
| 191 ids = await source.getVersions(package); | 191 ids = await source.getVersions(package); |
| 192 } catch (error, stackTrace) { | 192 } catch (error, stackTrace) { |
| 193 // If an error occurs, cache that too. We only want to do one request | 193 // If an error occurs, cache that too. We only want to do one request |
| 194 // for any given package, successful or not. | 194 // for any given package, successful or not. |
| 195 var chain = new Chain.forTrace(stackTrace); | 195 var chain = new Chain.forTrace(stackTrace); |
| 196 log.solver("Could not get versions for $package:\n$error\n\n" + | 196 log.solver("Could not get versions for $package:\n$error\n\n" + |
| 197 chain.terse.toString()); | 197 chain.terse.toString()); |
| 198 _versionErrors[package] = new Pair(error, chain); | 198 _versionErrors[package] = new Pair(error, chain); |
| 199 throw error; | 199 rethrow; |
| 200 } | 200 } |
| 201 | 201 |
| 202 // Sort by priority so we try preferred versions first. | 202 // Sort by priority so we try preferred versions first. |
| 203 ids.sort((id1, id2) { | 203 ids.sort((id1, id2) { |
| 204 // Reverse the IDs because we want the newest version at the front of the | 204 // Reverse the IDs because we want the newest version at the front of the |
| 205 // list. | 205 // list. |
| 206 return _type == SolveType.DOWNGRADE | 206 return _type == SolveType.DOWNGRADE |
| 207 ? Version.antiprioritize(id2.version, id1.version) | 207 ? Version.antiprioritize(id2.version, id1.version) |
| 208 : Version.prioritize(id2.version, id1.version); | 208 : Version.prioritize(id2.version, id1.version); |
| 209 }); | 209 }); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 426 |
| 427 DependencyNotFoundException(String package, this._innerException, | 427 DependencyNotFoundException(String package, this._innerException, |
| 428 Iterable<Dependency> dependencies) | 428 Iterable<Dependency> dependencies) |
| 429 : super(package, dependencies); | 429 : super(package, dependencies); |
| 430 | 430 |
| 431 /// The failure isn't because of the version of description of the package, | 431 /// The failure isn't because of the version of description of the package, |
| 432 /// it's the package itself that can't be found, so just show the name and no | 432 /// it's the package itself that can't be found, so just show the name and no |
| 433 /// descriptive details. | 433 /// descriptive details. |
| 434 String _describeDependency(PackageDep dep) => ""; | 434 String _describeDependency(PackageDep dep) => ""; |
| 435 } | 435 } |
| OLD | NEW |