| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.global_packages; | 5 library pub.global_packages; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
| 11 import 'package:barback/barback.dart'; | 11 import 'package:barback/barback.dart'; |
| 12 import 'package:pub_semver/pub_semver.dart'; | 12 import 'package:pub_semver/pub_semver.dart'; |
| 13 | 13 |
| 14 import 'barback/asset_environment.dart'; | 14 import 'barback/asset_environment.dart'; |
| 15 import 'entrypoint.dart'; | 15 import 'entrypoint.dart'; |
| 16 import 'exceptions.dart'; | 16 import 'exceptions.dart'; |
| 17 import 'executable.dart' as exe; | 17 import 'executable.dart' as exe; |
| 18 import 'io.dart'; | 18 import 'io.dart'; |
| 19 import 'lock_file.dart'; | 19 import 'lock_file.dart'; |
| 20 import 'log.dart' as log; | 20 import 'log.dart' as log; |
| 21 import 'package.dart'; | 21 import 'package.dart'; |
| 22 import 'package_locations.dart'; | |
| 23 import 'pubspec.dart'; | 22 import 'pubspec.dart'; |
| 24 import 'sdk.dart' as sdk; | 23 import 'sdk.dart' as sdk; |
| 25 import 'solver/version_solver.dart'; | 24 import 'solver/version_solver.dart'; |
| 26 import 'source/cached.dart'; | 25 import 'source/cached.dart'; |
| 27 import 'source/git.dart'; | 26 import 'source/git.dart'; |
| 28 import 'source/path.dart'; | 27 import 'source/path.dart'; |
| 29 import 'system_cache.dart'; | 28 import 'system_cache.dart'; |
| 30 import 'utils.dart'; | 29 import 'utils.dart'; |
| 31 | 30 |
| 32 /// Maintains the set of packages that have been globally activated. | 31 /// Maintains the set of packages that have been globally activated. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // Make sure all of the dependencies are locally installed. | 169 // Make sure all of the dependencies are locally installed. |
| 171 var ids = await Future.wait(result.packages.map(_cacheDependency)); | 170 var ids = await Future.wait(result.packages.map(_cacheDependency)); |
| 172 var lockFile = new LockFile(ids, cache.sources); | 171 var lockFile = new LockFile(ids, cache.sources); |
| 173 | 172 |
| 174 // Load the package graph from [result] so we don't need to re-parse all | 173 // Load the package graph from [result] so we don't need to re-parse all |
| 175 // the pubspecs. | 174 // the pubspecs. |
| 176 var graph = await new Entrypoint.inMemory(root, lockFile, cache) | 175 var graph = await new Entrypoint.inMemory(root, lockFile, cache) |
| 177 .loadPackageGraph(result); | 176 .loadPackageGraph(result); |
| 178 var snapshots = await _precompileExecutables(graph.entrypoint, dep.name); | 177 var snapshots = await _precompileExecutables(graph.entrypoint, dep.name); |
| 179 _writeLockFile(dep.name, lockFile); | 178 _writeLockFile(dep.name, lockFile); |
| 180 writePackagesMap(graph, _getPackagesFilePath(dep.name)); | 179 writeTextFile(_getPackagesFilePath(dep.name), lockFile.packagesFile()); |
| 181 | 180 |
| 182 _updateBinStubs(graph.packages[dep.name], executables, | 181 _updateBinStubs(graph.packages[dep.name], executables, |
| 183 overwriteBinStubs: overwriteBinStubs, snapshots: snapshots); | 182 overwriteBinStubs: overwriteBinStubs, snapshots: snapshots); |
| 184 } | 183 } |
| 185 | 184 |
| 186 /// Precompiles the executables for [package] and saves them in the global | 185 /// Precompiles the executables for [package] and saves them in the global |
| 187 /// cache. | 186 /// cache. |
| 188 /// | 187 /// |
| 189 /// Returns a map from executable name to path for the snapshots that were | 188 /// Returns a map from executable name to path for the snapshots that were |
| 190 /// successfully precompiled. | 189 /// successfully precompiled. |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 } | 784 } |
| 786 | 785 |
| 787 /// Returns the value of the property named [name] in the bin stub script | 786 /// Returns the value of the property named [name] in the bin stub script |
| 788 /// [source]. | 787 /// [source]. |
| 789 String _binStubProperty(String source, String name) { | 788 String _binStubProperty(String source, String name) { |
| 790 var pattern = new RegExp(quoteRegExp(name) + r": ([a-zA-Z0-9_-]+)"); | 789 var pattern = new RegExp(quoteRegExp(name) + r": ([a-zA-Z0-9_-]+)"); |
| 791 var match = pattern.firstMatch(source); | 790 var match = pattern.firstMatch(source); |
| 792 return match == null ? null : match[1]; | 791 return match == null ? null : match[1]; |
| 793 } | 792 } |
| 794 } | 793 } |
| OLD | NEW |