| Index: sdk/lib/_internal/pub/lib/src/lock_file.dart
|
| diff --git a/sdk/lib/_internal/pub/lib/src/lock_file.dart b/sdk/lib/_internal/pub/lib/src/lock_file.dart
|
| index 316e8b58803b9b72e6421b8804c8ac146849b79e..7f69ca1ce098ab41e509bc99f1eaeb3e8743d48c 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/lock_file.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/lock_file.dart
|
| @@ -4,12 +4,12 @@
|
|
|
| library lock_file;
|
|
|
| -import 'dart:json' as json;
|
| import 'dart:collection';
|
|
|
| import 'package:yaml/yaml.dart';
|
|
|
| import 'io.dart';
|
| +import 'log.dart' as log;
|
| import 'package.dart';
|
| import 'source_registry.dart';
|
| import 'utils.dart';
|
| @@ -88,25 +88,20 @@ class LockFile {
|
|
|
| /// Returns the serialized YAML text of the lock file.
|
| String serialize() {
|
| - var packagesObj = new LinkedHashMap<String, Map>();
|
| -
|
| - // Sort the packages by name.
|
| - var sortedKeys = packages.keys.toList();
|
| - sortedKeys.sort();
|
| - sortedKeys.forEach((name) {
|
| - packagesObj[name] = {
|
| + // Convert the dependencies to a simple object.
|
| + var data = {};
|
| + packages.forEach((name, package) {
|
| + data[name] = {
|
| 'version': packages[name].version.toString(),
|
| 'source': packages[name].source,
|
| 'description': packages[name].description
|
| };
|
| });
|
|
|
| - // TODO(nweiz): Serialize using the YAML library once it supports
|
| - // serialization. For now, we use JSON, since it's a subset of YAML anyway.
|
| - return
|
| - '# Generated by pub\n'
|
| - '# See http://pub.dartlang.org/doc/glossary.html#lockfile\n'
|
| - '\n'
|
| - '${json.stringify({'packages': packagesObj})}\n';
|
| + return """
|
| +# Generated by pub
|
| +# See http://pub.dartlang.org/doc/glossary.html#lockfile
|
| +${yamlToString({'packages': data})}
|
| +""";
|
| }
|
| }
|
|
|