| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:barback/barback.dart'; | 8 import 'package:barback/barback.dart'; |
| 9 import 'package:package_config/packages_file.dart' as packages_file; | 9 import 'package:package_config/packages_file.dart' as packages_file; |
| 10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
| 11 import 'package:pub_semver/pub_semver.dart'; | 11 import 'package:pub_semver/pub_semver.dart'; |
| 12 | 12 |
| 13 import 'barback/asset_environment.dart'; | 13 import 'barback/asset_environment.dart'; |
| 14 import 'exceptions.dart'; |
| 14 import 'io.dart'; | 15 import 'io.dart'; |
| 15 import 'lock_file.dart'; | 16 import 'lock_file.dart'; |
| 16 import 'log.dart' as log; | 17 import 'log.dart' as log; |
| 17 import 'package.dart'; | 18 import 'package.dart'; |
| 18 import 'package_graph.dart'; | 19 import 'package_graph.dart'; |
| 19 import 'sdk.dart' as sdk; | 20 import 'sdk.dart' as sdk; |
| 20 import 'solver/version_solver.dart'; | 21 import 'solver/version_solver.dart'; |
| 21 import 'source/cached.dart'; | 22 import 'source/cached.dart'; |
| 22 import 'source/unknown.dart'; | 23 import 'source/unknown.dart'; |
| 23 import 'system_cache.dart'; | 24 import 'system_cache.dart'; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 /// not in the lockfile or that don't match what's in there. | 505 /// not in the lockfile or that don't match what's in there. |
| 505 bool _isLockFileUpToDate() { | 506 bool _isLockFileUpToDate() { |
| 506 if (!root.immediateDependencies.every(_isDependencyUpToDate)) return false; | 507 if (!root.immediateDependencies.every(_isDependencyUpToDate)) return false; |
| 507 | 508 |
| 508 var overrides = root.dependencyOverrides.map((dep) => dep.name).toSet(); | 509 var overrides = root.dependencyOverrides.map((dep) => dep.name).toSet(); |
| 509 | 510 |
| 510 // Check that uncached dependencies' pubspecs are also still satisfied, | 511 // Check that uncached dependencies' pubspecs are also still satisfied, |
| 511 // since they're mutable and may have changed since the last get. | 512 // since they're mutable and may have changed since the last get. |
| 512 return lockFile.packages.values.every((id) { | 513 return lockFile.packages.values.every((id) { |
| 513 var source = cache.sources[id.name]; | 514 var source = cache.sources[id.name]; |
| 514 if (source is! CachedSource) return true; | 515 if (source is CachedSource) return true; |
| 515 | 516 |
| 516 return cache.sources.load(id).dependencies.every((dep) => | 517 try { |
| 517 overrides.contains(dep.name) || _isDependencyUpToDate(dep)); | 518 return cache.sources.load(id).dependencies.every((dep) => |
| 519 overrides.contains(dep.name) || _isDependencyUpToDate(dep)); |
| 520 } on FileException { |
| 521 // If we can't load the pubpsec, the user needs to re-run "pub get". |
| 522 return false; |
| 523 } |
| 518 }); | 524 }); |
| 519 } | 525 } |
| 520 | 526 |
| 521 /// Returns whether the locked version of [dep] matches the dependency. | 527 /// Returns whether the locked version of [dep] matches the dependency. |
| 522 bool _isDependencyUpToDate(PackageDep dep) { | 528 bool _isDependencyUpToDate(PackageDep dep) { |
| 523 var locked = lockFile.packages[dep.name]; | 529 var locked = lockFile.packages[dep.name]; |
| 524 if (locked == null) return false; | 530 if (locked == null) return false; |
| 525 | 531 |
| 526 if (dep.source != locked.source) return false; | 532 if (dep.source != locked.source) return false; |
| 527 | 533 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 /// If [packageSymlinks] is true, creates a symlink to the "packages" | 670 /// If [packageSymlinks] is true, creates a symlink to the "packages" |
| 665 /// directory in [dir]. | 671 /// directory in [dir]. |
| 666 /// | 672 /// |
| 667 /// Otherwise, deletes a "packages" directories in [dir] if one exists. | 673 /// Otherwise, deletes a "packages" directories in [dir] if one exists. |
| 668 void _linkOrDeleteSecondaryPackageDir(String dir) { | 674 void _linkOrDeleteSecondaryPackageDir(String dir) { |
| 669 var symlink = p.join(dir, 'packages'); | 675 var symlink = p.join(dir, 'packages'); |
| 670 if (entryExists(symlink)) deleteEntry(symlink); | 676 if (entryExists(symlink)) deleteEntry(symlink); |
| 671 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true); | 677 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true); |
| 672 } | 678 } |
| 673 } | 679 } |
| OLD | NEW |