| 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'; | |
| 10 import 'dart:io'; | 9 import 'dart:io'; |
| 11 | 10 |
| 12 import 'package:dart2js_info/info.dart'; | 11 import 'package:dart2js_info/info.dart'; |
| 13 import 'package:dart2js_info/src/graph.dart'; | 12 import 'package:dart2js_info/src/graph.dart'; |
| 14 import 'package:dart2js_info/src/util.dart'; | 13 import 'package:dart2js_info/src/util.dart'; |
| 15 | 14 |
| 16 main(args) { | 15 main(args) async { |
| 17 if (args.length < 1) { | 16 if (args.length < 1) { |
| 18 print('usage: dart tool/debug_info.dart path-to-info.json ' | 17 print('usage: dart tool/debug_info.dart path-to-info.json ' |
| 19 '[--show-library libname]'); | 18 '[--show-library libname]'); |
| 20 exit(1); | 19 exit(1); |
| 21 } | 20 } |
| 22 | 21 |
| 23 var filename = args[0]; | 22 var info = await infoFromFile(args.first); |
| 24 var json = JSON.decode(new File(filename).readAsStringSync()); | |
| 25 var info = new AllInfoJsonCodec().decode(json); | |
| 26 var debugLibName; | 23 var debugLibName; |
| 27 | 24 |
| 28 if (args.length > 2 && args[1] == '--show-library') { | 25 if (args.length > 2 && args[1] == '--show-library') { |
| 29 debugLibName = args[2]; | 26 debugLibName = args[2]; |
| 30 } | 27 } |
| 31 | 28 |
| 32 validateSize(info, debugLibName); | 29 validateSize(info, debugLibName); |
| 33 compareGraphs(info); | 30 compareGraphs(info); |
| 34 verifyDeps(info); | 31 verifyDeps(info); |
| 35 } | 32 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 if (unreachables.isNotEmpty) { | 274 if (unreachables.isNotEmpty) { |
| 278 _fail('${unreachables.length} elements are unreachable from the ' | 275 _fail('${unreachables.length} elements are unreachable from the ' |
| 279 'entrypoint'); | 276 'entrypoint'); |
| 280 } else { | 277 } else { |
| 281 _pass('all elements are reachable from the entrypoint'); | 278 _pass('all elements are reachable from the entrypoint'); |
| 282 } | 279 } |
| 283 } | 280 } |
| 284 | 281 |
| 285 _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg'); | 282 _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg'); |
| 286 _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg'); | 283 _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg'); |
| OLD | NEW |