Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: sdk/lib/_internal/pub/lib/src/lock_file.dart

Issue 14681002: Sort pubspec.lock packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed print statement. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/lock_file_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2f391613dbe4c396e5196a91e814d32cd30bae14..1e85a4d0e37f080c2bae62b9d59ccccc66dc06f1 100644
--- a/sdk/lib/_internal/pub/lib/src/lock_file.dart
+++ b/sdk/lib/_internal/pub/lib/src/lock_file.dart
@@ -5,6 +5,7 @@
library lock_file;
import 'dart:json' as json;
+import 'dart:collection';
import 'package:yaml/yaml.dart';
@@ -88,12 +89,16 @@ class LockFile {
/// Returns the serialized YAML text of the lock file.
String serialize() {
- var packagesObj = <String, Map>{};
- packages.forEach((name, id) {
+ var packagesObj = new LinkedHashMap<String, Map>();
+
+ // Sort the packages by name.
+ var sortedKeys = packages.keys.toList();
+ sortedKeys.sort();
+ sortedKeys.forEach((name) {
packagesObj[name] = {
- 'version': id.version.toString(),
- 'source': id.source.name,
- 'description': id.description
+ 'version': packages[name].version.toString(),
+ 'source': packages[name].source.name,
+ 'description': packages[name].description
};
});
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/lock_file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698