| 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 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'; |
| 11 | 11 |
| 12 import 'barback/asset_environment.dart'; | 12 import 'barback/asset_environment.dart'; |
| 13 import 'io.dart'; | 13 import 'io.dart'; |
| 14 import 'lock_file.dart'; | 14 import 'lock_file.dart'; |
| 15 import 'log.dart' as log; | 15 import 'log.dart' as log; |
| 16 import 'package.dart'; | 16 import 'package.dart'; |
| 17 import 'package_graph.dart'; | 17 import 'package_graph.dart'; |
| 18 import 'package_locations.dart'; |
| 18 import 'sdk.dart' as sdk; | 19 import 'sdk.dart' as sdk; |
| 19 import 'solver/version_solver.dart'; | 20 import 'solver/version_solver.dart'; |
| 20 import 'source/cached.dart'; | 21 import 'source/cached.dart'; |
| 21 import 'system_cache.dart'; | 22 import 'system_cache.dart'; |
| 22 import 'utils.dart'; | 23 import 'utils.dart'; |
| 23 | 24 |
| 24 /// The context surrounding the root package pub is operating on. | 25 /// The context surrounding the root package pub is operating on. |
| 25 /// | 26 /// |
| 26 /// Pub operates over a directed graph of dependencies that starts at a root | 27 /// Pub operates over a directed graph of dependencies that starts at a root |
| 27 /// "entrypoint" package. This is typically the package where the current | 28 /// "entrypoint" package. This is typically the package where the current |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 packageGraph.loadTransformerCache().clearIfOutdated(result.changedPackages); | 145 packageGraph.loadTransformerCache().clearIfOutdated(result.changedPackages); |
| 145 | 146 |
| 146 try { | 147 try { |
| 147 await precompileDependencies(changed: result.changedPackages); | 148 await precompileDependencies(changed: result.changedPackages); |
| 148 await precompileExecutables(changed: result.changedPackages); | 149 await precompileExecutables(changed: result.changedPackages); |
| 149 } catch (error, stackTrace) { | 150 } catch (error, stackTrace) { |
| 150 // Just log exceptions here. Since the method is just about acquiring | 151 // Just log exceptions here. Since the method is just about acquiring |
| 151 // dependencies, it shouldn't fail unless that fails. | 152 // dependencies, it shouldn't fail unless that fails. |
| 152 log.exception(error, stackTrace); | 153 log.exception(error, stackTrace); |
| 153 } | 154 } |
| 155 |
| 156 writePackagesMap(_packageGraph); |
| 154 } | 157 } |
| 155 | 158 |
| 156 /// Precompile any transformed dependencies of the entrypoint. | 159 /// Precompile any transformed dependencies of the entrypoint. |
| 157 /// | 160 /// |
| 158 /// If [changed] is passed, only dependencies whose contents might be changed | 161 /// If [changed] is passed, only dependencies whose contents might be changed |
| 159 /// if one of the given packages changes will be recompiled. | 162 /// if one of the given packages changes will be recompiled. |
| 160 Future precompileDependencies({Iterable<String> changed}) async { | 163 Future precompileDependencies({Iterable<String> changed}) async { |
| 161 if (changed != null) changed = changed.toSet(); | 164 if (changed != null) changed = changed.toSet(); |
| 162 | 165 |
| 163 var graph = await loadPackageGraph(); | 166 var graph = await loadPackageGraph(); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 /// If [packageSymlinks] is true, creates a symlink to the "packages" | 558 /// If [packageSymlinks] is true, creates a symlink to the "packages" |
| 556 /// directory in [dir]. | 559 /// directory in [dir]. |
| 557 /// | 560 /// |
| 558 /// Otherwise, deletes a "packages" directories in [dir] if one exists. | 561 /// Otherwise, deletes a "packages" directories in [dir] if one exists. |
| 559 void _linkOrDeleteSecondaryPackageDir(String dir) { | 562 void _linkOrDeleteSecondaryPackageDir(String dir) { |
| 560 var symlink = path.join(dir, 'packages'); | 563 var symlink = path.join(dir, 'packages'); |
| 561 if (entryExists(symlink)) deleteEntry(symlink); | 564 if (entryExists(symlink)) deleteEntry(symlink); |
| 562 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true); | 565 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true); |
| 563 } | 566 } |
| 564 } | 567 } |
| OLD | NEW |