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

Side by Side Diff: pkg/polymer/lib/src/build/build_filter.dart

Issue 513023002: Step one towards stable error messages with details: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/lib/src/build/build_log_combiner.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Final phase of the polymer transformation: removes any files that are not 5 /// Final phase of the polymer transformation: removes any files that are not
6 /// needed for deployment. 6 /// needed for deployment.
7 library polymer.src.build.build_filter; 7 library polymer.src.build.build_filter;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 10
11 import 'package:barback/barback.dart'; 11 import 'package:barback/barback.dart';
12 import 'package:code_transformers/messages/build_logger.dart';
12 import 'common.dart'; 13 import 'common.dart';
13 14
14 /// Removes any files not needed for deployment, such as internal build 15 /// Removes any files not needed for deployment, such as internal build
15 /// artifacts and non-entry HTML files. 16 /// artifacts and non-entry HTML files.
16 class BuildFilter extends Transformer with PolymerTransformer { 17 class BuildFilter extends Transformer with PolymerTransformer {
17 final TransformOptions options; 18 final TransformOptions options;
18 BuildFilter(this.options); 19 BuildFilter(this.options);
19 20
20 isPrimary(AssetId id) { 21 isPrimary(AssetId id) {
21 // nothing is filtered in debug mode 22 // nothing is filtered in debug mode
22 return options.releaseMode && 23 return options.releaseMode &&
23 // TODO(sigmund): remove this exclusion once we have dev_transformers 24 // TODO(sigmund): remove this exclusion once we have dev_transformers
24 // (dartbug.com/14187) 25 // (dartbug.com/14187)
25 !id.path.startsWith('lib/') && 26 !id.path.startsWith('lib/') &&
26 // may filter non-entry HTML files and internal artifacts 27 // may filter non-entry HTML files and internal artifacts
27 (id.extension == '.html' || id.extension == _DATA_EXTENSION) && 28 (id.extension == '.html' || id.extension == _DATA_EXTENSION) &&
28 // keep any entry points 29 // keep any entry points
29 !options.isHtmlEntryPoint(id); 30 !options.isHtmlEntryPoint(id);
30 } 31 }
31 32
32 apply(Transform transform) { 33 apply(Transform transform) {
33 transform.consumePrimary(); 34 transform.consumePrimary();
34 if (transform.primaryInput.id.extension == _DATA_EXTENSION) { 35 if (transform.primaryInput.id.extension == _DATA_EXTENSION) {
35 return null; 36 return null;
36 } 37 }
37 return readPrimaryAsHtml(transform).then((document) { 38 var logger = new BuildLogger(transform,
39 convertErrorsToWarnings: !options.releaseMode);
40 return readPrimaryAsHtml(transform, logger).then((document) {
38 // Keep .html files that don't use polymer, since the app developer might 41 // Keep .html files that don't use polymer, since the app developer might
39 // have non-polymer entrypoints. 42 // have non-polymer entrypoints.
40 if (document.querySelectorAll('polymer-element').isEmpty) { 43 if (document.querySelectorAll('polymer-element').isEmpty) {
41 transform.addOutput(transform.primaryInput); 44 transform.addOutput(transform.primaryInput);
42 } 45 }
43 }); 46 });
44 } 47 }
45 } 48 }
46 49
47 const String _DATA_EXTENSION = '._data'; 50 const String _DATA_EXTENSION = '._data';
OLDNEW
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/lib/src/build/build_log_combiner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698