| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 }); | 208 }); |
| 209 } | 209 } |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * If `bin/`, `test/`, or `example/` directories exist, symlink `packages/` | 212 * If `bin/`, `test/`, or `example/` directories exist, symlink `packages/` |
| 213 * into them so that their entrypoints can be run. Do the same for any | 213 * into them so that their entrypoints can be run. Do the same for any |
| 214 * subdirectories of `test/` and `example/`. | 214 * subdirectories of `test/` and `example/`. |
| 215 */ | 215 */ |
| 216 Future _linkSecondaryPackageDirs(_) { | 216 Future _linkSecondaryPackageDirs(_) { |
| 217 var binDir = join(root.dir, 'bin'); | 217 var binDir = join(root.dir, 'bin'); |
| 218 var exampleDir = join(root.dir, 'example'); |
| 218 var testDir = join(root.dir, 'test'); | 219 var testDir = join(root.dir, 'test'); |
| 219 var exampleDir = join(root.dir, 'example'); | 220 var toolDir = join(root.dir, 'tool'); |
| 220 var webDir = join(root.dir, 'web'); | 221 var webDir = join(root.dir, 'web'); |
| 221 return dirExists(binDir).chain((exists) { | 222 return dirExists(binDir).chain((exists) { |
| 222 if (!exists) return new Future.immediate(null); | 223 if (!exists) return new Future.immediate(null); |
| 223 return _linkSecondaryPackageDir(binDir); | 224 return _linkSecondaryPackageDir(binDir); |
| 224 }).chain((_) => _linkSecondaryPackageDirsRecursively(testDir)) | 225 }).chain((_) => _linkSecondaryPackageDirsRecursively(exampleDir)) |
| 225 .chain((_) => _linkSecondaryPackageDirsRecursively(exampleDir)) | 226 .chain((_) => _linkSecondaryPackageDirsRecursively(testDir)) |
| 227 .chain((_) => _linkSecondaryPackageDirsRecursively(toolDir)) |
| 226 .chain((_) => _linkSecondaryPackageDirsRecursively(webDir)); | 228 .chain((_) => _linkSecondaryPackageDirsRecursively(webDir)); |
| 227 } | 229 } |
| 228 | 230 |
| 229 /** | 231 /** |
| 230 * Creates a symlink to the `packages` directory in [dir] and all its | 232 * Creates a symlink to the `packages` directory in [dir] and all its |
| 231 * subdirectories. | 233 * subdirectories. |
| 232 */ | 234 */ |
| 233 Future _linkSecondaryPackageDirsRecursively(String dir) { | 235 Future _linkSecondaryPackageDirsRecursively(String dir) { |
| 234 return dirExists(dir).chain((exists) { | 236 return dirExists(dir).chain((exists) { |
| 235 if (!exists) return new Future.immediate(null); | 237 if (!exists) return new Future.immediate(null); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 * Creates a symlink to the `packages` directory in [dir] if none exists. | 273 * Creates a symlink to the `packages` directory in [dir] if none exists. |
| 272 */ | 274 */ |
| 273 Future _linkSecondaryPackageDir(String dir) { | 275 Future _linkSecondaryPackageDir(String dir) { |
| 274 var to = join(dir, 'packages'); | 276 var to = join(dir, 'packages'); |
| 275 return exists(to).chain((exists) { | 277 return exists(to).chain((exists) { |
| 276 if (exists) return new Future.immediate(null); | 278 if (exists) return new Future.immediate(null); |
| 277 return createSymlink(path, to); | 279 return createSymlink(path, to); |
| 278 }); | 280 }); |
| 279 } | 281 } |
| 280 } | 282 } |
| OLD | NEW |