| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 /** | 54 /** |
| 55 * The path to this "packages" directory. | 55 * The path to this "packages" directory. |
| 56 */ | 56 */ |
| 57 // TODO(rnystrom): Make this path configurable. | 57 // TODO(rnystrom): Make this path configurable. |
| 58 String get path() => join(root.dir, 'packages'); | 58 String get path => join(root.dir, 'packages'); |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Ensures that the package identified by [id] is installed to the directory. | 61 * Ensures that the package identified by [id] is installed to the directory. |
| 62 * Returns the resolved [PackageId]. | 62 * Returns the resolved [PackageId]. |
| 63 * | 63 * |
| 64 * If this completes successfully, the package is guaranteed to be importable | 64 * If this completes successfully, the package is guaranteed to be importable |
| 65 * using the `package:` scheme. | 65 * using the `package:` scheme. |
| 66 * | 66 * |
| 67 * This will automatically install the package to the system-wide cache as | 67 * This will automatically install the package to the system-wide cache as |
| 68 * well if it requires network access to retrieve (specifically, if | 68 * well if it requires network access to retrieve (specifically, if |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 */ | 182 */ |
| 183 Future _saveLockFile(List<PackageId> packageIds) { | 183 Future _saveLockFile(List<PackageId> packageIds) { |
| 184 var lockFile = new LockFile.empty(); | 184 var lockFile = new LockFile.empty(); |
| 185 for (var id in packageIds) { | 185 for (var id in packageIds) { |
| 186 if (id.source is! RootSource) lockFile.packages[id.name] = id; | 186 if (id.source is! RootSource) lockFile.packages[id.name] = id; |
| 187 } | 187 } |
| 188 | 188 |
| 189 return writeTextFile(join(root.dir, 'pubspec.lock'), lockFile.serialize()); | 189 return writeTextFile(join(root.dir, 'pubspec.lock'), lockFile.serialize()); |
| 190 } | 190 } |
| 191 } | 191 } |
| OLD | NEW |