OLD | NEW |
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 Loading... |
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 Loading... |
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 """; |
OLD | NEW |