Skip to content

Commit db6d860

Browse files
committed
Fixes for html report
This forces a regen of the summary when a file is recompiled. It also suppresses dart: entries during normal compilation. [email protected] Review URL: https://codereview.chromium.org/1523353002 .
1 parent 4deedac commit db6d860

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

pkg/dev_compiler/lib/src/report/html_reporter.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ class HtmlReporter implements AnalysisErrorListener {
9393
keys = result.system.keys.toList()..sort();
9494
for (String name in keys) {
9595
LibrarySummary summary = result.system[name];
96-
summaries.add(new SummaryInfo(
97-
'Dart: code', name, 'dart:${name}', summary.messages));
96+
if (summary.messages.isNotEmpty) {
97+
summaries.add(new SummaryInfo(
98+
'Dart: code', name, 'dart:${name}', summary.messages));
99+
}
98100
}
99101

100102
// Loose files

pkg/dev_compiler/lib/src/server/dependency_graph.dart

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import '../compiler.dart' show defaultRuntimeFiles;
3232
import '../info.dart';
3333
import '../options.dart';
3434
import '../report.dart';
35+
import '../report/html_reporter.dart';
3536

3637
/// Holds references to all source nodes in the import graph. This is mainly
3738
/// used as a level of indirection to ensure that each source has a canonical
@@ -146,6 +147,8 @@ abstract class SourceNode {
146147
}
147148
}
148149

150+
void clearSummary() {}
151+
149152
void saveUpdatedContents() {}
150153

151154
String toString() {
@@ -183,14 +186,20 @@ class HtmlSourceNode extends SourceNode {
183186
: runtimeDeps = graph.runtimeDeps,
184187
super(graph, uri, source);
185188

189+
@override
190+
void clearSummary() {
191+
var reporter = graph._reporter;
192+
if (reporter is HtmlReporter) {
193+
reporter.reporter.clearHtml(uri);
194+
} else if (reporter is SummaryReporter) {
195+
reporter.clearHtml(uri);
196+
}
197+
}
198+
186199
@override
187200
void update() {
188201
super.update();
189202
if (needsRebuild) {
190-
var reporter = graph._reporter;
191-
if (reporter is SummaryReporter) {
192-
reporter.clearHtml(uri);
193-
}
194203
document = html.parse(contents, generateSpans: true);
195204
var newScripts = new Set<DartSourceNode>();
196205
var tags = document.querySelectorAll('script[type="application/dart"]');
@@ -290,16 +299,21 @@ class DartSourceNode extends SourceNode {
290299
graph._context.setContents(_source, _source.contents.data);
291300
}
292301

302+
@override
303+
void clearSummary() {
304+
var reporter = graph._reporter;
305+
if (reporter is HtmlReporter) {
306+
reporter.reporter.clearLibrary(uri);
307+
} else if (reporter is SummaryReporter) {
308+
reporter.clearLibrary(uri);
309+
}
310+
}
311+
293312
@override
294313
void update() {
295314
super.update();
296315

297316
if (needsRebuild) {
298-
var reporter = graph._reporter;
299-
if (reporter is SummaryReporter) {
300-
reporter.clearLibrary(uri);
301-
}
302-
303317
// If the defining compilation-unit changed, the structure might have
304318
// changed.
305319
var unit = parseDirectives(contents, name: _source.fullName);

pkg/dev_compiler/lib/src/server/server.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class ServerCompiler extends AbstractCompiler {
8989
}
9090

9191
bool _buildSource(SourceNode node) {
92+
node.clearSummary();
9293
if (node is HtmlSourceNode) {
9394
_buildHtmlFile(node);
9495
} else if (node is DartSourceNode) {

0 commit comments

Comments
 (0)