Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: utils/pub/source.dart

Issue 10577009: Give cached sources control over their cache directories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/pub/system_cache.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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('package.dart'); 7 #import('package.dart');
8 8
9 /** 9 /**
10 * A source from which to install packages. 10 * A source from which to install packages.
(...skipping 17 matching lines...) Expand all
28 * locally. 28 * locally.
29 */ 29 */
30 abstract bool get shouldCache(); 30 abstract bool get shouldCache();
31 31
32 /** 32 /**
33 * Installs the package identified by [id] to [path]. Returns a [Future] that 33 * Installs the package identified by [id] to [path]. Returns a [Future] that
34 * completes when the installation was finished. The [Future] should resolve 34 * completes when the installation was finished. The [Future] should resolve
35 * to true if the package was found in the source and false if it wasn't. For 35 * to true if the package was found in the source and false if it wasn't. For
36 * all other error conditions, it should complete with an exception. 36 * all other error conditions, it should complete with an exception.
37 * 37 *
38 * If [shouldCache] is true, [path] will be a path to this source's
39 * subdirectory of the [PackageCache]'s cache directory. If [shouldCache] is
40 * false, [path] will be a path to the application's "packages" directory.
41 *
42 * [path] is guaranteed not to exist, and its parent directory is guaranteed 38 * [path] is guaranteed not to exist, and its parent directory is guaranteed
43 * to exist. 39 * to exist.
44 */ 40 */
45 abstract Future<bool> install(PackageId id, String path); 41 abstract Future<bool> install(PackageId id, String path);
46 42
47 /** 43 /**
44 * Returns the directory in the system cache that the package identified by
45 * [id] should be installed to. [parent] is this source's subdirectory in the
46 * system cache directory.
47 *
48 * This doesn't need to be implemented if [shouldCache] is false.
49 */
50 String systemCacheDirectory(PackageId id, String parent) =>
51 join(parent, packageName(id));
52
53 /**
48 * When a [Pubspec] is parsed, it reads in the description for each 54 * When a [Pubspec] is parsed, it reads in the description for each
49 * dependency. It is up to the dependency's [Source] to determine how that 55 * dependency. It is up to the dependency's [Source] to determine how that
50 * should be interpreted. This will be called during parsing to validate that 56 * should be interpreted. This will be called during parsing to validate that
51 * the given [description] is well-formed according to this source. It should 57 * the given [description] is well-formed according to this source. It should
52 * return if the description is valid, or throw a [FormatException] if not. 58 * return if the description is valid, or throw a [FormatException] if not.
53 */ 59 */
54 void validateDescription(description) {} 60 void validateDescription(description) {}
55 61
56 /** 62 /**
57 * Returns a human-friendly name for the package identified by [id]. This 63 * Returns a human-friendly name for the package identified by [id]. This
58 * method should be light-weight. It doesn't need to validate that the given 64 * method should be light-weight. It doesn't need to validate that the given
59 * package exists. 65 * package exists.
60 * 66 *
61 * The package name should be lower-case and suitable for use in a filename. 67 * The package name should be lower-case and suitable for use in a filename.
62 * It may contain forward slashes. 68 * It may contain forward slashes.
63 */ 69 */
64 String packageName(PackageId id) => id.description; 70 String packageName(PackageId id) => id.description;
65 } 71 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698