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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 /** | 97 /** |
98 * Installs the package identified by [id] to [path]. Returns a [Future] that | 98 * Installs the package identified by [id] to [path]. Returns a [Future] that |
99 * completes when the installation was finished. The [Future] should resolve | 99 * completes when the installation was finished. The [Future] should resolve |
100 * to true if the package was found in the source and false if it wasn't. For | 100 * to true if the package was found in the source and false if it wasn't. For |
101 * all other error conditions, it should complete with an exception. | 101 * all other error conditions, it should complete with an exception. |
102 * | 102 * |
103 * [path] is guaranteed not to exist, and its parent directory is guaranteed | 103 * [path] is guaranteed not to exist, and its parent directory is guaranteed |
104 * to exist. | 104 * to exist. |
105 * | 105 * |
| 106 * Note that [path] may be deleted. If re-installing a package that has |
| 107 * already been installed would be costly or impossible, |
| 108 * [installToSystemCache] should be implemented instead of [install]. |
| 109 * |
106 * This doesn't need to be implemented if [installToSystemCache] is | 110 * This doesn't need to be implemented if [installToSystemCache] is |
107 * implemented. | 111 * implemented. |
108 */ | 112 */ |
109 Future<bool> install(PackageId id, String path) { | 113 Future<bool> install(PackageId id, String path) { |
110 throw "Either install or installToSystemCache must be implemented for " | 114 throw "Either install or installToSystemCache must be implemented for " |
111 "source $name."; | 115 "source $name."; |
112 } | 116 } |
113 | 117 |
114 /** | 118 /** |
115 * Installs the package identified by [id] to the system cache. This is only | 119 * Installs the package identified by [id] to the system cache. This is only |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 * | 193 * |
190 * The returned [PackageId] may have a description field that's invalid | 194 * The returned [PackageId] may have a description field that's invalid |
191 * according to [validateDescription], although it must still be serializable | 195 * according to [validateDescription], although it must still be serializable |
192 * to JSON and YAML. It must also be equal to [id] according to | 196 * to JSON and YAML. It must also be equal to [id] according to |
193 * [descriptionsEqual]. | 197 * [descriptionsEqual]. |
194 * | 198 * |
195 * By default, this just returns [id]. | 199 * By default, this just returns [id]. |
196 */ | 200 */ |
197 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); | 201 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); |
198 } | 202 } |
OLD | NEW |