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

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

Issue 10951021: Add packages/ directories for dart files in web/. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/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('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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 /** 232 /**
233 * If `bin/`, `test/`, or `example/` directories exist, symlink `packages/` 233 * If `bin/`, `test/`, or `example/` directories exist, symlink `packages/`
234 * into them so that their entrypoints can be run. Do the same for any 234 * into them so that their entrypoints can be run. Do the same for any
235 * subdirectories of `test/` and `example/`. 235 * subdirectories of `test/` and `example/`.
236 */ 236 */
237 Future _linkSecondaryPackageDirs(_) { 237 Future _linkSecondaryPackageDirs(_) {
238 var binDir = join(root.dir, 'bin'); 238 var binDir = join(root.dir, 'bin');
239 var testDir = join(root.dir, 'test'); 239 var testDir = join(root.dir, 'test');
240 var exampleDir = join(root.dir, 'example'); 240 var exampleDir = join(root.dir, 'example');
241 var webDir = join(root.dir, 'web');
241 return dirExists(binDir).chain((exists) { 242 return dirExists(binDir).chain((exists) {
242 if (!exists) return new Future.immediate(null); 243 if (!exists) return new Future.immediate(null);
243 return _linkSecondaryPackageDir(binDir); 244 return _linkSecondaryPackageDir(binDir);
244 }).chain((_) => _linkSecondaryPackageDirsRecursively(testDir)) 245 }).chain((_) => _linkSecondaryPackageDirsRecursively(testDir))
245 .chain((_) => _linkSecondaryPackageDirsRecursively(exampleDir)); 246 .chain((_) => _linkSecondaryPackageDirsRecursively(exampleDir))
247 .chain((_) => _linkSecondaryPackageDirsRecursively(webDir));
246 } 248 }
247 249
248 /** 250 /**
249 * Creates a symlink to the `packages` directory in [dir] and all its 251 * Creates a symlink to the `packages` directory in [dir] and all its
250 * subdirectories. 252 * subdirectories.
251 */ 253 */
252 Future _linkSecondaryPackageDirsRecursively(String dir) { 254 Future _linkSecondaryPackageDirsRecursively(String dir) {
253 return dirExists(dir).chain((exists) { 255 return dirExists(dir).chain((exists) {
254 if (!exists) return new Future.immediate(null); 256 if (!exists) return new Future.immediate(null);
255 return _linkSecondaryPackageDir(dir) 257 return _linkSecondaryPackageDir(dir)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 * Creates a symlink to the `packages` directory in [dir] if none exists. 292 * Creates a symlink to the `packages` directory in [dir] if none exists.
291 */ 293 */
292 Future _linkSecondaryPackageDir(String dir) { 294 Future _linkSecondaryPackageDir(String dir) {
293 var to = join(dir, 'packages'); 295 var to = join(dir, 'packages');
294 return exists(to).chain((exists) { 296 return exists(to).chain((exists) {
295 if (exists) return new Future.immediate(null); 297 if (exists) return new Future.immediate(null);
296 return createSymlink(path, to); 298 return createSymlink(path, to);
297 }); 299 });
298 } 300 }
299 } 301 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/pub_install_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698