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

Side by Side Diff: lib/src/report/html_reporter.dart

Issue 1422323005: Serve html report in server mode (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Reformat Created 5 years, 1 month 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 | « lib/src/compiler.dart ('k') | lib/src/runner/v8_runner.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 library dev_compiler.src.html_reporter; 5 library dev_compiler.src.html_reporter;
6 6
7 import 'dart:collection' show LinkedHashSet; 7 import 'dart:collection' show LinkedHashSet;
8 import 'dart:convert' show HTML_ESCAPE; 8 import 'dart:convert' show HTML_ESCAPE;
9 import 'dart:io'; 9 import 'dart:io';
10 10
11 import 'package:analyzer/src/generated/engine.dart'; 11 import 'package:analyzer/src/generated/engine.dart';
12 import 'package:analyzer/src/generated/error.dart'; 12 import 'package:analyzer/src/generated/error.dart';
13 import 'package:analyzer/src/generated/source.dart'; 13 import 'package:analyzer/src/generated/source.dart';
14 import 'package:path/path.dart' as path;
14 import 'package:source_span/source_span.dart'; 15 import 'package:source_span/source_span.dart';
15 import 'package:yaml/yaml.dart' as yaml; 16 import 'package:yaml/yaml.dart' as yaml;
16 17
17 import '../../devc.dart'; 18 import '../../devc.dart';
18 import '../options.dart'; 19 import '../options.dart';
19 import '../report.dart'; 20 import '../report.dart';
20 import '../summary.dart'; 21 import '../summary.dart';
21 import 'html_gen.dart'; 22 import 'html_gen.dart';
22 23
23 /// Generate a compilation summary using the [Primer](http://primercss.io) css. 24 /// Generate a compilation summary using the [Primer](http://primercss.io) css.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 99
99 // Loose files 100 // Loose files
100 if (result.loose.isNotEmpty) { 101 if (result.loose.isNotEmpty) {
101 List<MessageSummary> issues = result.loose.values 102 List<MessageSummary> issues = result.loose.values
102 .expand((IndividualSummary summary) => summary.messages) 103 .expand((IndividualSummary summary) => summary.messages)
103 .toList(); 104 .toList();
104 summaries.add(new SummaryInfo('Files', 'files', 'files', issues)); 105 summaries.add(new SummaryInfo('Files', 'files', 'files', issues));
105 } 106 }
106 107
107 // Write the html report. 108 // Write the html report.
108 Page page = new Page(input, input, summaries); 109 var page = new Page(input, input, summaries);
109 String path = '${input.replaceAll('.', '_')}_results.html'; 110 var outPath = '${input.replaceAll('.', '_')}_results.html';
110 new File(path).writeAsStringSync(page.create()); 111 var link = outPath;
111 print('Compilation report available at ${path}; ${errors.length} issues.'); 112 if (options.serverMode) {
113 var base = path.basename(outPath);
114 outPath = path.join(options.codegenOptions.outputDir, base);
115 link = 'http://${options.host}:${options.port}/$base';
116 }
117 new File(outPath).writeAsStringSync(page.create());
118 print('Compilation report available at ${link}; ${errors.length} issues.');
112 } 119 }
113 120
114 String _getPackageName() { 121 String _getPackageName() {
115 File file = new File('pubspec.yaml'); 122 File file = new File('pubspec.yaml');
116 if (file.existsSync()) { 123 if (file.existsSync()) {
117 var doc = yaml.loadYaml(file.readAsStringSync()); 124 var doc = yaml.loadYaml(file.readAsStringSync());
118 return doc['name']; 125 return doc['name'];
119 } else { 126 } else {
120 return null; 127 return null;
121 } 128 }
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 } 523 }
517 524
518 .blob-code-expandable { 525 .blob-code-expandable {
519 padding-top: 4px; 526 padding-top: 4px;
520 padding-bottom: 4px; 527 padding-bottom: 4px;
521 background-color: #f4f7fb; 528 background-color: #f4f7fb;
522 border-width: 1px 0; 529 border-width: 1px 0;
523 border-bottom-right-radius: 3px; 530 border-bottom-right-radius: 3px;
524 } 531 }
525 '''; 532 ''';
OLDNEW
« no previous file with comments | « lib/src/compiler.dart ('k') | lib/src/runner/v8_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698