| 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 entrypoint; | 5 library entrypoint; |
| 6 | 6 |
| 7 import 'io.dart'; | 7 import 'io.dart'; |
| 8 import 'lock_file.dart'; | 8 import 'lock_file.dart'; |
| 9 import 'package.dart'; | 9 import 'package.dart'; |
| 10 import 'root_source.dart'; | 10 import 'root_source.dart'; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * Packages which are either currently being asynchronously installed to the | 46 * Packages which are either currently being asynchronously installed to the |
| 47 * directory, or have already been installed. | 47 * directory, or have already been installed. |
| 48 */ | 48 */ |
| 49 final Map<PackageId, Future<PackageId>> _installs; | 49 final Map<PackageId, Future<PackageId>> _installs; |
| 50 | 50 |
| 51 Entrypoint(this.root, this.cache) | 51 Entrypoint(this.root, this.cache) |
| 52 : _installs = new Map<PackageId, Future<PackageId>>(); | 52 : _installs = new Map<PackageId, Future<PackageId>>(); |
| 53 | 53 |
| 54 /// Loads the entrypoint from a package at [rootDir]. |
| 55 static Future<Entrypoint> load(String rootDir, SystemCache cache) { |
| 56 return Package.load(null, rootDir, cache.sources).transform((package) => |
| 57 new Entrypoint(package, cache)); |
| 58 } |
| 59 |
| 54 /** | 60 /** |
| 55 * The path to this "packages" directory. | 61 * The path to this "packages" directory. |
| 56 */ | 62 */ |
| 57 // TODO(rnystrom): Make this path configurable. | 63 // TODO(rnystrom): Make this path configurable. |
| 58 String get path => join(root.dir, 'packages'); | 64 String get path => join(root.dir, 'packages'); |
| 59 | 65 |
| 60 /** | 66 /** |
| 61 * Ensures that the package identified by [id] is installed to the directory. | 67 * Ensures that the package identified by [id] is installed to the directory. |
| 62 * Returns the resolved [PackageId]. | 68 * Returns the resolved [PackageId]. |
| 63 * | 69 * |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 * Creates a symlink to the `packages` directory in [dir] if none exists. | 279 * Creates a symlink to the `packages` directory in [dir] if none exists. |
| 274 */ | 280 */ |
| 275 Future _linkSecondaryPackageDir(String dir) { | 281 Future _linkSecondaryPackageDir(String dir) { |
| 276 var to = join(dir, 'packages'); | 282 var to = join(dir, 'packages'); |
| 277 return exists(to).chain((exists) { | 283 return exists(to).chain((exists) { |
| 278 if (exists) return new Future.immediate(null); | 284 if (exists) return new Future.immediate(null); |
| 279 return createSymlink(path, to); | 285 return createSymlink(path, to); |
| 280 }); | 286 }); |
| 281 } | 287 } |
| 282 } | 288 } |
| OLD | NEW |