| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library('lock_file'); | 5 #library('lock_file'); |
| 6 | 6 |
| 7 #import('dart:json'); | 7 #import('dart:json'); |
| 8 #import('package.dart'); | 8 #import('package.dart'); |
| 9 #import('source_registry.dart'); | 9 #import('source_registry.dart'); |
| 10 #import('utils.dart'); | 10 #import('utils.dart'); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 var source = sources[sourceName]; | 57 var source = sources[sourceName]; |
| 58 | 58 |
| 59 // Parse the description. | 59 // Parse the description. |
| 60 if (!spec.containsKey('description')) { | 60 if (!spec.containsKey('description')) { |
| 61 throw new FormatException('Package $name is missing a description.'); | 61 throw new FormatException('Package $name is missing a description.'); |
| 62 } | 62 } |
| 63 var description = spec['description']; | 63 var description = spec['description']; |
| 64 source.validateDescription(description, fromLockFile: true); | 64 source.validateDescription(description, fromLockFile: true); |
| 65 | 65 |
| 66 var id = new PackageId(source, version, description); | 66 var id = new PackageId(name, source, version, description); |
| 67 | 67 |
| 68 // Validate the name. | 68 // Validate the name. |
| 69 if (name != id.name) { | 69 if (name != id.name) { |
| 70 throw new FormatException( | 70 throw new FormatException( |
| 71 "Package name $name doesn't match ${id.name}."); | 71 "Package name $name doesn't match ${id.name}."); |
| 72 } | 72 } |
| 73 | 73 |
| 74 packages[name] = id; | 74 packages[name] = id; |
| 75 }); | 75 }); |
| 76 } | 76 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 89 'source': id.source.name, | 89 'source': id.source.name, |
| 90 'description': id.description | 90 'description': id.description |
| 91 }; | 91 }; |
| 92 }); | 92 }); |
| 93 | 93 |
| 94 // TODO(nweiz): Serialize using the YAML library once it supports | 94 // TODO(nweiz): Serialize using the YAML library once it supports |
| 95 // serialization. For now, we use JSON, since it's a subset of YAML anyway. | 95 // serialization. For now, we use JSON, since it's a subset of YAML anyway. |
| 96 return JSON.stringify({'packages': packagesObj}); | 96 return JSON.stringify({'packages': packagesObj}); |
| 97 } | 97 } |
| 98 } | 98 } |
| OLD | NEW |