| 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 /// A package source that uses libraries from the Dart SDK. | 13 /// A package source that uses libraries from the Dart SDK. |
| 14 class SdkSource extends Source { | 14 class SdkSource extends Source { |
| 15 final String name = "sdk"; | 15 final String name = "sdk"; |
| 16 final bool shouldCache = false; | 16 final bool shouldCache = false; |
| 17 | 17 |
| 18 /// The root directory of the Dart SDK. | 18 /// The root directory of the Dart SDK. |
| 19 final String _rootDir; | 19 final String _rootDir; |
| 20 | 20 |
| 21 String get rootDir { | 21 String get rootDir { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (found) return new Future<String>.immediate(pkgPath); | 64 if (found) return new Future<String>.immediate(pkgPath); |
| 65 | 65 |
| 66 // Not in "pkg", so try "lib". | 66 // Not in "pkg", so try "lib". |
| 67 // TODO(rnystrom): Get rid of this when all SDK packages are moved from | 67 // TODO(rnystrom): Get rid of this when all SDK packages are moved from |
| 68 // "lib" to "pkg". | 68 // "lib" to "pkg". |
| 69 var libPath = join(rootDir, "lib", id.description); | 69 var libPath = join(rootDir, "lib", id.description); |
| 70 return exists(libPath).transform((found) => found ? libPath : null); | 70 return exists(libPath).transform((found) => found ? libPath : null); |
| 71 }); | 71 }); |
| 72 } | 72 } |
| 73 } | 73 } |
| OLD | NEW |