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

Unified Diff: utils/pub/package.dart

Issue 10874051: Support self-referential package: imports with Pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review change 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 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 4b52092998d80d44f67440dccea8815cae05c984..24807e723d2209d45ac4dcf9550ed0d986c8ff73 100644
--- a/utils/pub/package.dart
+++ b/utils/pub/package.dart
@@ -43,7 +43,11 @@ class Package {
/**
* The name of the package.
*/
- final String name;
+ String get name() {
+ if (pubspec.name != null) return pubspec.name;
+ if (dir != null) return basename(dir);
+ return null;
+ }
/**
* The package's version.
@@ -62,19 +66,17 @@ class Package {
Collection<PackageRef> get dependencies => pubspec.dependencies;
/**
- * Constructs a package with the given name and pubspec. The package will
- * no directory associated with it.
+ * Constructs a package with the given pubspec. The package will have no
+ * directory associated with it.
*/
- Package.inMemory(this.name, this.pubspec)
+ Package.inMemory(this.pubspec)
: dir = null;
/**
* Constructs a package. This should not be called directly. Instead, acquire
* packages from [load()].
*/
- Package._(String dir, this.pubspec)
- : dir = dir,
- name = basename(dir);
+ Package._(this.dir, this.pubspec);
/**
* Returns a debug string for the package.
« 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