[polymer] skip linter in tests

Arguably we should only be linting things reachable from deployment in deploy mode, but that's a bigger change.

Combined with the previous CL for inline scripts (https://codereview.chromium.org/180933002/) this is enough to import polymer's many HTML elements without causing tests to timeout/fail/run out of memory due to unnecessary scanning ~300 HTML files.

R=sigmund@google.com

Review URL: https://codereview.chromium.org//179163007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33146 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
jmesserly@google.com 2014-02-28 03:04:37 +00:00
parent fd8b2caf4b
commit 7b750888b2
3 changed files with 15 additions and 7 deletions

View file

@ -64,6 +64,7 @@ createDeployPhases(options) => new PolymerTransformerGroup(options).phases;
BarbackOptions _createTestOptions(String testFile, String outDir,
bool directlyIncludeJS, bool contentSecurityPolicy, bool releaseMode) {
var testDir = path.normalize(path.dirname(testFile));
// A test must be allowed to import things in the package.
@ -85,7 +86,8 @@ BarbackOptions _createTestOptions(String testFile, String outDir,
entryPoints: [path.relative(testFile, from: pubspecDir)],
directlyIncludeJS: directlyIncludeJS,
contentSecurityPolicy: contentSecurityPolicy,
releaseMode: releaseMode));
releaseMode: releaseMode,
lint: false));
return new BarbackOptions(phases, outDir,
currentPackage: packageName,
packageDirs: {

View file

@ -64,8 +64,13 @@ class TransformOptions {
/// minified versions of the polyfills rather than the debug versions.
final bool releaseMode;
/// True to run liner on all html files before starting other phases.
// TODO(jmesserly): instead of this flag, we should only run linter on
// reachable (entry point+imported) html if deploying. See dartbug.com/17199.
final bool lint;
TransformOptions({entryPoints, this.contentSecurityPolicy: false,
this.directlyIncludeJS: true, this.releaseMode: true})
this.directlyIncludeJS: true, this.releaseMode: true, this.lint: true})
: entryPoints = entryPoints == null ? null
: entryPoints.map(_systemToAssetPath).toList();

View file

@ -66,15 +66,16 @@ _readEntrypoints(value) {
}
/// Create deploy phases for Polymer. Note that inlining HTML Imports
/// comes first (other than linter), which allows the rest of the
/// HTML-processing phases to operate only on HTML that is actually imported.
/// comes first (other than linter, if [options.linter] is enabled), which
/// allows the rest of the HTML-processing phases to operate only on HTML that
/// is actually imported.
List<List<Transformer>> _createDeployPhases(TransformOptions options) {
return [
[new Linter(options)],
var phases = options.lint ? [[new Linter(options)]] : [];
return phases..addAll([
[new ImportInliner(options)],
[new ObservableTransformer()],
[new ScriptCompactor(options)],
[new PolyfillInjector(options)],
[new BuildFilter(options)]
];
]);
}