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

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

Issue 12211061: Handle circular dependencies on the root package when checking SDK constraints. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/system_cache.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 'dart:async'; 7 import 'dart:async';
8 import 'io.dart'; 8 import 'io.dart';
9 import 'lock_file.dart'; 9 import 'lock_file.dart';
10 import 'log.dart' as log; 10 import 'log.dart' as log;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 group.add(new Future.immediate(root.pubspec)); 150 group.add(new Future.immediate(root.pubspec));
151 151
152 visitPackage(Pubspec pubspec) { 152 visitPackage(Pubspec pubspec) {
153 for (var ref in pubspec.dependencies) { 153 for (var ref in pubspec.dependencies) {
154 if (visited.contains(ref.name)) continue; 154 if (visited.contains(ref.name)) continue;
155 155
156 // Look up the concrete version. 156 // Look up the concrete version.
157 var id = lockFile.packages[ref.name]; 157 var id = lockFile.packages[ref.name];
158 158
159 visited.add(ref.name); 159 visited.add(ref.name);
160 var future = cache.describe(id); 160 var future;
161 if (ref.name == root.name) {
162 future = new Future<Pubspec>.immediate(root.pubspec);
163 } else {
164 future = cache.describe(id);
165 }
161 group.add(future.then(visitPackage)); 166 group.add(future.then(visitPackage));
162 } 167 }
163 168
164 return pubspec; 169 return pubspec;
165 } 170 }
166 171
172 visited.add(root.name);
167 visitPackage(root.pubspec); 173 visitPackage(root.pubspec);
168 return group.future; 174 return group.future;
169 }); 175 });
170 } 176 }
171 177
172 /// Validates that the current Dart SDK version matches the SDK constraints 178 /// Validates that the current Dart SDK version matches the SDK constraints
173 /// of every package in the dependency graph. If a package's constraint does 179 /// of every package in the dependency graph. If a package's constraint does
174 /// not match, prints an error. 180 /// not match, prints an error.
175 Future validateSdkConstraints() { 181 Future validateSdkConstraints() {
176 return walkDependencies().then((pubspecs) { 182 return walkDependencies().then((pubspecs) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 290
285 /// Creates a symlink to the `packages` directory in [dir] if none exists. 291 /// Creates a symlink to the `packages` directory in [dir] if none exists.
286 Future _linkSecondaryPackageDir(String dir) { 292 Future _linkSecondaryPackageDir(String dir) {
287 return defer(() { 293 return defer(() {
288 var to = join(dir, 'packages'); 294 var to = join(dir, 'packages');
289 if (entryExists(to)) return; 295 if (entryExists(to)) return;
290 return createSymlink(path, to); 296 return createSymlink(path, to);
291 }); 297 });
292 } 298 }
293 } 299 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698