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.lock_file; | 5 library pub.lock_file; |
6 | 6 |
7 import 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
| 8 import 'package:pub_semver/pub_semver.dart'; |
8 import 'package:source_span/source_span.dart'; | 9 import 'package:source_span/source_span.dart'; |
9 import 'package:yaml/yaml.dart'; | 10 import 'package:yaml/yaml.dart'; |
10 | 11 |
11 import 'io.dart'; | 12 import 'io.dart'; |
12 import 'package.dart'; | 13 import 'package.dart'; |
13 import 'source_registry.dart'; | 14 import 'source_registry.dart'; |
14 import 'utils.dart'; | 15 import 'utils.dart'; |
15 import 'version.dart'; | |
16 | 16 |
17 /// A parsed and validated `pubspec.lock` file. | 17 /// A parsed and validated `pubspec.lock` file. |
18 class LockFile { | 18 class LockFile { |
19 /// The packages this lockfile pins. | 19 /// The packages this lockfile pins. |
20 Map<String, PackageId> packages; | 20 Map<String, PackageId> packages; |
21 | 21 |
22 /// Creates a new lockfile containing [ids]. | 22 /// Creates a new lockfile containing [ids]. |
23 factory LockFile(List<PackageId> ids) { | 23 factory LockFile(List<PackageId> ids) { |
24 var lockFile = new LockFile.empty(); | 24 var lockFile = new LockFile.empty(); |
25 for (var id in ids) { | 25 for (var id in ids) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 }; | 127 }; |
128 }); | 128 }); |
129 | 129 |
130 return """ | 130 return """ |
131 # Generated by pub | 131 # Generated by pub |
132 # See http://pub.dartlang.org/doc/glossary.html#lockfile | 132 # See http://pub.dartlang.org/doc/glossary.html#lockfile |
133 ${yamlToString({'packages': data})} | 133 ${yamlToString({'packages': data})} |
134 """; | 134 """; |
135 } | 135 } |
136 } | 136 } |
OLD | NEW |