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 '../../pkg/path/lib/path.dart' as path; | 9 import '../../pkg/path/lib/path.dart' as path; |
10 | 10 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 /// Installs a self-referential symlink in the `packages` directory that will | 226 /// Installs a self-referential symlink in the `packages` directory that will |
227 /// allow a package to import its own files using `package:`. | 227 /// allow a package to import its own files using `package:`. |
228 Future _installSelfReference(_) { | 228 Future _installSelfReference(_) { |
229 return defer(() { | 229 return defer(() { |
230 var linkPath = path.join(packagesDir, root.name); | 230 var linkPath = path.join(packagesDir, root.name); |
231 // Create the symlink if it doesn't exist. | 231 // Create the symlink if it doesn't exist. |
232 if (entryExists(linkPath)) return; | 232 if (entryExists(linkPath)) return; |
233 ensureDir(packagesDir); | 233 ensureDir(packagesDir); |
234 return createPackageSymlink(root.name, root.dir, linkPath, | 234 return createPackageSymlink(root.name, root.dir, linkPath, |
235 isSelfLink: true); | 235 isSelfLink: true, relative: true); |
236 }); | 236 }); |
237 } | 237 } |
238 | 238 |
239 /// If `bin/`, `test/`, or `example/` directories exist, symlink `packages/` | 239 /// If `bin/`, `test/`, or `example/` directories exist, symlink `packages/` |
240 /// into them so that their entrypoints can be run. Do the same for any | 240 /// into them so that their entrypoints can be run. Do the same for any |
241 /// subdirectories of `test/` and `example/`. | 241 /// subdirectories of `test/` and `example/`. |
242 Future _linkSecondaryPackageDirs(_) { | 242 Future _linkSecondaryPackageDirs(_) { |
243 var binDir = path.join(root.dir, 'bin'); | 243 var binDir = path.join(root.dir, 'bin'); |
244 var exampleDir = path.join(root.dir, 'example'); | 244 var exampleDir = path.join(root.dir, 'example'); |
245 var testDir = path.join(root.dir, 'test'); | 245 var testDir = path.join(root.dir, 'test'); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 }); | 289 }); |
290 }).toList()); | 290 }).toList()); |
291 }).then(flatten); | 291 }).then(flatten); |
292 } | 292 } |
293 | 293 |
294 /// Creates a symlink to the `packages` directory in [dir] if none exists. | 294 /// Creates a symlink to the `packages` directory in [dir] if none exists. |
295 Future _linkSecondaryPackageDir(String dir) { | 295 Future _linkSecondaryPackageDir(String dir) { |
296 return defer(() { | 296 return defer(() { |
297 var symlink = path.join(dir, 'packages'); | 297 var symlink = path.join(dir, 'packages'); |
298 if (entryExists(symlink)) return; | 298 if (entryExists(symlink)) return; |
299 return createSymlink(packagesDir, symlink); | 299 return createSymlink(packagesDir, symlink, relative: true); |
300 }); | 300 }); |
301 } | 301 } |
302 } | 302 } |
OLD | NEW |