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

Side by Side Diff: lib/src/entrypoint.dart

Issue 1277633004: Auto-run "pub get" more for "pub run". (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | test/run/allows_dart_extension_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 pub.entrypoint; 5 library pub.entrypoint;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
10 import 'package:barback/barback.dart'; 10 import 'package:barback/barback.dart';
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 return dirExists(dir) || fileExists(path.join(dir, "pubspec.yaml")); 418 return dirExists(dir) || fileExists(path.join(dir, "pubspec.yaml"));
419 }); 419 });
420 })).then((results) { 420 })).then((results) {
421 // Make sure they are all true. 421 // Make sure they are all true.
422 return results.every((result) => result); 422 return results.every((result) => result);
423 }); 423 });
424 } 424 }
425 425
426 /// Gets dependencies if the lockfile is out of date with respect to the 426 /// Gets dependencies if the lockfile is out of date with respect to the
427 /// pubspec. 427 /// pubspec.
428 Future ensureLockFileIsUpToDate() { 428 Future ensureLockFileIsUpToDate() async {
429 return new Future.sync(() { 429 if (!lockFileExists) {
430 log.message(
431 "You don't have a lockfile, so we need to generate that:");
432 } else if (_isLockFileUpToDate(lockFile)) {
433 // If we do have a lock file, we still need to make sure the packages are
434 // actually installed. The user may have just gotten a package that
435 // includes a lockfile.
436 if (await _arePackagesAvailable(lockFile)) return;
437
430 // If we don't have a current lock file, we definitely need to install. 438 // If we don't have a current lock file, we definitely need to install.
431 if (!_isLockFileUpToDate(lockFile)) { 439 log.message(
432 if (lockFileExists) { 440 "You are missing some dependencies, so we need to install them "
433 log.message( 441 "first:");
434 "Your pubspec has changed, so we need to update your lockfile:"); 442 } else {
435 } else { 443 log.message(
436 log.message( 444 "Your pubspec has changed, so we need to update your lockfile:");
437 "You don't have a lockfile, so we need to generate that:"); 445 }
438 }
439 446
440 return false; 447 await acquireDependencies(SolveType.GET);
441 }
442
443 // If we do have a lock file, we still need to make sure the packages
444 // are actually installed. The user may have just gotten a package that
445 // includes a lockfile.
446 return _arePackagesAvailable(lockFile).then((available) {
447 if (!available) {
448 log.message(
449 "You are missing some dependencies, so we need to install them "
450 "first:");
451 }
452
453 return available;
454 });
455 }).then((upToDate) {
456 if (upToDate) return null;
457 return acquireDependencies(SolveType.GET);
458 });
459 } 448 }
460 449
461 /// Loads the package graph for the application and all of its transitive 450 /// Loads the package graph for the application and all of its transitive
462 /// dependencies. 451 /// dependencies.
463 /// 452 ///
464 /// If [result] is passed, this loads the graph from it without re-parsing the 453 /// If [result] is passed, this loads the graph from it without re-parsing the
465 /// lockfile or any pubspecs. Otherwise, before loading, this makes sure the 454 /// lockfile or any pubspecs. Otherwise, before loading, this makes sure the
466 /// lockfile and dependencies are installed and up to date. 455 /// lockfile and dependencies are installed and up to date.
467 Future<PackageGraph> loadPackageGraph([SolveResult result]) async { 456 Future<PackageGraph> loadPackageGraph([SolveResult result]) async {
468 if (_packageGraph != null) return _packageGraph; 457 if (_packageGraph != null) return _packageGraph;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 /// If [packageSymlinks] is true, creates a symlink to the "packages" 549 /// If [packageSymlinks] is true, creates a symlink to the "packages"
561 /// directory in [dir]. 550 /// directory in [dir].
562 /// 551 ///
563 /// Otherwise, deletes a "packages" directories in [dir] if one exists. 552 /// Otherwise, deletes a "packages" directories in [dir] if one exists.
564 void _linkOrDeleteSecondaryPackageDir(String dir) { 553 void _linkOrDeleteSecondaryPackageDir(String dir) {
565 var symlink = path.join(dir, 'packages'); 554 var symlink = path.join(dir, 'packages');
566 if (entryExists(symlink)) deleteEntry(symlink); 555 if (entryExists(symlink)) deleteEntry(symlink);
567 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true); 556 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true);
568 } 557 }
569 } 558 }
OLDNEW
« no previous file with comments | « no previous file | test/run/allows_dart_extension_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698