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

Unified Diff: utils/pub/entrypoint.dart

Issue 10704172: Hook in the version solver to pub install. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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/pubspec.dart » ('j') | no next file with comments »
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 deb4afa168fe455185a9a36df9ae0f1a5ace13f5..e33b9f91d7cc6e224a33086ffa47d6aed526e623 100644
--- a/utils/pub/entrypoint.dart
+++ b/utils/pub/entrypoint.dart
@@ -6,8 +6,10 @@
#import('io.dart');
#import('package.dart');
+#import('root_source.dart');
#import('system_cache.dart');
#import('version.dart');
+#import('version_solver.dart');
#import('utils.dart');
/**
@@ -112,34 +114,12 @@ class Entrypoint {
* installed.
*/
Future installDependencies() {
- var seen = new Set<PackageId>();
-
- Future helper(List<PackageRef> packages) {
- return Futures.wait(packages.map((ref) {
- return resolve(ref).chain((id) {
- if (seen.contains(id)) return new Future.immediate(null);
- seen.add(id);
-
- return install(id).chain((package) {
- return helper(package.dependencies);
- });
- });
+ return resolveVersions(cache.sources, root).chain((packageVersions) {
+ // TODO(nweiz): persist packageVersions to a lockfile.
+ return Futures.wait(packageVersions.map((id) {
+ if (id.source is RootSource) return new Future.immediate(null);
+ return install(id);
}));
- }
-
- return helper(root.dependencies);
- }
-
- /**
- * Given [ref], which ambiguously identifies a dependent package, selects an
- * appropriate precise package to use when this is the entrypoint. In other
- * words, given a loose refence like "foo >= 2.0", figures out what concrete
- * package we should use starting from this entrypoint.
- */
- Future<PackageId> resolve(PackageRef ref) {
- // TODO(rnystrom): This should use the lockfile to select the right version
- // once that's implemented. If the lockfile doesn't exist, it should
- // generate it. In the meantime, here's a dumb implementation:
- return new Future.immediate(ref.atVersion(ref.constraint));
+ });
}
}
« no previous file with comments | « no previous file | utils/pub/pubspec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698