| 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 entrypoint; | 5 library entrypoint; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import '../../pkg/path/lib/path.dart' as path; | 9 import '../../pkg/path/lib/path.dart' as path; |
| 10 | 10 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 "package."); | 202 "package."); |
| 203 } | 203 } |
| 204 }); | 204 }); |
| 205 } | 205 } |
| 206 | 206 |
| 207 /// Loads the list of concrete package versions from the `pubspec.lock`, if it | 207 /// Loads the list of concrete package versions from the `pubspec.lock`, if it |
| 208 /// exists. If it doesn't, this completes to an empty [LockFile]. | 208 /// exists. If it doesn't, this completes to an empty [LockFile]. |
| 209 LockFile loadLockFile() { | 209 LockFile loadLockFile() { |
| 210 var lockFilePath = path.join(root.dir, 'pubspec.lock'); | 210 var lockFilePath = path.join(root.dir, 'pubspec.lock'); |
| 211 if (!fileExists(lockFilePath)) return new LockFile.empty(); | 211 if (!fileExists(lockFilePath)) return new LockFile.empty(); |
| 212 return new LockFile.parse(readTextFile(lockFilePath), cache.sources); | 212 return new LockFile.load(lockFilePath, cache.sources); |
| 213 } | 213 } |
| 214 | 214 |
| 215 /// Saves a list of concrete package versions to the `pubspec.lock` file. | 215 /// Saves a list of concrete package versions to the `pubspec.lock` file. |
| 216 void _saveLockFile(List<PackageId> packageIds) { | 216 void _saveLockFile(List<PackageId> packageIds) { |
| 217 var lockFile = new LockFile.empty(); | 217 var lockFile = new LockFile.empty(); |
| 218 for (var id in packageIds) { | 218 for (var id in packageIds) { |
| 219 if (!id.isRoot) lockFile.packages[id.name] = id; | 219 if (!id.isRoot) lockFile.packages[id.name] = id; |
| 220 } | 220 } |
| 221 | 221 |
| 222 var lockFilePath = path.join(root.dir, 'pubspec.lock'); | 222 var lockFilePath = path.join(root.dir, 'pubspec.lock'); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 fileAndSubfiles.addAll(subfiles); | 287 fileAndSubfiles.addAll(subfiles); |
| 288 return fileAndSubfiles; | 288 return fileAndSubfiles; |
| 289 }); | 289 }); |
| 290 }).toList()); | 290 }).toList()); |
| 291 }).then(flatten); | 291 }).then(flatten); |
| 292 } | 292 } |
| 293 | 293 |
| 294 /// Creates a symlink to the `packages` directory in [dir] if none exists. | 294 /// Creates a symlink to the `packages` directory in [dir] if none exists. |
| 295 Future _linkSecondaryPackageDir(String dir) { | 295 Future _linkSecondaryPackageDir(String dir) { |
| 296 return defer(() { | 296 return defer(() { |
| 297 var to = path.join(dir, 'packages'); | 297 var symlink = path.join(dir, 'packages'); |
| 298 if (entryExists(to)) return; | 298 if (entryExists(symlink)) return; |
| 299 return createSymlink(packagesDir, to); | 299 return createSymlink(packagesDir, symlink); |
| 300 }); | 300 }); |
| 301 } | 301 } |
| 302 } | 302 } |
| OLD | NEW |