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 /// Tool used mainly by dart2js developers to debug the generated info and check | 5 /// Tool used mainly by dart2js developers to debug the generated info and check |
6 /// that it is consistent and that it covers all the data we expect it to cover. | 6 /// that it is consistent and that it covers all the data we expect it to cover. |
7 library dart2js_info.bin.debug_info; | 7 library dart2js_info.bin.debug_info; |
8 | 8 |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:io'; | 10 import 'dart:io'; |
11 | 11 |
12 import 'package:dart2js_info/info.dart'; | 12 import 'package:dart2js_info/info.dart'; |
13 import 'package:dart2js_info/src/graph.dart'; | 13 import 'package:dart2js_info/src/graph.dart'; |
14 | 14 |
15 main(args) { | 15 main(args) { |
16 if (args.length < 1) { | 16 if (args.length < 1) { |
17 print('usage: dart tool/debug_info.dart path-to-info.json ' | 17 print('usage: dart tool/debug_info.dart path-to-info.json ' |
18 '[--show-library libname]'); | 18 '[--show-library libname]'); |
19 exit(1); | 19 exit(1); |
20 } | 20 } |
21 | 21 |
22 var filename = args[0]; | 22 var filename = args[0]; |
23 var json = JSON.decode(new File(filename).readAsStringSync()); | 23 var json = JSON.decode(new File(filename).readAsStringSync()); |
24 var info = new AllInfo.fromJson(json); | 24 var info = new AllInfoJsonCodec().decode(json); |
25 var debugLibName; | 25 var debugLibName; |
26 | 26 |
27 if (args.length > 2 && args[1] == '--show-library') { | 27 if (args.length > 2 && args[1] == '--show-library') { |
28 debugLibName = args[2]; | 28 debugLibName = args[2]; |
29 } | 29 } |
30 | 30 |
31 // Gather data from visiting all info elements. | 31 // Gather data from visiting all info elements. |
32 var tracker = new _SizeTracker(debugLibName); | 32 var tracker = new _SizeTracker(debugLibName); |
33 info.accept(tracker); | 33 info.accept(tracker); |
34 | 34 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 _pass('dependency data is consistent'); | 253 _pass('dependency data is consistent'); |
254 } else { | 254 } else { |
255 _fail('inconsistencies in dependency data:\n' | 255 _fail('inconsistencies in dependency data:\n' |
256 ' $inUsesNotInDependencies edges missing from "dependencies" graph\n' | 256 ' $inUsesNotInDependencies edges missing from "dependencies" graph\n' |
257 ' $inDependenciesNotInUses edges missing from "uses" graph'); | 257 ' $inDependenciesNotInUses edges missing from "uses" graph'); |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg'); | 261 _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg'); |
262 _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg'); | 262 _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg'); |
OLD | NEW |