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

Unified Diff: lib/src/dependency_graph.dart

Issue 1014173002: Copy resources refered to in the HTML to the output folder (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/codegen/html_codegen.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/dependency_graph.dart
diff --git a/lib/src/dependency_graph.dart b/lib/src/dependency_graph.dart
index 2a3675b9be60016b0d99d7d40721ca2f07d889dc..57ea98c7b5203b4fedd62874d6d717c4cac1c480 100644
--- a/lib/src/dependency_graph.dart
+++ b/lib/src/dependency_graph.dart
@@ -73,10 +73,8 @@ class SourceGraph {
return new HtmlSourceNode(uri, source, this);
} else if (extension == '.dart' || uriString.startsWith('dart:')) {
return new DartSourceNode(uri, source);
- } else if (extension == '.js' || extension == '.css') {
- return new ResourceSourceNode(uri, source);
} else {
- assert(false); // unreachable
+ return new ResourceSourceNode(uri, source);
}
});
}
@@ -145,8 +143,12 @@ class HtmlSourceNode extends SourceNode {
/// Libraries referred to via script tags.
Set<DartSourceNode> scripts = new Set<DartSourceNode>();
+ /// Link-rel stylesheets and images.
+ Set<ResourceSourceNode> resources = new Set<ResourceSourceNode>();
+
@override
- Iterable<SourceNode> get allDeps => [scripts, runtimeDeps].expand((e) => e);
+ Iterable<SourceNode> get allDeps =>
+ [scripts, resources, runtimeDeps].expand((e) => e);
@override
Iterable<SourceNode> get depsWithoutParts => allDeps;
@@ -184,6 +186,19 @@ class HtmlSourceNode extends SourceNode {
structureChanged = true;
scripts = newScripts;
}
+
+ var newResources = new Set<ResourceSourceNode>();
+ for (var tag in document.querySelectorAll('link[rel="stylesheet"]')) {
+ newResources
+ .add(graph.nodeFromUri(uri.resolve(tag.attributes['href'])));
+ }
+ for (var tag in document.querySelectorAll('img')) {
+ newResources.add(graph.nodeFromUri(uri.resolve(tag.attributes['src'])));
+ }
+ if (!_same(newResources, resources)) {
+ structureChanged = true;
+ resources = newResources;
+ }
}
}
« no previous file with comments | « lib/src/codegen/html_codegen.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698