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

Side by Side Diff: bin/debug_info.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/code_deps.dart ('k') | bin/function_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 /// 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
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');
OLDNEW
« no previous file with comments | « bin/code_deps.dart ('k') | bin/function_size_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698