fix up some tests and tweak transformers a bit
diff --git a/.status b/.status
index c3743e9..ec2d028 100644
--- a/.status
+++ b/.status
@@ -5,11 +5,14 @@
# Don't run any test-like files that show up in packages directories. It
# shouldn't be necessary to run "pub install" in these packages, but if you do
# it shouldn't break the tests.
-*/packages/*/*: Skip
-*/*/packages/*/*: Skip
-*/*/*/packages/*/*: Skip
-*/*/*/*/packages/*/*: Skip
-*/*/*/*/*/packages/*/*: Skip
+*/packages/*/*: SkipByDesign
+*/*/packages/*/*: SkipByDesign
+*/*/*/packages/*/*: SkipByDesign
+*/*/*/*/packages/*/*: SkipByDesign
+*/*/*/*/*/packages/*/*: SkipByDesign
+
+# Fails build step because of bad imports
+build/html_import_annotation_test: SkipByDesign # Invalid once built
[ $compiler == none && ($runtime == dartium || $runtime == ContentShellOnAndroid) ]
test/interop_test: Pass, RuntimeError # Issue 18931
@@ -18,8 +21,10 @@
build/test/interop_test: Fail # Issue 19329
[ $runtime == vm || $runtime == d8 || $runtime == jsshell ]
-test/*: Skip # uses dart:html
-build/test/*: Skip # uses dart:html
+test/*: SkipByDesign # uses dart:html
+build/test/*: SkipByDesign # uses dart:html
+e2e_test/html_imports/test/*: SkipByDesign # uses dart:html
+build/e2e_test/html_imports/test/*: SkipByDesign # uses dart:html
[ $compiler == dart2js ]
test/*: Skip # use pub-build to run tests (they need the companion .html file)
diff --git a/e2e_test/html_imports/pubspec.yaml b/e2e_test/html_imports/pubspec.yaml
index 8ebcd6e..996c03b 100644
--- a/e2e_test/html_imports/pubspec.yaml
+++ b/e2e_test/html_imports/pubspec.yaml
@@ -8,4 +8,5 @@
unittest: '^0.11.0'
transformers:
- web_components:
+ $include: '**/*_test.html'
entry_points: test/basic_test.html
diff --git a/e2e_test/html_imports/test/basic_test.html b/e2e_test/html_imports/test/basic_test.html
index 0ee8bdc..e899e5d 100644
--- a/e2e_test/html_imports/test/basic_test.html
+++ b/e2e_test/html_imports/test/basic_test.html
@@ -1,8 +1,11 @@
<!DOCTYPE html>
<html>
<head>
+ <meta name="dart.unittest" content="full-stack-traces">
</head>
<body>
+ <script type="text/javascript"
+ src="/root_dart/tools/testing/dart/test_controller.js"></script>
<script type="application/dart" src="basic_test.dart"></script>
<script src="packages/browser/dart.js"></script>
</body>
diff --git a/lib/build/import_inliner.dart b/lib/build/import_inliner.dart
index c87dcb6..de8beb0 100644
--- a/lib/build/import_inliner.dart
+++ b/lib/build/import_inliner.dart
@@ -34,7 +34,7 @@
}
apply(Transform transform) {
- var logger = new BuildLogger(transform);
+ var logger = new BuildLogger(transform, convertErrorsToWarnings: true);
return new ImportInliner(transform, transform.primaryInput.id, logger)
.run();
}
@@ -58,7 +58,7 @@
var primaryDocument = imports[primaryInput].document;
// Normalize urls in the entry point.
- var changed = new _UrlNormalizer(transform, primaryInput, logger)
+ var changed = new _UrlNormalizer(primaryInput, primaryInput, logger)
.visit(primaryDocument);
// Inline things if needed, always have at least one (the entry point).
@@ -104,7 +104,7 @@
.querySelectorAll('script[type="$dartType"]')
.forEach((script) => script.remove());
// Normalize urls in attributes and inline css.
- new _UrlNormalizer(transform, asset, logger).visit(document);
+ new _UrlNormalizer(primaryInput, asset, logger).visit(document);
// Replace the import with its contents by appending the nodes
// immediately before the import one at a time, and then removing the
// import from the document.
@@ -157,7 +157,8 @@
// completely from polymer or exposing it publicly here and using that in
// polymer.
class _UrlNormalizer extends TreeVisitor {
- final Transform transform;
+ /// [AssetId] for the main entry point.
+ final AssetId primaryInput;
/// Asset where the original content (and original url) was found.
final AssetId sourceId;
@@ -174,10 +175,9 @@
final BuildLogger logger;
- _UrlNormalizer(transform, this.sourceId, this.logger)
- : transform = transform,
- topLevelPath = '../' *
- (transform.primaryInput.id.path.split('/').length - 2);
+ _UrlNormalizer(AssetId primaryInput, this.sourceId, this.logger)
+ : primaryInput = primaryInput,
+ topLevelPath = '../' * (primaryInput.path.split('/').length - 2);
bool visit(Node node) {
super.visit(node);
@@ -215,7 +215,7 @@
// TODO(jmesserly): use csslib here instead? Parsing with RegEx is sadness.
// Maybe it's reliable enough for finding URLs in CSS? I'm not sure.
String visitCss(String cssText) {
- var url = spanUrlFor(sourceId, transform.primaryInput.id, logger);
+ var url = spanUrlFor(sourceId, primaryInput, logger);
var src = new SourceFile(cssText, url: url);
return cssText.replaceAllMapped(_url, (match) {
changed = true;
@@ -266,7 +266,7 @@
var id = uriToAssetId(sourceId, hrefToParse, logger, span);
if (id == null) return href;
- var primaryId = transform.primaryInput.id;
+ var primaryId = primaryInput;
// Build the new path, placing back any suffixes that we stripped earlier.
var prefix =
diff --git a/lib/build/script_compactor.dart b/lib/build/script_compactor.dart
index e26a979..c1f7931 100644
--- a/lib/build/script_compactor.dart
+++ b/lib/build/script_compactor.dart
@@ -183,7 +183,7 @@
var id = uriToAssetId(from, uri, logger, span, errorOnAbsolute: false);
if (id == null) continue;
- var primaryId = transform.primaryInput.id;
+ var primaryId = primaryInput;
var newUri = assetUrlFor(id, primaryId, logger);
if (newUri != uri) {
output.edit(span.start.offset, span.end.offset, "'$newUri'");
diff --git a/test/build/import_inliner_test.dart b/test/build/import_inliner_test.dart
index 5eb1c9f..1581355 100644
--- a/test/build/import_inliner_test.dart
+++ b/test/build/import_inliner_test.dart
@@ -605,7 +605,7 @@
<link rel="import" href="foo.html">
</head></html>''',
}, {}, [
- 'error: ${inlineImportFail.create({
+ 'warning: ${inlineImportFail.create({
'error': 'Could not find asset a|web/foo.html.'
}).snippet} '
'(web/test.html 1 8)',