| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.package_graph; | 5 library pub.package_graph; |
| 6 | 6 |
| 7 import 'barback/transformer_cache.dart'; | 7 import 'barback/transformer_cache.dart'; |
| 8 import 'entrypoint.dart'; | 8 import 'entrypoint.dart'; |
| 9 import 'lock_file.dart'; | 9 import 'lock_file.dart'; |
| 10 import 'package.dart'; | 10 import 'package.dart'; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 SolveResult result) { | 46 SolveResult result) { |
| 47 var packages = new Map.fromIterable(result.packages, | 47 var packages = new Map.fromIterable(result.packages, |
| 48 key: (id) => id.name, | 48 key: (id) => id.name, |
| 49 value: (id) { | 49 value: (id) { |
| 50 if (id.name == entrypoint.root.name) return entrypoint.root; | 50 if (id.name == entrypoint.root.name) return entrypoint.root; |
| 51 | 51 |
| 52 return new Package(result.pubspecs[id.name], | 52 return new Package(result.pubspecs[id.name], |
| 53 entrypoint.cache.sources[id.source].getDirectory(id)); | 53 entrypoint.cache.sources[id.source].getDirectory(id)); |
| 54 }); | 54 }); |
| 55 | 55 |
| 56 return new PackageGraph( | 56 return new PackageGraph(entrypoint, result.lockFile, packages); |
| 57 entrypoint, | |
| 58 new LockFile(result.packages, entrypoint.cache.sources), | |
| 59 packages); | |
| 60 } | 57 } |
| 61 | 58 |
| 62 /// Loads the transformer cache for this graph. | 59 /// Loads the transformer cache for this graph. |
| 63 /// | 60 /// |
| 64 /// This may only be called if [entrypoint] represents a physical package. | 61 /// This may only be called if [entrypoint] represents a physical package. |
| 65 /// This may modify the cache. | 62 /// This may modify the cache. |
| 66 TransformerCache loadTransformerCache() { | 63 TransformerCache loadTransformerCache() { |
| 67 if (_transformerCache == null) { | 64 if (_transformerCache == null) { |
| 68 if (entrypoint.root.dir == null) { | 65 if (entrypoint.root.dir == null) { |
| 69 throw new StateError("Can't load the transformer cache for virtual " | 66 throw new StateError("Can't load the transformer cache for virtual " |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 bool isPackageStatic(String package) { | 152 bool isPackageStatic(String package) { |
| 156 var id = lockFile.packages[package]; | 153 var id = lockFile.packages[package]; |
| 157 if (id == null) return false; | 154 if (id == null) return false; |
| 158 | 155 |
| 159 var source = entrypoint.cache.sources[id.source]; | 156 var source = entrypoint.cache.sources[id.source]; |
| 160 if (source is! CachedSource) return false; | 157 if (source is! CachedSource) return false; |
| 161 | 158 |
| 162 return packages[package].pubspec.transformers.isEmpty; | 159 return packages[package].pubspec.transformers.isEmpty; |
| 163 } | 160 } |
| 164 } | 161 } |
| OLD | NEW |