| OLD | NEW |
| 1 library pub.solver.version_solver; | 1 library pub.solver.version_solver; |
| 2 import 'dart:async'; | 2 import 'dart:async'; |
| 3 import "dart:convert"; | 3 import "dart:convert"; |
| 4 import 'package:pub_semver/pub_semver.dart'; |
| 4 import 'package:stack_trace/stack_trace.dart'; | 5 import 'package:stack_trace/stack_trace.dart'; |
| 5 import '../exceptions.dart'; | 6 import '../exceptions.dart'; |
| 6 import '../lock_file.dart'; | 7 import '../lock_file.dart'; |
| 7 import '../log.dart' as log; | 8 import '../log.dart' as log; |
| 8 import '../package.dart'; | 9 import '../package.dart'; |
| 9 import '../pubspec.dart'; | 10 import '../pubspec.dart'; |
| 10 import '../source_registry.dart'; | 11 import '../source_registry.dart'; |
| 11 import '../version.dart'; | |
| 12 import '../utils.dart'; | 12 import '../utils.dart'; |
| 13 import 'backtracking_solver.dart'; | 13 import 'backtracking_solver.dart'; |
| 14 import 'solve_report.dart'; | 14 import 'solve_report.dart'; |
| 15 Future<SolveResult> resolveVersions(SolveType type, SourceRegistry sources, | 15 Future<SolveResult> resolveVersions(SolveType type, SourceRegistry sources, |
| 16 Package root, {LockFile lockFile, List<String> useLatest}) { | 16 Package root, {LockFile lockFile, List<String> useLatest}) { |
| 17 if (lockFile == null) lockFile = new LockFile.empty(); | 17 if (lockFile == null) lockFile = new LockFile.empty(); |
| 18 if (useLatest == null) useLatest = []; | 18 if (useLatest == null) useLatest = []; |
| 19 return log.progress('Resolving dependencies', () { | 19 return log.progress('Resolving dependencies', () { |
| 20 return new BacktrackingSolver( | 20 return new BacktrackingSolver( |
| 21 type, | 21 type, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (error != null) { | 115 if (error != null) { |
| 116 _versionCacheHits++; | 116 _versionCacheHits++; |
| 117 return new Future.error(error.first, error.last); | 117 return new Future.error(error.first, error.last); |
| 118 } | 118 } |
| 119 _versionCacheMisses++; | 119 _versionCacheMisses++; |
| 120 var source = _sources[package.source]; | 120 var source = _sources[package.source]; |
| 121 return source.getVersions( | 121 return source.getVersions( |
| 122 package.name, | 122 package.name, |
| 123 package.description).then((versions) { | 123 package.description).then((versions) { |
| 124 versions.sort( | 124 versions.sort( |
| 125 _type == SolveType.DOWNGRADE ? Version.antiPrioritize : Version.priori
tize); | 125 _type == SolveType.DOWNGRADE ? Version.antiprioritize : Version.priori
tize); |
| 126 var ids = | 126 var ids = |
| 127 versions.reversed.map((version) => package.atVersion(version)).toList(
); | 127 versions.reversed.map((version) => package.atVersion(version)).toList(
); |
| 128 _versions[package] = ids; | 128 _versions[package] = ids; |
| 129 return ids; | 129 return ids; |
| 130 }).catchError((error, trace) { | 130 }).catchError((error, trace) { |
| 131 log.solver("Could not get versions for $package:\n$error\n\n$trace"); | 131 log.solver("Could not get versions for $package:\n$error\n\n$trace"); |
| 132 _versionErrors[package] = new Pair(error, new Chain.forTrace(trace)); | 132 _versionErrors[package] = new Pair(error, new Chain.forTrace(trace)); |
| 133 throw error; | 133 throw error; |
| 134 }); | 134 }); |
| 135 } | 135 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 class DependencyNotFoundException extends SolveFailure { | 262 class DependencyNotFoundException extends SolveFailure { |
| 263 final PackageNotFoundException _innerException; | 263 final PackageNotFoundException _innerException; |
| 264 String get _message => "${_innerException.message}\nDepended on by"; | 264 String get _message => "${_innerException.message}\nDepended on by"; |
| 265 DependencyNotFoundException(String package, this._innerException, | 265 DependencyNotFoundException(String package, this._innerException, |
| 266 Iterable<Dependency> dependencies) | 266 Iterable<Dependency> dependencies) |
| 267 : super(package, dependencies); | 267 : super(package, dependencies); |
| 268 String _describeDependency(PackageDep dep) => ""; | 268 String _describeDependency(PackageDep dep) => ""; |
| 269 } | 269 } |
| OLD | NEW |