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

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

Issue 10340005: Add support for pub install. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Chromium review errors? Created 8 years, 7 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * A package source that uses libraries from the Dart SDK.
7 *
8 * This currently uses the "sdkdir" command-line argument to find the SDK.
9 */
10 // TODO(nweiz): This should read the SDK directory from an environment variable
11 // once we can set those for tests.
12 class SdkSource extends Source {
13 final String name = "sdk";
14 final bool shouldCache = false;
15
16 /**
17 * The root directory of the Dart SDK.
18 */
19 final String rootDir;
20
21 SdkSource(this.rootDir);
22
23 /**
24 * Since all the SDK files are already available locally, installation just
25 * involves symlinking the SDK library into the packages directory.
26 */
27 Future<bool> install(PackageId id, String destPath) {
28 var sourcePath = join(rootDir, "lib", id.name);
Bob Nystrom 2012/05/03 00:15:49 Might want to look in utils too at some point.
nweiz 2012/05/04 01:03:43 Something to talk to Dan about.
29 return exists(sourcePath).chain((exists) {
30 if (!exists) return new Future<bool>.immediate(false);
31 return createSymlink(sourcePath, destPath).transform((_) => true);
32 });
33 }
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698