Chromium Code Reviews| 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('package'); | 5 #library('package'); |
| 6 | 6 |
| 7 #import('io.dart'); | 7 #import('io.dart'); |
| 8 #import('pubspec.dart'); | 8 #import('pubspec.dart'); |
| 9 #import('source.dart'); | 9 #import('source.dart'); |
| 10 #import('source_registry.dart'); | 10 #import('source_registry.dart'); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 * The parsed pubspec associated with this package. | 54 * The parsed pubspec associated with this package. |
| 55 */ | 55 */ |
| 56 final Pubspec pubspec; | 56 final Pubspec pubspec; |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * The ids of the packages that this package depends on. This is what is | 59 * The ids of the packages that this package depends on. This is what is |
| 60 * specified in the pubspec when this package depends on another. | 60 * specified in the pubspec when this package depends on another. |
| 61 */ | 61 */ |
| 62 Collection<PackageRef> get dependencies() => pubspec.dependencies; | 62 Collection<PackageRef> get dependencies() => pubspec.dependencies; |
| 63 | 63 |
| 64 // TODO(rnystrom): This is so far only used for mock packages in tests. Is | |
| 65 // it worth keeping this around? | |
|
nweiz
2012/06/18 18:29:19
Seems fine to me.
Bob Nystrom
2012/06/20 01:40:04
Done.
| |
| 66 /** | |
| 67 * Constructs a package with the given name and pubspec. The package will | |
| 68 * no directory associated with it. | |
| 69 */ | |
| 70 Package.inMemory(this.name, this.pubspec) | |
| 71 : dir = null; | |
| 72 | |
| 64 /** | 73 /** |
| 65 * Constructs a package. This should not be called directly. Instead, acquire | 74 * Constructs a package. This should not be called directly. Instead, acquire |
| 66 * packages from [load()]. | 75 * packages from [load()]. |
| 67 */ | 76 */ |
| 68 Package._(String dir, this.pubspec) | 77 Package._(String dir, this.pubspec) |
| 69 : dir = dir, | 78 : dir = dir, |
| 70 name = basename(dir); | 79 name = basename(dir); |
| 71 | 80 |
| 72 /** | 81 /** |
| 73 * Returns a debug string for the package. | 82 * Returns a debug string for the package. |
| 74 */ | 83 */ |
| 75 String toString() => '$name ($dir)'; | 84 String toString() => '$name $version ($dir)'; |
| 76 } | 85 } |
| 77 | 86 |
| 78 /** | 87 /** |
| 79 * An unambiguous resolved reference to a package. A package ID contains enough | 88 * An unambiguous resolved reference to a package. A package ID contains enough |
| 80 * information to correctly install the package. | 89 * information to correctly install the package. |
| 81 * | 90 * |
| 82 * Note that it's possible for multiple distinct package IDs to point to | 91 * Note that it's possible for multiple distinct package IDs to point to |
| 83 * different directories that happen to contain identical packages. For example, | 92 * different directories that happen to contain identical packages. For example, |
| 84 * the same package may be available from multiple sources. As far as Pub is | 93 * the same package may be available from multiple sources. As far as Pub is |
| 85 * concerned, those packages are different. | 94 * concerned, those packages are different. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 /** | 173 /** |
| 165 * The metadata used to identify the package being referenced. The | 174 * The metadata used to identify the package being referenced. The |
| 166 * interpretation of this will vary based on the [source]. | 175 * interpretation of this will vary based on the [source]. |
| 167 */ | 176 */ |
| 168 final description; | 177 final description; |
| 169 | 178 |
| 170 PackageRef(this.name, this.source, this.version, this.description); | 179 PackageRef(this.name, this.source, this.version, this.description); |
| 171 | 180 |
| 172 String toString() => "$name $version from $source ($description)"; | 181 String toString() => "$name $version from $source ($description)"; |
| 173 } | 182 } |
| OLD | NEW |