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 version_solver; | 5 library version_solver; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:json' as json; | 8 import 'dart:json' as json; |
9 | 9 |
10 import '../lock_file.dart'; | 10 import '../lock_file.dart'; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 /// A message describing the specific kind of solve failure. | 212 /// A message describing the specific kind of solve failure. |
213 String get _message; | 213 String get _message; |
214 | 214 |
215 /// Describes a dependencie's reference in the output message. Override this | 215 /// Describes a dependencie's reference in the output message. Override this |
216 /// to highlight which aspect of [dep] led to the failure. | 216 /// to highlight which aspect of [dep] led to the failure. |
217 String _describeDependency(PackageDep dep) => | 217 String _describeDependency(PackageDep dep) => |
218 "depends on version ${dep.constraint}"; | 218 "depends on version ${dep.constraint}"; |
219 } | 219 } |
220 | 220 |
221 /// Exception thrown when the [VersionSolver] fails to find a solution after a | 221 /// Exception thrown when the current SDK's version does not match a package's |
222 /// certain number of iterations. | 222 /// constraint on it. |
223 class CouldNotSolveException extends SolveFailure { | 223 class BadSdkVersionException extends SolveFailure { |
224 CouldNotSolveException([String message]) | 224 BadSdkVersionException(String package, String message) |
225 : super(null, null), | 225 : super(package, null), |
226 _message = (message != null) ? message : | 226 _message = message; |
227 "Could not find a solution that met all constraints."; | |
228 | 227 |
229 /// A message describing the specific kind of solve failure. | 228 /// A message describing the specific kind of solve failure. |
230 final String _message; | 229 final String _message; |
231 } | 230 } |
232 | 231 |
233 /// Exception thrown when the [VersionConstraint] used to match a package is | 232 /// Exception thrown when the [VersionConstraint] used to match a package is |
234 /// valid (i.e. non-empty), but there are no available versions of the package | 233 /// valid (i.e. non-empty), but there are no available versions of the package |
235 /// that fit that constraint. | 234 /// that fit that constraint. |
236 class NoVersionException extends SolveFailure { | 235 class NoVersionException extends SolveFailure { |
237 final VersionConstraint constraint; | 236 final VersionConstraint constraint; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 Iterable<Dependency> dependencies) | 287 Iterable<Dependency> dependencies) |
289 : super(package, dependencies); | 288 : super(package, dependencies); |
290 | 289 |
291 String get _message => "Incompatible dependencies on '$package'"; | 290 String get _message => "Incompatible dependencies on '$package'"; |
292 | 291 |
293 String _describeDependency(PackageDep dep) { | 292 String _describeDependency(PackageDep dep) { |
294 // TODO(nweiz): Dump descriptions to YAML when that's supported. | 293 // TODO(nweiz): Dump descriptions to YAML when that's supported. |
295 return "depends on it with description ${json.stringify(dep.description)}"; | 294 return "depends on it with description ${json.stringify(dep.description)}"; |
296 } | 295 } |
297 } | 296 } |
OLD | NEW |