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

Unified Diff: utils/pub/pubspec.dart

Issue 12294039: Support relative paths in path dependencies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/path_source.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/pubspec.dart
diff --git a/utils/pub/pubspec.dart b/utils/pub/pubspec.dart
index 779a29490dde802ead5d07764cc71451c645ca62..55b775d06914b453427194d8d392e252221d4047 100644
--- a/utils/pub/pubspec.dart
+++ b/utils/pub/pubspec.dart
@@ -38,7 +38,8 @@ class Pubspec {
if (!fileExists(pubspecPath)) throw new PubspecNotFoundException(name);
try {
- var pubspec = new Pubspec.parse(readTextFile(pubspecPath), sources);
+ var pubspec = new Pubspec.parse(pubspecPath, readTextFile(pubspecPath),
+ sources);
if (pubspec.name == null) {
throw new PubspecHasNoNameException(name);
@@ -69,10 +70,14 @@ class Pubspec {
bool get isEmpty =>
name == null && version == Version.none && dependencies.isEmpty;
- // TODO(rnystrom): Make this a static method to match corelib.
- /// Parses the pubspec whose text is [contents]. If the pubspec doesn't define
- /// version for itself, it defaults to [Version.none].
- factory Pubspec.parse(String contents, SourceRegistry sources) {
+ // TODO(rnystrom): Instead of allowing a null argument here, split this up
+ // into load(), parse(), and _parse() like LockFile does.
+ /// Parses the pubspec stored at [filePath] whose text is [contents]. If the
+ /// pubspec doesn't define version for itself, it defaults to [Version.none].
+ /// [filePath] may be `null` if the pubspec is not on the user's local
+ /// file system.
+ factory Pubspec.parse(String filePath, String contents,
+ SourceRegistry sources) {
var name = null;
var version = Version.none;
@@ -97,7 +102,7 @@ class Pubspec {
version = new Version.parse(parsedPubspec['version']);
}
- var dependencies = _parseDependencies(sources,
+ var dependencies = _parseDependencies(filePath, sources,
parsedPubspec['dependencies']);
var environmentYaml = parsedPubspec['environment'];
@@ -187,7 +192,8 @@ void _validateFieldUrl(url, String field) {
}
}
-List<PackageRef> _parseDependencies(SourceRegistry sources, yaml) {
+List<PackageRef> _parseDependencies(String pubspecPath, SourceRegistry sources,
+ yaml) {
var dependencies = <PackageRef>[];
// Allow an empty dependencies key.
@@ -233,7 +239,8 @@ List<PackageRef> _parseDependencies(SourceRegistry sources, yaml) {
'Dependency specification $spec should be a string or a mapping.');
}
- source.validateDescription(description, fromLockFile: false);
+ description = source.parseDescription(pubspecPath, description,
+ fromLockFile: false);
dependencies.add(new PackageRef(
name, source, versionConstraint, description));
« no previous file with comments | « utils/pub/path_source.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698