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

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

Issue 10540151: First pass at version constraint solver. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Request all versions from the source, and not just the best. Created 8 years, 6 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/pubspec.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('package'); 5 #library('package');
6 6
7 #import('io.dart'); 7 #import('io.dart');
8 #import('pubspec.dart'); 8 #import('pubspec.dart');
9 #import('source.dart'); 9 #import('source.dart');
10 #import('source_registry.dart'); 10 #import('source_registry.dart');
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 */ 55 */
56 final Pubspec pubspec; 56 final Pubspec pubspec;
57 57
58 /** 58 /**
59 * The ids of the packages that this package depends on. This is what is 59 * The ids of the packages that this package depends on. This is what is
60 * specified in the pubspec when this package depends on another. 60 * specified in the pubspec when this package depends on another.
61 */ 61 */
62 Collection<PackageRef> get dependencies() => pubspec.dependencies; 62 Collection<PackageRef> get dependencies() => pubspec.dependencies;
63 63
64 /** 64 /**
65 * Constructs a package with the given name and pubspec. The package will
66 * no directory associated with it.
67 */
68 Package.inMemory(this.name, this.pubspec)
69 : dir = null;
70
71 /**
65 * Constructs a package. This should not be called directly. Instead, acquire 72 * Constructs a package. This should not be called directly. Instead, acquire
66 * packages from [load()]. 73 * packages from [load()].
67 */ 74 */
68 Package._(String dir, this.pubspec) 75 Package._(String dir, this.pubspec)
69 : dir = dir, 76 : dir = dir,
70 name = basename(dir); 77 name = basename(dir);
71 78
72 /** 79 /**
73 * Returns a debug string for the package. 80 * Returns a debug string for the package.
74 */ 81 */
75 String toString() => '$name ($dir)'; 82 String toString() => '$name $version ($dir)';
76 } 83 }
77 84
78 /** 85 /**
79 * An unambiguous resolved reference to a package. A package ID contains enough 86 * An unambiguous resolved reference to a package. A package ID contains enough
80 * information to correctly install the package. 87 * information to correctly install the package.
81 * 88 *
82 * Note that it's possible for multiple distinct package IDs to point to 89 * Note that it's possible for multiple distinct package IDs to point to
83 * different directories that happen to contain identical packages. For example, 90 * different directories that happen to contain identical packages. For example,
84 * the same package may be available from multiple sources. As far as Pub is 91 * the same package may be available from multiple sources. As far as Pub is
85 * concerned, those packages are different. 92 * concerned, those packages are different.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 final String name; 159 final String name;
153 160
154 /** 161 /**
155 * The [Source] used to look up the package. 162 * The [Source] used to look up the package.
156 */ 163 */
157 final Source source; 164 final Source source;
158 165
159 /** 166 /**
160 * The allowed package versions. 167 * The allowed package versions.
161 */ 168 */
162 final VersionConstraint version; 169 final VersionConstraint constraint;
163 170
164 /** 171 /**
165 * The metadata used to identify the package being referenced. The 172 * The metadata used to identify the package being referenced. The
166 * interpretation of this will vary based on the [source]. 173 * interpretation of this will vary based on the [source].
167 */ 174 */
168 final description; 175 final description;
169 176
170 PackageRef(this.name, this.source, this.version, this.description); 177 PackageRef(this.name, this.source, this.constraint, this.description);
171 178
172 String toString() => "$name $version from $source ($description)"; 179 String toString() => "$name $constraint from $source ($description)";
173 } 180 }
OLDNEW
« 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