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