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('pubspec'); | 5 #library('pubspec'); |
6 | 6 |
7 #import('package.dart'); | 7 #import('package.dart'); |
8 #import('source.dart'); | 8 #import('source.dart'); |
9 #import('source_registry.dart'); | 9 #import('source_registry.dart'); |
10 #import('utils.dart'); | 10 #import('utils.dart'); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 source = sources[sourceName]; | 104 source = sources[sourceName]; |
105 description = spec[sourceName]; | 105 description = spec[sourceName]; |
106 } else { | 106 } else { |
107 throw new FormatException( | 107 throw new FormatException( |
108 'Dependency specification $spec must be a string or a mapping.'); | 108 'Dependency specification $spec must be a string or a mapping.'); |
109 } | 109 } |
110 | 110 |
111 source.validateDescription(description, fromLockFile: false); | 111 source.validateDescription(description, fromLockFile: false); |
112 | 112 |
| 113 var nameFromSource = source.packageName(description); |
| 114 if (nameFromSource != name) { |
| 115 throw new FormatException('The name you specified for your ' |
| 116 'dependency, "$name", doesn\'t match the name "$nameFromSource" ' |
| 117 '(from "$description").'); |
| 118 } |
| 119 |
113 dependencies.add(new PackageRef( | 120 dependencies.add(new PackageRef( |
114 source, versionConstraint, description)); | 121 source, versionConstraint, description)); |
115 }); | 122 }); |
116 } | 123 } |
117 | 124 |
118 return new Pubspec(name, version, dependencies); | 125 return new Pubspec(name, version, dependencies); |
119 } | 126 } |
120 } | 127 } |
OLD | NEW |