| 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('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'); |
| 11 #import('version.dart'); | 11 #import('version.dart'); |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * A package source that uses libraries from the Dart SDK. | 14 * A package source that uses libraries from the Dart SDK. |
| 15 * | 15 * |
| 16 * This currently uses the "sdkdir" command-line argument to find the SDK. | 16 * This currently uses the "sdkdir" command-line argument to find the SDK. |
| 17 */ | 17 */ |
| 18 class SdkSource extends Source { | 18 class SdkSource extends Source { |
| 19 final String name = "sdk"; | 19 final String name = "sdk"; |
| 20 final bool shouldCache = false; | 20 final bool shouldCache = false; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * The root directory of the Dart SDK. | 23 * The root directory of the Dart SDK. |
| 24 */ | 24 */ |
| 25 final String _rootDir; | 25 final String _rootDir; |
| 26 | 26 |
| 27 String get rootDir() { | 27 String get rootDir { |
| 28 if (_rootDir != null) return _rootDir; | 28 if (_rootDir != null) return _rootDir; |
| 29 throw "Pub can't find the Dart SDK. Please set the DART_SDK environment " | 29 throw "Pub can't find the Dart SDK. Please set the DART_SDK environment " |
| 30 "variable to the Dart SDK directory."; | 30 "variable to the Dart SDK directory."; |
| 31 } | 31 } |
| 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. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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 } |
| OLD | NEW |