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

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

Issue 12285010: Support relative paths in path dependencies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
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 'dart:async'; 7 import 'dart:async';
8 8
9 import '../../pkg/path/lib/path.dart' as path; 9 import '../../pkg/path/lib/path.dart' as path;
10 10
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 /// 162 ///
163 /// This doesn't need to be implemented if [shouldCache] is false. 163 /// This doesn't need to be implemented if [shouldCache] is false.
164 Future<String> systemCacheDirectory(PackageId id) { 164 Future<String> systemCacheDirectory(PackageId id) {
165 return new Future.immediateError( 165 return new Future.immediateError(
166 "systemCacheDirectory() must be implemented if shouldCache is true."); 166 "systemCacheDirectory() must be implemented if shouldCache is true.");
167 } 167 }
168 168
169 /// When a [Pubspec] or [LockFile] is parsed, it reads in the description for 169 /// When a [Pubspec] or [LockFile] is parsed, it reads in the description for
170 /// each dependency. It is up to the dependency's [Source] to determine how 170 /// each dependency. It is up to the dependency's [Source] to determine how
171 /// that should be interpreted. This will be called during parsing to validate 171 /// that should be interpreted. This will be called during parsing to validate
172 /// that the given [description] is well-formed according to this source. It 172 /// that the given [description] is well-formed according to this source, and
173 /// should return if the description is valid, or throw a [FormatException] if 173 /// to give the source a chance to canonicalize the description.
174 /// not. 174 ///
175 /// It should return if a (possibly modified) valid description, or throw a
176 /// [FormatException] if not valid.
175 /// 177 ///
176 /// [fromLockFile] is true when the description comes from a [LockFile], to 178 /// [fromLockFile] is true when the description comes from a [LockFile], to
177 /// allow the source to use lockfile-specific descriptions via [resolveId]. 179 /// allow the source to use lockfile-specific descriptions via [resolveId].
178 void validateDescription(description, {bool fromLockFile: false}) {} 180 dynamic parseDescription(String containingPath, description,
nweiz 2013/02/15 23:09:24 Describe containingPath in the docstring.
Bob Nystrom 2013/02/16 00:09:57 Done.
181 {bool fromLockFile: false}) {
182 return description;
183 }
179 184
180 /// Returns whether or not [description1] describes the same package as 185 /// Returns whether or not [description1] describes the same package as
181 /// [description2] for this source. This method should be light-weight. It 186 /// [description2] for this source. This method should be light-weight. It
182 /// doesn't need to validate that either package exists. 187 /// doesn't need to validate that either package exists.
183 /// 188 ///
184 /// By default, just uses regular equality. 189 /// By default, just uses regular equality.
185 bool descriptionsEqual(description1, description2) => 190 bool descriptionsEqual(description1, description2) =>
186 description1 == description2; 191 description1 == description2;
187 192
188 /// For some sources, [PackageId]s can point to different chunks of code at 193 /// For some sources, [PackageId]s can point to different chunks of code at
189 /// different times. This takes such an [id] and returns a future that 194 /// different times. This takes such an [id] and returns a future that
190 /// completes to a [PackageId] that will uniquely specify a single chunk of 195 /// completes to a [PackageId] that will uniquely specify a single chunk of
191 /// code forever. 196 /// code forever.
192 /// 197 ///
193 /// For example, [GitSource] might take an [id] with description 198 /// For example, [GitSource] might take an [id] with description
194 /// `http://github.com/dart-lang/some-lib.git` and return an id with a 199 /// `http://github.com/dart-lang/some-lib.git` and return an id with a
195 /// description that includes the current commit of the Git repository. 200 /// description that includes the current commit of the Git repository.
196 /// 201 ///
197 /// This will be called after the package identified by [id] is installed, so 202 /// This will be called after the package identified by [id] is installed, so
198 /// the source can use the installed package to determine information about 203 /// the source can use the installed package to determine information about
199 /// the resolved id. 204 /// the resolved id.
200 /// 205 ///
201 /// The returned [PackageId] may have a description field that's invalid 206 /// The returned [PackageId] may have a description field that's invalid
202 /// according to [validateDescription], although it must still be serializable 207 /// according to [parseDescription], although it must still be serializable
203 /// to JSON and YAML. It must also be equal to [id] according to 208 /// to JSON and YAML. It must also be equal to [id] according to
204 /// [descriptionsEqual]. 209 /// [descriptionsEqual].
205 /// 210 ///
206 /// By default, this just returns [id]. 211 /// By default, this just returns [id].
207 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id); 212 Future<PackageId> resolveId(PackageId id) => new Future.immediate(id);
208 213
209 /// Returns the source's name. 214 /// Returns the source's name.
210 String toString() => name; 215 String toString() => name;
211 } 216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698