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

Side by Side Diff: bin/library_size_split.dart

Issue 1411523003: add a JsonInfoCodec class (Closed) Base URL: git@github.com:dart-lang/dart2js_info.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « bin/inference/print_summary.dart ('k') | bin/live_code_size_analysis.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Command-line tool to show the size distribution of generated code among 5 /// Command-line tool to show the size distribution of generated code among
6 /// libraries. Libraries can be grouped using regular expressions. You can 6 /// libraries. Libraries can be grouped using regular expressions. You can
7 /// specify what regular expressions to use by providing a `grouping.yaml` file. 7 /// specify what regular expressions to use by providing a `grouping.yaml` file.
8 /// The format of the `grouping.yaml` file is as follows: 8 /// The format of the `grouping.yaml` file is as follows:
9 /// ```yaml 9 /// ```yaml
10 /// groups: 10 /// groups:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 main(args) { 69 main(args) {
70 if (args.length < 1) { 70 if (args.length < 1) {
71 print('usage: dart tool/library_size_split.dart ' 71 print('usage: dart tool/library_size_split.dart '
72 'path-to-info.json [grouping.yaml]'); 72 'path-to-info.json [grouping.yaml]');
73 exit(1); 73 exit(1);
74 } 74 }
75 75
76 var filename = args[0]; 76 var filename = args[0];
77 var json = JSON.decode(new File(filename).readAsStringSync()); 77 var json = JSON.decode(new File(filename).readAsStringSync());
78 var info = new AllInfo.fromJson(json); 78 var info = new AllInfoJsonCodec().decode(json);
79 79
80 var groupingText = 80 var groupingText =
81 args.length > 1 ? new File(args[1]).readAsStringSync() : defaultGrouping; 81 args.length > 1 ? new File(args[1]).readAsStringSync() : defaultGrouping;
82 var groupingYaml = loadYaml(groupingText); 82 var groupingYaml = loadYaml(groupingText);
83 var groups = []; 83 var groups = [];
84 for (var group in groupingYaml['groups']) { 84 for (var group in groupingYaml['groups']) {
85 groups.add(new _Group( 85 groups.add(new _Group(
86 group['name'], new RegExp(group['regexp']), group['cluster'] ?? 0)); 86 group['name'], new RegExp(group['regexp']), group['cluster'] ?? 0));
87 } 87 }
88 88
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 - { name: "Core libs", regexp: "dart:.*", cluster: 2} 204 - { name: "Core libs", regexp: "dart:.*", cluster: 2}
205 # We omitted `name` to extract the group name from the regexp directly. 205 # We omitted `name` to extract the group name from the regexp directly.
206 # Here the name is the name of the package: 206 # Here the name is the name of the package:
207 - { regexp: "package:([^/]*)", cluster: 1} 207 - { regexp: "package:([^/]*)", cluster: 1}
208 # Here the name is the url of the package and dart core libraries: 208 # Here the name is the url of the package and dart core libraries:
209 - { regexp: "package:.*"} 209 - { regexp: "package:.*"}
210 - { regexp: "dart:.*"} 210 - { regexp: "dart:.*"}
211 # Here the name is the relative path of loose files: 211 # Here the name is the relative path of loose files:
212 - { regexp: "file://${Directory.current.path}/(.*)" } 212 - { regexp: "file://${Directory.current.path}/(.*)" }
213 """; 213 """;
OLDNEW
« no previous file with comments | « bin/inference/print_summary.dart ('k') | bin/live_code_size_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698