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 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:pathos/path.dart' as path; | 9 import 'package:pathos/path.dart' as path; |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 log.fine("Deleting package directory for ${id.name} before install."); | 80 log.fine("Deleting package directory for ${id.name} before install."); |
81 deleteEntry(packageDir); | 81 deleteEntry(packageDir); |
82 } | 82 } |
83 | 83 |
84 if (id.source.shouldCache) { | 84 if (id.source.shouldCache) { |
85 return cache.install(id).then( | 85 return cache.install(id).then( |
86 (pkg) => createPackageSymlink(id.name, pkg.dir, packageDir)); | 86 (pkg) => createPackageSymlink(id.name, pkg.dir, packageDir)); |
87 } else { | 87 } else { |
88 return id.source.install(id, packageDir).then((found) { | 88 return id.source.install(id, packageDir).then((found) { |
89 if (found) return null; | 89 if (found) return null; |
90 // TODO(nweiz): More robust error-handling. | 90 fail('Package ${id.name} not found in source "${id.source.name}".'); |
91 throw 'Package ${id.name} not found in source "${id.source.name}".'; | |
92 }); | 91 }); |
93 } | 92 } |
94 }).then((_) => id.resolved); | 93 }).then((_) => id.resolved); |
95 | 94 |
96 _installs[id] = future; | 95 _installs[id] = future; |
97 | 96 |
98 return future; | 97 return future; |
99 } | 98 } |
100 | 99 |
101 /// Installs all dependencies of the [root] package to its "packages" | 100 /// Installs all dependencies of the [root] package to its "packages" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 275 } |
277 | 276 |
278 /// Creates a symlink to the `packages` directory in [dir]. Will replace one | 277 /// Creates a symlink to the `packages` directory in [dir]. Will replace one |
279 /// if already there. | 278 /// if already there. |
280 void _linkSecondaryPackageDir(String dir) { | 279 void _linkSecondaryPackageDir(String dir) { |
281 var symlink = path.join(dir, 'packages'); | 280 var symlink = path.join(dir, 'packages'); |
282 if (entryExists(symlink)) deleteEntry(symlink); | 281 if (entryExists(symlink)) deleteEntry(symlink); |
283 createSymlink(packagesDir, symlink, relative: true); | 282 createSymlink(packagesDir, symlink, relative: true); |
284 } | 283 } |
285 } | 284 } |
OLD | NEW |