| 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 /** | 5 /** |
| 6 * A named, versioned, unit of code and resource reuse. | 6 * A named, versioned, unit of code and resource reuse. |
| 7 */ | 7 */ |
| 8 class Package implements Hashable { | 8 class Package implements Hashable { |
| 9 /** | 9 /** |
| 10 * Loads the package whose root directory is [packageDir]. | 10 * Loads the package whose root directory is [packageDir]. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 walkPackage(Package package) { | 64 walkPackage(Package package) { |
| 65 // Skip packages we've already traversed. | 65 // Skip packages we've already traversed. |
| 66 if (packages.contains(package)) return; | 66 if (packages.contains(package)) return; |
| 67 | 67 |
| 68 // Add the package. | 68 // Add the package. |
| 69 packages.add(package); | 69 packages.add(package); |
| 70 | 70 |
| 71 // Recurse into its dependencies. | 71 // Recurse into its dependencies. |
| 72 pendingAsyncCalls++; | 72 pendingAsyncCalls++; |
| 73 package.loadDependencies().then((dependencies) { | 73 package.loadDependencies(cache).then((dependencies) { |
| 74 dependencies.forEach(walkPackage); | 74 dependencies.forEach(walkPackage); |
| 75 pendingAsyncCalls--; | 75 pendingAsyncCalls--; |
| 76 if (pendingAsyncCalls == 0) completer.complete(packages); | 76 if (pendingAsyncCalls == 0) completer.complete(packages); |
| 77 }); | 77 }); |
| 78 } | 78 } |
| 79 | 79 |
| 80 walkPackage(this); | 80 walkPackage(this); |
| 81 | 81 |
| 82 return completer.future; | 82 return completer.future; |
| 83 } | 83 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 completer.completeException( | 133 completer.completeException( |
| 134 'The pubspec dependencies must be a list of package names.'); | 134 'The pubspec dependencies must be a list of package names.'); |
| 135 } | 135 } |
| 136 | 136 |
| 137 completer.complete(dependencies); | 137 completer.complete(dependencies); |
| 138 }); | 138 }); |
| 139 | 139 |
| 140 return completer.future; | 140 return completer.future; |
| 141 } | 141 } |
| 142 } | 142 } |
| OLD | NEW |