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

Unified Diff: utils/pub/package.dart

Issue 10690032: Make VersionSolver source- and description-aware. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/git_source.dart ('k') | utils/pub/pubspec.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/package.dart
diff --git a/utils/pub/package.dart b/utils/pub/package.dart
index 1449b9e8921e944d656f312b075e28c3a1ac33aa..46345ed92891f1efd5b2a84e1c3d8e3bb1b52eef 100644
--- a/utils/pub/package.dart
+++ b/utils/pub/package.dart
@@ -116,7 +116,7 @@ class PackageId implements Comparable, Hashable {
* The name of the package being identified. This will be the human-friendly
* name like "uilib".
*/
- String get name() => source.packageName(this);
+ String get name() => source.packageName(description);
int hashCode() => name.hashCode() ^
source.name.hashCode() ^
@@ -145,6 +145,11 @@ class PackageId implements Comparable, Hashable {
return version.compareTo(other.version);
}
+
+ /**
+ * Returns the pubspec for this package.
+ */
+ Future<Pubspec> describe() => source.describe(this);
}
/**
@@ -154,11 +159,6 @@ class PackageId implements Comparable, Hashable {
*/
class PackageRef {
/**
- * The name of the package being referenced.
- */
- final String name;
-
- /**
* The [Source] used to look up the package.
*/
final Source source;
@@ -174,7 +174,19 @@ class PackageRef {
*/
final description;
- PackageRef(this.name, this.source, this.constraint, this.description);
+ /**
+ * The name of the package being referenced.
+ */
+ String get name() => source.packageName(description);
+
+ PackageRef(this.source, this.constraint, this.description);
String toString() => "$name $constraint from $source ($description)";
+
+ /**
+ * Returns a [PackageId] generated from this [PackageRef] with the given
+ * concrete version.
+ */
+ PackageId atVersion(Version version) =>
+ new PackageId(source, version, description);
}
« no previous file with comments | « utils/pub/git_source.dart ('k') | utils/pub/pubspec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698