| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (parsedPubspec.containsKey('dependencies')) { | 53 if (parsedPubspec.containsKey('dependencies')) { |
| 54 var dependencyEntries = parsedPubspec['dependencies']; | 54 var dependencyEntries = parsedPubspec['dependencies']; |
| 55 if (dependencyEntries is! Map || | 55 if (dependencyEntries is! Map || |
| 56 dependencyEntries.getKeys().some((e) => e is! String)) { | 56 dependencyEntries.getKeys().some((e) => e is! String)) { |
| 57 throw new FormatException( | 57 throw new FormatException( |
| 58 'The pubspec dependencies must be a map of package names.'); | 58 'The pubspec dependencies must be a map of package names.'); |
| 59 } | 59 } |
| 60 | 60 |
| 61 dependencyEntries.forEach((name, spec) { | 61 dependencyEntries.forEach((name, spec) { |
| 62 var description, source; | 62 var description, source; |
| 63 // TODO(nweiz): The correct default for versionConstraint is new | 63 var versionConstraint = new VersionRange(); |
| 64 // VersionRange(), but that won't work until the version solver is | |
| 65 // hooked in. | |
| 66 var versionConstraint = Version.none; | |
| 67 if (spec == null) { | 64 if (spec == null) { |
| 68 description = name; | 65 description = name; |
| 69 source = sources.defaultSource; | 66 source = sources.defaultSource; |
| 70 } else if (spec is String) { | 67 } else if (spec is String) { |
| 71 description = name; | 68 description = name; |
| 72 source = sources.defaultSource; | 69 source = sources.defaultSource; |
| 73 versionConstraint = new VersionConstraint.parse(spec); | 70 versionConstraint = new VersionConstraint.parse(spec); |
| 74 } else if (spec is Map) { | 71 } else if (spec is Map) { |
| 75 if (spec.containsKey('version')) { | 72 if (spec.containsKey('version')) { |
| 76 versionConstraint = new VersionConstraint.parse( | 73 versionConstraint = new VersionConstraint.parse( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 99 source.validateDescription(description); | 96 source.validateDescription(description); |
| 100 | 97 |
| 101 dependencies.add(new PackageRef( | 98 dependencies.add(new PackageRef( |
| 102 source, versionConstraint, description)); | 99 source, versionConstraint, description)); |
| 103 }); | 100 }); |
| 104 } | 101 } |
| 105 | 102 |
| 106 return new Pubspec(version, dependencies); | 103 return new Pubspec(version, dependencies); |
| 107 } | 104 } |
| 108 } | 105 } |
| OLD | NEW |