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

Unified Diff: sdk/lib/_internal/pub/lib/src/lock_file.dart

Issue 15347004: Gracefully handle pubspecs with dependencies using unknown sources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests for unknown sources in lockfiles. Created 7 years, 7 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 | « sdk/lib/_internal/pub/lib/src/hosted_source.dart ('k') | sdk/lib/_internal/pub/lib/src/package.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/lock_file.dart
diff --git a/sdk/lib/_internal/pub/lib/src/lock_file.dart b/sdk/lib/_internal/pub/lib/src/lock_file.dart
index 1e85a4d0e37f080c2bae62b9d59ccccc66dc06f1..316e8b58803b9b72e6421b8804c8ac146849b79e 100644
--- a/sdk/lib/_internal/pub/lib/src/lock_file.dart
+++ b/sdk/lib/_internal/pub/lib/src/lock_file.dart
@@ -58,21 +58,20 @@ class LockFile {
throw new FormatException('Package $name is missing a source.');
}
var sourceName = spec['source'];
- if (!sources.contains(sourceName)) {
- throw new FormatException(
- 'Could not find a source named $sourceName.');
- }
- var source = sources[sourceName];
- // Parse the description.
if (!spec.containsKey('description')) {
throw new FormatException('Package $name is missing a description.');
}
var description = spec['description'];
- description = source.parseDescription(filePath, description,
- fromLockFile: true);
- var id = new PackageId(name, source, version, description);
+ // Parse the description if we know the source.
+ if (sources.contains(sourceName)) {
+ var source = sources[sourceName];
+ description = source.parseDescription(filePath, description,
+ fromLockFile: true);
+ }
+
+ var id = new PackageId(name, sourceName, version, description);
// Validate the name.
if (name != id.name) {
@@ -97,7 +96,7 @@ class LockFile {
sortedKeys.forEach((name) {
packagesObj[name] = {
'version': packages[name].version.toString(),
- 'source': packages[name].source.name,
+ 'source': packages[name].source,
'description': packages[name].description
};
});
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/hosted_source.dart ('k') | sdk/lib/_internal/pub/lib/src/package.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698