Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
Fixes for html report
Browse files Browse the repository at this point in the history
This forces a regen of the summary when a file is recompiled.  It also suppresses dart: entries during normal compilation.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1523353002 .
  • Loading branch information
vsmenon committed Dec 15, 2015
1 parent 7506fe2 commit 9b93a41
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
6 changes: 4 additions & 2 deletions lib/src/report/html_reporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ class HtmlReporter implements AnalysisErrorListener {
keys = result.system.keys.toList()..sort();
for (String name in keys) {
LibrarySummary summary = result.system[name];
summaries.add(new SummaryInfo(
'Dart: code', name, 'dart:${name}', summary.messages));
if (summary.messages.isNotEmpty) {
summaries.add(new SummaryInfo(
'Dart: code', name, 'dart:${name}', summary.messages));
}
}

// Loose files
Expand Down
32 changes: 23 additions & 9 deletions lib/src/server/dependency_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import '../compiler.dart' show defaultRuntimeFiles;
import '../info.dart';
import '../options.dart';
import '../report.dart';
import '../report/html_reporter.dart';

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

void clearSummary() {}

void saveUpdatedContents() {}

String toString() {
Expand Down Expand Up @@ -183,14 +186,20 @@ class HtmlSourceNode extends SourceNode {
: runtimeDeps = graph.runtimeDeps,
super(graph, uri, source);

@override
void clearSummary() {
var reporter = graph._reporter;
if (reporter is HtmlReporter) {
reporter.reporter.clearHtml(uri);
} else if (reporter is SummaryReporter) {
reporter.clearHtml(uri);
}
}

@override
void update() {
super.update();
if (needsRebuild) {
var reporter = graph._reporter;
if (reporter is SummaryReporter) {
reporter.clearHtml(uri);
}
document = html.parse(contents, generateSpans: true);
var newScripts = new Set<DartSourceNode>();
var tags = document.querySelectorAll('script[type="application/dart"]');
Expand Down Expand Up @@ -290,16 +299,21 @@ class DartSourceNode extends SourceNode {
graph._context.setContents(_source, _source.contents.data);
}

@override
void clearSummary() {
var reporter = graph._reporter;
if (reporter is HtmlReporter) {
reporter.reporter.clearLibrary(uri);
} else if (reporter is SummaryReporter) {
reporter.clearLibrary(uri);
}
}

@override
void update() {
super.update();

if (needsRebuild) {
var reporter = graph._reporter;
if (reporter is SummaryReporter) {
reporter.clearLibrary(uri);
}

// If the defining compilation-unit changed, the structure might have
// changed.
var unit = parseDirectives(contents, name: _source.fullName);
Expand Down
1 change: 1 addition & 0 deletions lib/src/server/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class ServerCompiler extends AbstractCompiler {
}

bool _buildSource(SourceNode node) {
node.clearSummary();
if (node is HtmlSourceNode) {
_buildHtmlFile(node);
} else if (node is DartSourceNode) {
Expand Down

0 comments on commit 9b93a41

Please sign in to comment.