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

Unified Diff: utils/pub/entrypoint.dart

Issue 13095015: Use backtracking when solving dependency constraints. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise, update to latest corelib, and make backtracker default. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utils/pub/log.dart » ('j') | utils/pub/solver/backtracking_solver.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/entrypoint.dart
diff --git a/utils/pub/entrypoint.dart b/utils/pub/entrypoint.dart
index fe058c4d83aba3c8d3ec65abd7fa92979f292ea9..b162859cf49385bab3f929c8ef30496491664a69 100644
--- a/utils/pub/entrypoint.dart
+++ b/utils/pub/entrypoint.dart
@@ -17,7 +17,7 @@ import 'sdk.dart' as sdk;
import 'system_cache.dart';
import 'utils.dart';
import 'version.dart';
-import 'version_solver.dart';
+import 'solver/version_solver.dart';
/// Pub operates over a directed graph of dependencies that starts at a root
/// "entrypoint" package. This is typically the package where the current
@@ -103,7 +103,7 @@ class Entrypoint {
/// completes when all dependencies are installed.
Future installDependencies() {
return new Future.sync(() {
- return resolveVersions(cache.sources, root, loadLockFile());
+ return resolveVersions(cache.sources, root, lockFile: loadLockFile());
}).then(_installDependencies);
}
@@ -111,8 +111,7 @@ class Entrypoint {
/// package to its "package" directory, writing a new [LockFile]. Returns a
/// [Future] that completes when all dependencies are installed.
Future updateAllDependencies() {
- return resolveVersions(cache.sources, root, new LockFile.empty())
- .then(_installDependencies);
+ return resolveVersions(cache.sources, root).then(_installDependencies);
}
/// Installs the latest available versions of [dependencies], while leaving
@@ -120,20 +119,19 @@ class Entrypoint {
/// [Future] that completes when all dependencies are installed.
Future updateDependencies(List<String> dependencies) {
return new Future.sync(() {
- var solver = new VersionSolver(cache.sources, root, loadLockFile());
- for (var dependency in dependencies) {
- solver.useLatestVersion(dependency);
- }
- return solver.solve();
+ return resolveVersions(cache.sources, root,
+ lockFile: loadLockFile(), useLatest: dependencies);
}).then(_installDependencies);
}
/// Removes the old packages directory, installs all dependencies listed in
- /// [packageVersions], and writes a [LockFile].
- Future _installDependencies(List<PackageId> packageVersions) {
+ /// [result], and writes a [LockFile].
+ Future _installDependencies(SolveResult result) {
return new Future.sync(() {
+ if (!result.succeeded) throw result.error;
+
cleanDir(packagesDir);
- return Future.wait(packageVersions.map((id) {
+ return Future.wait(result.packages.map((id) {
if (id.isRoot) return new Future.value(id);
return install(id);
}).toList());
« no previous file with comments | « no previous file | utils/pub/log.dart » ('j') | utils/pub/solver/backtracking_solver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698