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_upgrade_test; | 5 library pub_upgrade_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:pub/src/lock_file.dart'; | 9 import 'package:pub/src/lock_file.dart'; |
10 import 'package:pub/src/log.dart' as log; | 10 import 'package:pub/src/log.dart' as log; |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 if (result != null) { | 1159 if (result != null) { |
1160 var newResult = {}; | 1160 var newResult = {}; |
1161 result.forEach((description, version) { | 1161 result.forEach((description, version) { |
1162 var id = parseSpec(description, version); | 1162 var id = parseSpec(description, version); |
1163 newResult[id.name] = id; | 1163 newResult[id.name] = id; |
1164 }); | 1164 }); |
1165 result = newResult; | 1165 result = newResult; |
1166 } | 1166 } |
1167 | 1167 |
1168 // Parse the lockfile. | 1168 // Parse the lockfile. |
1169 var realLockFile = new LockFile.empty(); | 1169 var realLockFile; |
1170 if (lockfile != null) { | 1170 if (lockfile == null) { |
1171 lockfile.forEach((name, version) { | 1171 realLockFile = new LockFile.empty(cache.sources); |
1172 version = new Version.parse(version); | 1172 } else { |
1173 realLockFile.packages[name] = | 1173 realLockFile = new LockFile(lockfile.keys.map((name) { |
1174 new PackageId(name, source1.name, version, name); | 1174 var version = new Version.parse(lockfile[name]); |
1175 }); | 1175 return new PackageId(name, source1.name, version, name); |
| 1176 }), cache.sources); |
1176 } | 1177 } |
1177 | 1178 |
1178 // Resolve the versions. | 1179 // Resolve the versions. |
1179 log.verbosity = log.Verbosity.NONE; | 1180 log.verbosity = log.Verbosity.NONE; |
1180 var future = resolveVersions( | 1181 var future = resolveVersions( |
1181 downgrade ? SolveType.DOWNGRADE : SolveType.GET, | 1182 downgrade ? SolveType.DOWNGRADE : SolveType.GET, |
1182 cache.sources, root, lockFile: realLockFile); | 1183 cache.sources, root, lockFile: realLockFile); |
1183 | 1184 |
1184 var matcher; | 1185 var matcher; |
1185 if (result != null) { | 1186 if (result != null) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 } | 1531 } |
1531 | 1532 |
1532 var source = "mock1"; | 1533 var source = "mock1"; |
1533 if (match[7] != null) { | 1534 if (match[7] != null) { |
1534 source = match[7]; | 1535 source = match[7]; |
1535 if (source == "root") source = null; | 1536 if (source == "root") source = null; |
1536 } | 1537 } |
1537 | 1538 |
1538 return new PackageId(name, source, parsedVersion, description); | 1539 return new PackageId(name, source, parsedVersion, description); |
1539 } | 1540 } |
OLD | NEW |