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 pub.source; | 5 library pub.source; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:pub_semver/pub_semver.dart'; | 9 import 'package:pub_semver/pub_semver.dart'; |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 /// This method is effectively protected: subclasses must implement it, but | 100 /// This method is effectively protected: subclasses must implement it, but |
101 /// external code should not call this. Instead, call [describe]. | 101 /// external code should not call this. Instead, call [describe]. |
102 Future<Pubspec> doDescribe(PackageId id); | 102 Future<Pubspec> doDescribe(PackageId id); |
103 | 103 |
104 /// Ensures [id] is available locally and creates a symlink at [symlink] | 104 /// Ensures [id] is available locally and creates a symlink at [symlink] |
105 /// pointing it. | 105 /// pointing it. |
106 Future get(PackageId id, String symlink); | 106 Future get(PackageId id, String symlink); |
107 | 107 |
108 /// Returns the directory where this package can (or could) be found locally. | 108 /// Returns the directory where this package can (or could) be found locally. |
109 /// | 109 /// |
110 /// If the source is cached, this will be a path in the system cache. In that | 110 /// If the source is cached, this will be a path in the system cache. |
111 /// case, this will return a directory even if the package has not been | 111 /// Depending on the source, this may throw an [ArgumentError] if [id] isn't |
112 /// installed into the cache yet. | 112 /// resolved using [resolveId]. |
113 Future<String> getDirectory(PackageId id); | 113 String getDirectory(PackageId id); |
114 | 114 |
115 /// Gives the source a chance to interpret and validate the description for | 115 /// Gives the source a chance to interpret and validate the description for |
116 /// a package coming from this source. | 116 /// a package coming from this source. |
117 /// | 117 /// |
118 /// When a [Pubspec] or [LockFile] is parsed, it reads in the description for | 118 /// When a [Pubspec] or [LockFile] is parsed, it reads in the description for |
119 /// each dependency. It is up to the dependency's [Source] to determine how | 119 /// each dependency. It is up to the dependency's [Source] to determine how |
120 /// that should be interpreted. This will be called during parsing to validate | 120 /// that should be interpreted. This will be called during parsing to validate |
121 /// that the given [description] is well-formed according to this source, and | 121 /// that the given [description] is well-formed according to this source, and |
122 /// to give the source a chance to canonicalize the description. | 122 /// to give the source a chance to canonicalize the description. |
123 /// | 123 /// |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 /// package to determine information about the resolved id. | 175 /// package to determine information about the resolved id. |
176 /// | 176 /// |
177 /// The returned [PackageId] may have a description field that's invalid | 177 /// The returned [PackageId] may have a description field that's invalid |
178 /// according to [parseDescription], although it must still be serializable | 178 /// according to [parseDescription], although it must still be serializable |
179 /// to JSON and YAML. It must also be equal to [id] according to | 179 /// to JSON and YAML. It must also be equal to [id] according to |
180 /// [descriptionsEqual]. | 180 /// [descriptionsEqual]. |
181 /// | 181 /// |
182 /// By default, this just returns [id]. | 182 /// By default, this just returns [id]. |
183 Future<PackageId> resolveId(PackageId id) => new Future.value(id); | 183 Future<PackageId> resolveId(PackageId id) => new Future.value(id); |
184 | 184 |
| 185 /// Returns whether [id] is fully-resolved, according to [resolveId]. |
| 186 bool isResolved(PackageId id) => true; |
| 187 |
185 /// Returns the source's name. | 188 /// Returns the source's name. |
186 String toString() => name; | 189 String toString() => name; |
187 } | 190 } |
OLD | NEW |