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

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

Issue 10690127: Add support to the version solver for sources that only have a single version per package. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/pub/sdk_source.dart » ('j') | utils/tests/pub/version_solver_test.dart » ('J')
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('root_source'); 5 #library('root_source');
6 6
7 #import('package.dart'); 7 #import('package.dart');
8 #import('source.dart'); 8 #import('source.dart');
9 9
10 /** 10 /**
11 * A source used only for the root package when doing version resolution. It 11 * A source used only for the root package when doing version resolution. It
12 * contains only the root package and is unable to install packages. 12 * contains only the root package and is unable to install packages.
13 * 13 *
14 * This source cannot be referenced from a pubspec. 14 * This source cannot be referenced from a pubspec.
15 */ 15 */
16 class RootSource extends Source { 16 class RootSource extends Source {
17 final String name = "root"; 17 final String name = "root";
18 final bool shouldCache = false; 18 final bool shouldCache = false;
19 final Package package; 19 final Package package;
20 20
21 RootSource(this.package); 21 RootSource(this.package);
22 22
23 Future<List<Version>> getVersions(description) {
24 return Future<List<Version>>.immediate([package.version]);
25 }
26
27 Future<Pubspec> describe(PackageId id) { 23 Future<Pubspec> describe(PackageId id) {
28 return Future<Pubspec>.immediate(package.pubspec); 24 return Future<Pubspec>.immediate(package.pubspec);
29 } 25 }
30 26
31 Future<bool> install(PackageId id, String destPath) { 27 Future<bool> install(PackageId id, String destPath) {
32 throw new UnsupportedOperationException( 28 throw new UnsupportedOperationException(
33 "Can't install from a root source."); 29 "Can't install from a root source.");
34 } 30 }
35 } 31 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/sdk_source.dart » ('j') | utils/tests/pub/version_solver_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698