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

Side by Side Diff: utils/pub/entrypoint.dart

Issue 10825375: Reverting 10779 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/pub/version_solver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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('entrypoint'); 5 #library('entrypoint');
6 6
7 #import('io.dart'); 7 #import('io.dart');
8 #import('lock_file.dart'); 8 #import('lock_file.dart');
9 #import('package.dart'); 9 #import('package.dart');
10 #import('root_source.dart'); 10 #import('root_source.dart');
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 * package to its "package" directory, writing a new [LockFile]. Returns a 116 * package to its "package" directory, writing a new [LockFile]. Returns a
117 * [Future] that completes when all dependencies are installed. 117 * [Future] that completes when all dependencies are installed.
118 */ 118 */
119 Future updateAllDependencies() { 119 Future updateAllDependencies() {
120 return resolveVersions(cache.sources, root, new LockFile.empty()). 120 return resolveVersions(cache.sources, root, new LockFile.empty()).
121 chain(_installDependencies); 121 chain(_installDependencies);
122 } 122 }
123 123
124 /** 124 /**
125 * Installs the latest available versions of [dependencies], while leaving 125 * Installs the latest available versions of [dependencies], while leaving
126 * other dependencies as specified by the [LockFile] if possible. Returns a 126 * other dependencies as specified by the [LockFile]. Returns a [Future] that
127 * [Future] that completes when all dependencies are installed. 127 * completes when all dependencies are installed.
128 */ 128 */
129 Future updateDependencies(List<String> dependencies) { 129 Future updateDependencies(List<String> dependencies) {
130 return _loadLockFile().chain((lockFile) { 130 return _loadLockFile().chain((lockFile) {
131 var versionSolver = new VersionSolver(cache.sources, root, lockFile);
132 for (var dependency in dependencies) { 131 for (var dependency in dependencies) {
133 versionSolver.useLatestVersion(dependency); 132 // TODO(nweiz): How do we want to detect and handle unknown
133 // dependencies here?
134 lockFile.packages.remove(dependency);
134 } 135 }
135 return versionSolver.solve(); 136 return resolveVersions(cache.sources, root, lockFile);
136 }).chain(_installDependencies); 137 }).chain(_installDependencies);
137 } 138 }
138 139
139 /** 140 /**
140 * Installs all dependencies listed in [packageVersions] and writes a 141 * Installs all dependencies listed in [packageVersions] and writes a
141 * [LockFile]. 142 * [LockFile].
142 */ 143 */
143 Future _installDependencies(List<PackageId> packageVersions) { 144 Future _installDependencies(List<PackageId> packageVersions) {
144 return Futures.wait(packageVersions.map((id) { 145 return Futures.wait(packageVersions.map((id) {
145 if (id.source is RootSource) return new Future.immediate(id); 146 if (id.source is RootSource) return new Future.immediate(id);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 */ 183 */
183 Future _saveLockFile(List<PackageId> packageIds) { 184 Future _saveLockFile(List<PackageId> packageIds) {
184 var lockFile = new LockFile.empty(); 185 var lockFile = new LockFile.empty();
185 for (var id in packageIds) { 186 for (var id in packageIds) {
186 if (id.source is! RootSource) lockFile.packages[id.name] = id; 187 if (id.source is! RootSource) lockFile.packages[id.name] = id;
187 } 188 }
188 189
189 return writeTextFile(join(root.dir, 'pubspec.lock'), lockFile.serialize()); 190 return writeTextFile(join(root.dir, 'pubspec.lock'), lockFile.serialize());
190 } 191 }
191 } 192 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/version_solver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698