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'; |
11 import '../log.dart' as log; | 11 import '../log.dart' as log; |
12 import '../package.dart'; | 12 import '../package.dart'; |
13 import '../pubspec.dart'; | 13 import '../pubspec.dart'; |
14 import '../source.dart'; | 14 import '../source.dart'; |
15 import '../source_registry.dart'; | 15 import '../source_registry.dart'; |
16 import '../version.dart'; | 16 import '../version.dart'; |
17 import 'backtracking_solver.dart'; | 17 import 'backtracking_solver.dart'; |
18 | 18 |
19 /// Attempts to select the best concrete versions for all of the transitive | 19 /// Attempts to select the best concrete versions for all of the transitive |
20 /// dependencies of [root] taking into account all of the [VersionConstraint]s | 20 /// dependencies of [root] taking into account all of the [VersionConstraint]s |
21 /// that those dependencies place on each other and the requirements imposed by | 21 /// that those dependencies place on each other and the requirements imposed by |
22 /// [lockFile]. | 22 /// [lockFile]. |
23 /// | 23 /// |
24 /// If [useLatest] is given, then only the latest versions of the referenced | 24 /// If [useLatest] is given, then only the latest versions of the referenced |
25 /// packages will be used. This is for forcing an update to one or more | 25 /// packages will be used. This is for forcing an update to one or more |
26 /// packages. | 26 /// packages. |
27 Future<SolveResult> resolveVersions(SourceRegistry sources, Package root, | 27 Future<SolveResult> resolveVersions(SourceRegistry sources, Package root, |
28 {LockFile lockFile, List<PackageRef> useLatest}) { | 28 {LockFile lockFile, List<String> useLatest}) { |
29 log.message('Resolving dependencies...'); | 29 log.message('Resolving dependencies...'); |
30 | 30 |
31 if (lockFile == null) lockFile = new LockFile.empty(); | 31 if (lockFile == null) lockFile = new LockFile.empty(); |
32 if (useLatest == null) useLatest = []; | 32 if (useLatest == null) useLatest = []; |
33 | 33 |
34 return new BacktrackingSolver(sources, root, lockFile, useLatest).solve(); | 34 return new BacktrackingSolver(sources, root, lockFile, useLatest).solve(); |
35 } | 35 } |
36 | 36 |
37 /// The result of a version resolution. | 37 /// The result of a version resolution. |
38 class SolveResult { | 38 class SolveResult { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 Iterable<Dependency> dependencies) | 299 Iterable<Dependency> dependencies) |
300 : super(package, dependencies); | 300 : super(package, dependencies); |
301 | 301 |
302 String get _message => "Incompatible dependencies on '$package'"; | 302 String get _message => "Incompatible dependencies on '$package'"; |
303 | 303 |
304 String _describeDependency(PackageRef ref) { | 304 String _describeDependency(PackageRef ref) { |
305 // TODO(nweiz): Dump descriptions to YAML when that's supported. | 305 // TODO(nweiz): Dump descriptions to YAML when that's supported. |
306 return "depends on it with description ${json.stringify(ref.description)}"; | 306 return "depends on it with description ${json.stringify(ref.description)}"; |
307 } | 307 } |
308 } | 308 } |
OLD | NEW |