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 source; | 5 library source; |
6 | 6 |
7 import 'io.dart'; | 7 import 'io.dart'; |
8 import 'package.dart'; | 8 import 'package.dart'; |
9 import 'pubspec.dart'; | 9 import 'pubspec.dart'; |
10 import 'system_cache.dart'; | 10 import 'system_cache.dart'; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 /** | 138 /** |
139 * Returns the directory in the system cache that the package identified by | 139 * Returns the directory in the system cache that the package identified by |
140 * [id] should be installed to. This should return a path to a subdirectory of | 140 * [id] should be installed to. This should return a path to a subdirectory of |
141 * [systemCacheRoot]. | 141 * [systemCacheRoot]. |
142 * | 142 * |
143 * This doesn't need to be implemented if [shouldCache] is false, or if | 143 * This doesn't need to be implemented if [shouldCache] is false, or if |
144 * [installToSystemCache] is implemented. | 144 * [installToSystemCache] is implemented. |
145 */ | 145 */ |
146 String systemCacheDirectory(PackageId id) => | 146 String systemCacheDirectory(PackageId id) { |
147 join(systemCacheRoot, packageName(id.description)); | 147 throw 'Source.systemCacheDirectory must be implemented if shouldCache is ' |
| 148 'true and installToSystemCache is not implemented.'; |
| 149 } |
148 | 150 |
149 /** | 151 /** |
150 * When a [Pubspec] or [LockFile] is parsed, it reads in the description for | 152 * When a [Pubspec] or [LockFile] is parsed, it reads in the description for |
151 * each dependency. It is up to the dependency's [Source] to determine how | 153 * each dependency. It is up to the dependency's [Source] to determine how |
152 * that should be interpreted. This will be called during parsing to validate | 154 * that should be interpreted. This will be called during parsing to validate |
153 * that the given [description] is well-formed according to this source. It | 155 * that the given [description] is well-formed according to this source. It |
154 * should return if the description is valid, or throw a [FormatException] if | 156 * should return if the description is valid, or throw a [FormatException] if |
155 * not. | 157 * not. |
156 * | 158 * |
157 * [fromLockFile] is true when the description comes from a [LockFile], to | 159 * [fromLockFile] is true when the description comes from a [LockFile], to |
(...skipping 30 matching lines...) Expand all Loading... |
188 * to JSON and YAML. It must also be equal to [id] according to | 190 * to JSON and YAML. It must also be equal to [id] according to |
189 * [descriptionsEqual]. | 191 * [descriptionsEqual]. |
190 * | 192 * |
191 * By default, this just returns [id]. | 193 * By default, this just returns [id]. |
192 */ | 194 */ |
193 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); | 195 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); |
194 | 196 |
195 /// Returns the source's name. | 197 /// Returns the source's name. |
196 String toString() => name; | 198 String toString() => name; |
197 } | 199 } |
OLD | NEW |