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

Unified Diff: utils/pub/lock_file.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/io.dart ('k') | utils/pub/path_source.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/lock_file.dart
diff --git a/utils/pub/lock_file.dart b/utils/pub/lock_file.dart
index 23e709993e18d1bb8499f3ba5844b6364f9e214e..594e523d357641cf24a96418e556f147e427e909 100644
--- a/utils/pub/lock_file.dart
+++ b/utils/pub/lock_file.dart
@@ -5,6 +5,7 @@
library lock_file;
import 'dart:json' as json;
+import 'io.dart';
import 'package.dart';
import 'source_registry.dart';
import 'utils.dart';
@@ -21,8 +22,19 @@ class LockFile {
LockFile.empty()
: packages = <String, PackageId>{};
- /// Parses the lockfile whose text is [contents].
+ /// Loads a lockfile from [filePath].
+ factory LockFile.load(String filePath, SourceRegistry sources) {
+ return LockFile._parse(filePath, readTextFile(filePath), sources);
+ }
+
+ /// Parses a lockfile whose text is [contents].
factory LockFile.parse(String contents, SourceRegistry sources) {
+ return LockFile._parse(null, contents, sources);
+ }
+
+ /// Parses the lockfile whose text is [contents].
+ static LockFile _parse(String filePath, String contents,
+ SourceRegistry sources) {
var packages = <String, PackageId>{};
if (contents.trim() == '') return new LockFile.empty();
@@ -54,7 +66,8 @@ class LockFile {
throw new FormatException('Package $name is missing a description.');
}
var description = spec['description'];
- source.validateDescription(description, fromLockFile: true);
+ description = source.parseDescription(filePath, description,
+ fromLockFile: true);
var id = new PackageId(name, source, version, description);
« no previous file with comments | « utils/pub/io.dart ('k') | utils/pub/path_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698