Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: utils/pub/entrypoint.dart

Issue 12321020: Use relative symlinks for self links and secondary "packages" dirs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/tests/pub/install/pub_install_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/install/pub_install_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698