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

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

Issue 10874051: Support self-referential package: imports with Pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review change Created 8 years, 3 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 | « utils/pub/pubspec.dart ('k') | utils/tests/pub/pub_test.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('sdk_source'); 5 #library('sdk_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('source.dart'); 10 #import('source.dart');
(...skipping 21 matching lines...) Expand all
32 32
33 SdkSource(this._rootDir); 33 SdkSource(this._rootDir);
34 34
35 /** 35 /**
36 * An SDK package has no dependencies. Its version number is inferred from the 36 * An SDK package has no dependencies. Its version number is inferred from the
37 * revision number of the SDK itself. 37 * revision number of the SDK itself.
38 */ 38 */
39 Future<Pubspec> describe(PackageId id) { 39 Future<Pubspec> describe(PackageId id) {
40 return readTextFile(join(rootDir, "revision")).transform((revision) { 40 return readTextFile(join(rootDir, "revision")).transform((revision) {
41 var version = new Version.parse("0.0.0-r.${revision.trim()}"); 41 var version = new Version.parse("0.0.0-r.${revision.trim()}");
42 return new Pubspec(version, <PackageRef>[]); 42 return new Pubspec(id.name, version, <PackageRef>[]);
43 }); 43 });
44 } 44 }
45 45
46 /** 46 /**
47 * Since all the SDK files are already available locally, installation just 47 * Since all the SDK files are already available locally, installation just
48 * involves symlinking the SDK library into the packages directory. 48 * involves symlinking the SDK library into the packages directory.
49 */ 49 */
50 Future<bool> install(PackageId id, String destPath) { 50 Future<bool> install(PackageId id, String destPath) {
51 // Look in "pkg" first. 51 // Look in "pkg" first.
52 var sourcePath = join(rootDir, "pkg", id.description); 52 var sourcePath = join(rootDir, "pkg", id.description);
53 return exists(sourcePath).chain((found) { 53 return exists(sourcePath).chain((found) {
54 if (!found) { 54 if (!found) {
55 // TODO(rnystrom): Get rid of this when all SDK packages are moved from 55 // TODO(rnystrom): Get rid of this when all SDK packages are moved from
56 // "lib" to "pkg". 56 // "lib" to "pkg".
57 // Not in "pkg", so try "lib". 57 // Not in "pkg", so try "lib".
58 sourcePath = join(rootDir, "lib", id.description); 58 sourcePath = join(rootDir, "lib", id.description);
59 return exists(sourcePath).chain((found) { 59 return exists(sourcePath).chain((found) {
60 if (!found) return new Future<bool>.immediate(false); 60 if (!found) return new Future<bool>.immediate(false);
61 return createSymlink(sourcePath, destPath).transform((_) => true); 61 return createSymlink(sourcePath, destPath).transform((_) => true);
62 }); 62 });
63 } 63 }
64 return createSymlink(sourcePath, destPath).transform((_) => true); 64 return createSymlink(sourcePath, destPath).transform((_) => true);
65 }); 65 });
66 } 66 }
67 } 67 }
OLDNEW
« no previous file with comments | « utils/pub/pubspec.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698